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

Lines changed: 12 additions & 17 deletions
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

Lines changed: 0 additions & 2 deletions
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

Lines changed: 0 additions & 2 deletions
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

Lines changed: 0 additions & 2 deletions
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

Lines changed: 10 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
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

Lines changed: 0 additions & 2 deletions
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

Lines changed: 0 additions & 2 deletions
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

Lines changed: 0 additions & 2 deletions
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

Lines changed: 0 additions & 2 deletions
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)