-
-
Notifications
You must be signed in to change notification settings - Fork 26.8k
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
wrong eslint rules when extending from plugins (because 'react-scripts start' uses own, outdated version of plugin) #9083
wrong eslint rules when extending from plugins (because 'react-scripts start' uses own, outdated version of plugin) #9083
Comments
This proposal could also fix in future issues of outdated eslint plugins like
Alternative: Again only Also if there were an option in .env like |
I've got a similar case, except I've got errors and warnings reported by eslint (for example Edit: After deleting |
I am experiencing this issue myself. Running "npm run lint" does not show any warning or errors. |
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs. |
This issue has been automatically closed because it has not had any recent activity. If you have a question or comment, please open a new issue. |
Any news about?
|
We are also experience this issue. The lint errors when running "yarn start" are not the same as when running "yarn lint" (with a custom eslint config). Most developers are only seeing and fixing the yarn start errors which appear to be backed into create-react-app somewhere. |
I found a good solution!Fixed this problem with const { override, disableEsLint, useEslintRc } = require('customize-cra');
const path = require('path');
module.exports = override(
// choose between disable or pass eslintRc
disableEsLint(),
useEslintRc(path.resolve(__dirname, '.eslintrc.json')),
); |
It looks like this will be resolved in |
I ran into this issue while following the CRA instructions to use
deleting my lock file (package-lock.json) and then |
@InSuperposition Thanks for this! It helped me narrow down the issue, and while deleting our |
Describe the bug
I added to my CRA with the TypeScript template some ESLint settings, but
yarn start
complained about errors in rules, which were not part of my eslint settings and which weren't shown up, when runningeslint src/**/*.{ts,tsx}
After hours of searching I found the bug:
react-scripts has it's own, outdated version of @typescript-eslint/eslint-plugin (^2.10.0 instead of 3.0.1). That's why extending
plugin:@typescript-eslint/recommended
resulted in different rules whenyarn start
ranreact-scripts start
thaneslint src/**/*.{ts,tsx}
Steps to reproduce
... actually also the libraries
eslint-config-prettier
,eslint-plugin-prettier
,eslint-plugin-react
but doesn't matter to describe the issue here.In
.env
I addedI added
.eslintrc.js
(simplified for this issue)I removed this in package.json
And had these scripts in package.json
Result
yarn start
gave me warnings & errors for rules@typescript-eslint/explicit-function-return-type
,@typescript-eslint/no-use-before-define
yarn lint
gave me no wwarnings or errors for these rulesplugin:@typescript-eslint/recommended@3.0.1
but part ofplugin:@typescript-eslint/recommended@2.XX.X
Expected behavior
When I create my .eslintrc.* and install the eslint plugins I need, I expect that the version of my installed plugins are used, and not some older version of react-scripts' own dependencies.
Proposal
Change
react-sccripts/config/webpack.config.js
this block:ideas
.env
setting which defines thatresolvePluginsRelativeTo
will be set to root of appresolvePluginsRelativeTo
will always be set to app root, if isExtendingEslintConfig is true (.env
hasEXTEND_ESLINT
)dependencies (not so relevant)
I use yarn in v1.22.0
Before writing this issue, I deleted
yarn.lock
,node_modules
and re-installed.In my
package.json
wasIn
node_modules/react-scripts/package.json
wasIn
yarn.lock
In
node_modules/@typescript-eslint/eslint-plugin/package.json
In
node_modules/react-scripts/node_modules/@typescript-eslint/eslint-plugin/package.json
yarn --version v1.22.0
Environment (not so relevant)
The text was updated successfully, but these errors were encountered: