Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve monorepo eslint config #957

Merged
merged 1 commit into from
Mar 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 12 additions & 17 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
*
*/

const path = require('path');

module.exports = {
settings: {
react: {
pragma: 'React',
version: '17.0',
flowVersion: '0.214.0', // Flow version
version: '18.0',
flowVersion: '0.261.2', // Flow version
},
'ft-flow': {
onlyFilesWithFlowAnnotation: true,
Expand All @@ -21,7 +23,7 @@ module.exports = {
// babel parser to support ES6/7 features
parser: 'hermes-eslint',
extends: ['plugin:ft-flow/recommended', 'prettier'],
plugins: ['ft-flow', 'react', 'header'],
plugins: ['ft-flow', 'react', 'headers'],
env: {
browser: true,
es6: true,
Expand All @@ -32,7 +34,7 @@ module.exports = {
'build',
'coverage',
'dist',
'examples',
'flow-typed',
'lib',
'node_modules',
'next-env.d.ts',
Expand Down Expand Up @@ -61,19 +63,12 @@ module.exports = {
Partial: 'readonly',
},
rules: {
'header/header': [
2,
'block',
[
'*',
' * Copyright (c) Meta Platforms, Inc. and affiliates.',
' *',
' * This source code is licensed under the MIT license found in the',
' * LICENSE file in the root directory of this source tree.',
' *',
{ pattern: '(.*)?', template: ' *' },
' ',
],
'headers/header-format': [
'error',
{
source: 'file',
path: path.join(__dirname, './tools/eslint/copyright-header.txt'),
},
],
camelcase: 0,
'constructor-super': 2,
Expand Down
2 changes: 0 additions & 2 deletions examples/example-cli/source/app/Counter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/

'use client';
Expand Down
2 changes: 0 additions & 2 deletions examples/example-esbuild/scripts/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/

import path from 'path';
Expand Down
2 changes: 0 additions & 2 deletions examples/example-rollup/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/

import stylexPlugin from '@stylexjs/rollup-plugin';
Expand Down
17 changes: 10 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"prettier": "prettier --write \"**/*.js\" \"**/*.ts\"",
"prettier:report": "prettier --check \"**/*.js\"",
"lint": "npm run lint:report -- --fix",
"lint:report": "eslint packages tools",
"lint:report": "eslint . --ext .js,.jsx,.mjs",
"release": "tools/npm/release.js",
"test:packages": "npm run test --workspaces --if-present",
"test": "npm run build && npm run flow && npm run test:packages && npm run prettier:report && npm run lint:report"
Expand All @@ -30,6 +30,7 @@
"eslint": "8.57.1",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-ft-flow": "^3.0.11",
"eslint-plugin-headers": "~1.2.1",
"eslint-plugin-react": "^7.37.1",
"flow-bin": "^0.261.2",
"hermes-eslint": "^0.26.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/

'use strict';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/

'use strict';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/

'use strict';
Expand Down
2 changes: 0 additions & 2 deletions packages/babel-plugin/__tests__/stylex-metadata-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/

'use strict';
Expand Down
2 changes: 0 additions & 2 deletions packages/babel-plugin/__tests__/stylex-transform-call-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/

'use strict';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/

'use strict';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/

'use strict';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/

'use strict';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/

'use strict';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/

'use strict';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/

'use strict';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/

'use strict';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/

'use strict';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/

'use strict';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/

'use strict';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/

'use strict';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/

'use strict';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/

'use strict';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/

'use strict';
Expand Down
3 changes: 0 additions & 3 deletions packages/babel-plugin/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/

import { nodeResolve } from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import json from '@rollup/plugin-json';
Expand Down
2 changes: 0 additions & 2 deletions packages/benchmarks/size/compare.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/

'use strict';
Expand Down
2 changes: 0 additions & 2 deletions packages/benchmarks/size/fixture/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/

'use strict';
Expand Down
2 changes: 0 additions & 2 deletions packages/benchmarks/size/fixture/lotsOfStyles.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/

/* eslint-disable */
Expand Down
2 changes: 0 additions & 2 deletions packages/benchmarks/size/fixture/lotsOfStylesDynamic.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/

'use strict';
Expand Down
2 changes: 0 additions & 2 deletions packages/benchmarks/size/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/

'use strict';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/

'use strict';
Expand Down
2 changes: 0 additions & 2 deletions packages/cli/__tests__/__mocks__/snapshot/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/

'use strict';
Expand Down
2 changes: 0 additions & 2 deletions packages/cli/__tests__/__mocks__/snapshot/pages/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/

'use strict';
Expand Down
Loading