Skip to content

Commit 91c518a

Browse files
committed
Improve monorepo eslint config
1. Fix the copyright header lint rule. Extra blank comment lines are now avoided. All pragmas are preserved. 2. Get eslint to process `*.mjs` files. 3. Update the React and Flow versions specified in the config. 4. Lint the example directories.
1 parent a72e7cb commit 91c518a

File tree

78 files changed

+32
-190
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+32
-190
lines changed

.eslintrc.js

+12-17
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@
77
*
88
*/
99

10+
const path = require('path');
11+
1012
module.exports = {
1113
settings: {
1214
react: {
1315
pragma: 'React',
14-
version: '17.0',
15-
flowVersion: '0.214.0', // Flow version
16+
version: '18.0',
17+
flowVersion: '0.261.2', // Flow version
1618
},
1719
'ft-flow': {
1820
onlyFilesWithFlowAnnotation: true,
@@ -21,7 +23,7 @@ module.exports = {
2123
// babel parser to support ES6/7 features
2224
parser: 'hermes-eslint',
2325
extends: ['plugin:ft-flow/recommended', 'prettier'],
24-
plugins: ['ft-flow', 'react', 'header'],
26+
plugins: ['ft-flow', 'react', 'headers'],
2527
env: {
2628
browser: true,
2729
es6: true,
@@ -32,7 +34,7 @@ module.exports = {
3234
'build',
3335
'coverage',
3436
'dist',
35-
'examples',
37+
'flow-typed',
3638
'lib',
3739
'node_modules',
3840
'next-env.d.ts',
@@ -61,19 +63,12 @@ module.exports = {
6163
Partial: 'readonly',
6264
},
6365
rules: {
64-
'header/header': [
65-
2,
66-
'block',
67-
[
68-
'*',
69-
' * Copyright (c) Meta Platforms, Inc. and affiliates.',
70-
' *',
71-
' * This source code is licensed under the MIT license found in the',
72-
' * LICENSE file in the root directory of this source tree.',
73-
' *',
74-
{ pattern: '(.*)?', template: ' *' },
75-
' ',
76-
],
66+
'headers/header-format': [
67+
'error',
68+
{
69+
source: 'file',
70+
path: path.join(__dirname, './tools/eslint/copyright-header.txt'),
71+
},
7772
],
7873
camelcase: 0,
7974
'constructor-super': 2,

examples/example-cli/source/app/Counter.tsx

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
6-
*
7-
*
86
*/
97

108
'use client';

examples/example-esbuild/scripts/build.mjs

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
6-
*
7-
*
86
*/
97

108
import path from 'path';

examples/example-rollup/rollup.config.mjs

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
6-
*
7-
*
86
*/
97

108
import stylexPlugin from '@stylexjs/rollup-plugin';

package-lock.json

+10-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"prettier": "prettier --write \"**/*.js\" \"**/*.ts\"",
1212
"prettier:report": "prettier --check \"**/*.js\"",
1313
"lint": "npm run lint:report -- --fix",
14-
"lint:report": "eslint packages tools",
14+
"lint:report": "eslint . --ext .js,.jsx,.mjs",
1515
"release": "tools/npm/release.js",
1616
"test:packages": "npm run test --workspaces --if-present",
1717
"test": "npm run build && npm run flow && npm run test:packages && npm run prettier:report && npm run lint:report"
@@ -30,6 +30,7 @@
3030
"eslint": "8.57.1",
3131
"eslint-config-prettier": "^9.1.0",
3232
"eslint-plugin-ft-flow": "^3.0.11",
33+
"eslint-plugin-headers": "~1.2.1",
3334
"eslint-plugin-react": "^7.37.1",
3435
"flow-bin": "^0.261.2",
3536
"hermes-eslint": "^0.26.0",

packages/babel-plugin/__tests__/evaluation/stylex-evaluation-test.js

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
6-
*
7-
*
86
*/
97

108
'use strict';

packages/babel-plugin/__tests__/evaluation/stylex-fn-obj-evaluation-test.js

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
6-
*
7-
*
86
*/
97

108
'use strict';

packages/babel-plugin/__tests__/evaluation/stylex-import-evaluation-test.js

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
6-
*
7-
*
86
*/
97

108
'use strict';

packages/babel-plugin/__tests__/stylex-metadata-test.js

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
6-
*
7-
*
86
*/
97

108
'use strict';

packages/babel-plugin/__tests__/stylex-transform-call-test.js

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
6-
*
7-
*
86
*/
97

108
'use strict';

packages/babel-plugin/__tests__/stylex-transform-create-test.js

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
6-
*
7-
*
86
*/
97

108
'use strict';

packages/babel-plugin/__tests__/stylex-transform-create-theme-test.js

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
6-
*
7-
*
86
*/
97

108
'use strict';

packages/babel-plugin/__tests__/stylex-transform-define-vars-test.js

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
6-
*
7-
*
86
*/
97

108
'use strict';

packages/babel-plugin/__tests__/stylex-transform-import-test.js

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
6-
*
7-
*
86
*/
97

108
'use strict';

packages/babel-plugin/__tests__/stylex-transform-keyframes-test.js

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
6-
*
7-
*
86
*/
97

108
'use strict';

packages/babel-plugin/__tests__/stylex-transform-legacy-shorthands-test.js

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
6-
*
7-
*
86
*/
97

108
'use strict';

packages/babel-plugin/__tests__/stylex-transform-logical-properties-test.js

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
6-
*
7-
*
86
*/
97

108
'use strict';

packages/babel-plugin/__tests__/stylex-transform-logical-values-test.js

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
6-
*
7-
*
86
*/
97

108
'use strict';

packages/babel-plugin/__tests__/stylex-transform-polyfills-test.js

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
6-
*
7-
*
86
*/
97

108
'use strict';

packages/babel-plugin/__tests__/stylex-transform-pre-plugin-test.js

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
6-
*
7-
*
86
*/
97

108
'use strict';

packages/babel-plugin/__tests__/stylex-transform-stylex-attrs-test.js

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
6-
*
7-
*
86
*/
97

108
'use strict';

packages/babel-plugin/__tests__/stylex-transform-stylex-props-test.js

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
6-
*
7-
*
86
*/
97

108
'use strict';

packages/babel-plugin/__tests__/stylex-transform-value-normalize-test.js

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
6-
*
7-
*
86
*/
97

108
'use strict';

packages/babel-plugin/__tests__/stylex-transform-variable-removal-test.js

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
6-
*
7-
*
86
*/
97

108
'use strict';

packages/babel-plugin/rollup.config.mjs

-3
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
6-
*
7-
*
86
*/
9-
107
import { nodeResolve } from '@rollup/plugin-node-resolve';
118
import commonjs from '@rollup/plugin-commonjs';
129
import json from '@rollup/plugin-json';

packages/benchmarks/size/compare.js

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
*
55
* This source code is licensed under the MIT license found in the
66
* LICENSE file in the root directory of this source tree.
7-
*
8-
*
97
*/
108

119
'use strict';

packages/benchmarks/size/fixture/index.js

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
6-
*
7-
*
86
*/
97

108
'use strict';

packages/benchmarks/size/fixture/lotsOfStyles.js

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
6-
*
7-
*
86
*/
97

108
/* eslint-disable */

packages/benchmarks/size/fixture/lotsOfStylesDynamic.js

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
6-
*
7-
*
86
*/
97

108
'use strict';

packages/benchmarks/size/run.js

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
*
55
* This source code is licensed under the MIT license found in the
66
* LICENSE file in the root directory of this source tree.
7-
*
8-
*
97
*/
108

119
'use strict';

packages/cli/__tests__/__mocks__/snapshot/components/button.js

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
6-
*
7-
*
86
*/
97

108
'use strict';

packages/cli/__tests__/__mocks__/snapshot/index.js

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
6-
*
7-
*
86
*/
97

108
'use strict';

packages/cli/__tests__/__mocks__/snapshot/pages/home.js

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
6-
*
7-
*
86
*/
97

108
'use strict';

0 commit comments

Comments
 (0)