-
Notifications
You must be signed in to change notification settings - Fork 497
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
Update ESLint and related plugins #1250
Conversation
Signed-off-by: Máté Szabó <[email protected]>
Signed-off-by: Máté Szabó <[email protected]>
a58fb7a
to
62245fe
Compare
Looks like Codecov runs Envoy. |
Codecov ReportPatch coverage has no change and project coverage change:
Additional details and impacted files@@ Coverage Diff @@
## main #1250 +/- ##
==========================================
- Coverage 95.38% 0 -95.39%
==========================================
Files 244 0 -244
Lines 7750 0 -7750
Branches 2017 0 -2017
==========================================
- Hits 7392 0 -7392
+ Misses 358 0 -358 see 244 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
@@ -25,25 +25,59 @@ module.exports = { | |||
}, | |||
}, | |||
}, | |||
extends: ['react-app', 'airbnb', 'prettier', 'prettier/react'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the story with 'prettier/react'?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The disparate configs supplied by eslint-config-prettier
were merged in v8 of that config, so we no longer need to specify them separately.
## Which problem is this PR solving? - Contributes towards jaegertracing#1199 ## Short description of the changes Bump ESLint to v7 and update related plugins. Suppress newly introduced or updated rules in a separate config section so that they can be evaluated and enabled later, except for stylistic rules that do not match the existing code style, or where the impact was limited enough to be trivially fixable or suppressable. `@typescript-eslint/eslint-plugin` now validates that input files are indeed part of the tsconfig file configured in ESLint options. Since the plugin doesn't understand project references, this requires a small change to [specify the package-specific tsconfig files for linting](https://typescript-eslint.io/linting/typed-linting/monorepos#one-tsconfigjson-per-package-and-an-optional-one-in-the-root) instead. Also remove `eslint-config-react-app` (the CRA ESLint config), as it doesn't actually seem to bring much to the table—the Airbnb config seems to overwrite much of the same rules that this config is trying to provide. I ran `eslint --print-config packages/jaeger-ui/src/components/App/index.jsx` and `eslint --print-config packages/jaeger-ui/src/components/App/Page.tsx` to dump the active rules for JS and TS files with and without the config loaded, then diffed them: ```diff --- ts-active-rules-cra.json 2023-03-10 21:24:37 +++ ts-active-rules-no-cra.json 2023-03-10 21:25:38 @@ -4,8 +4,7 @@ "jest": true, "jasmine": true, "es6": true, - "node": true, - "commonjs": true + "node": true }, "globals": { "__REACT_APP_GA_DEBUG__": false, @@ -27,7 +26,6 @@ "sourceType": "module" }, "plugins": [ - "flowtype", "import", "react", "jsx-a11y", @@ -2850,15 +2848,6 @@ ], "yoda": [ "error" - ], - "flowtype/define-flow-type": [ - "warn" - ], - "flowtype/require-valid-file-annotation": [ - "warn" - ], - "flowtype/use-flow-type": [ - "warn" ] }, "settings": { ``` ```diff --- js-active-rules-cra.json 2023-03-10 21:24:48 +++ js-active-rules-no-cra.json 2023-03-10 21:25:30 @@ -4,15 +4,14 @@ "jest": true, "jasmine": true, "es6": true, - "node": true, - "commonjs": true + "node": true }, "globals": { "__REACT_APP_GA_DEBUG__": false, "__REACT_APP_VSN_STATE__": false, "__APP_ENVIRONMENT__": false }, - "parser": "/REDACTED/jaeger-ui/node_modules/babel-eslint/lib/index.js", + "parser": null, "parserOptions": { "ecmaFeatures": { "jsx": true, @@ -23,7 +22,6 @@ "sourceType": "module" }, "plugins": [ - "flowtype", "import", "react", "jsx-a11y" @@ -2830,15 +2828,6 @@ ], "yoda": [ "error" - ], - "flowtype/define-flow-type": [ - "warn" - ], - "flowtype/require-valid-file-annotation": [ - "warn" - ], - "flowtype/use-flow-type": [ - "warn" ] }, "settings": { ``` So the only things added by the config is Flow support (which the project doesn't use), and extended ES6 support via `babel-eslint` (which is abandoned in favor of `@babel/eslint-parser`). As such, remove `eslint-plugin-flowtype` as well and replace `babel-eslint` with a simple `@babel/eslint-parser` config. --------- Signed-off-by: Máté Szabó <[email protected]> Co-authored-by: Yuri Shkuro <[email protected]>
Which problem is this PR solving?
Short description of the changes
Bump ESLint to v7 and update related plugins. Suppress newly introduced or updated rules in a separate config section so that they can be evaluated and enabled later, except for stylistic rules that do not match the existing code style, or where the impact was limited enough to be trivially fixable or suppressable.
@typescript-eslint/eslint-plugin
now validates that input files are indeed part of the tsconfig file configured in ESLint options. Since the plugin doesn't understand project references, this requires a small change to specify the package-specific tsconfig files for linting instead.Also remove
eslint-config-react-app
(the CRA ESLint config), as it doesn't actually seem to bring much to the table—the Airbnb config seems to overwrite much of the same rules that this config is trying to provide. I raneslint --print-config packages/jaeger-ui/src/components/App/index.jsx
andeslint --print-config packages/jaeger-ui/src/components/App/Page.tsx
to dump the active rules for JS and TS files with and without the config loaded, then diffed them:So the only things added by the config is Flow support (which the project doesn't use), and extended ES6 support via
babel-eslint
(which is abandoned in favor of@babel/eslint-parser
). As such, removeeslint-plugin-flowtype
as well and replacebabel-eslint
with a simple@babel/eslint-parser
config.