-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
fix(eslint-config): set parser, don't fail the build on minimal eslint-loader errors #29130
Conversation
I am experiencing this as well as long with |
what is the progress of this? |
baseConfig: { | ||
parser: require.resolve(`babel-eslint`), |
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.
Shouldn't we add it to the package.json?
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.
we already have it -
gatsby/packages/gatsby/package.json
Line 34 in 7b6454b
"babel-eslint": "^10.1.0", |
baseConfig: { | ||
parser: require.resolve(`babel-eslint`), | ||
parserOptions: { |
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.
for ecmaVersion I set to 2020. any reason why its 2018 here?
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
I don't think it fixes issue #29133 The problem is that we add our required config here: gatsby/packages/gatsby/src/utils/webpack.config.js Lines 737 to 743 in 7b6454b
But after #29109 this required config has So to recap - this PR indeed fixes the problem with parser but not the As for me, it sounds like the only good way to fix this is to have two eslint loaders - one for normal eslint setup - and another one - for specific fast-refresh rules. That separate loader can have any config, e.g. we can safely disable eslintrc and inline comments for it. |
Closing this in favour of #29317 which is more robust |
Description
#29109 was not sufficent. This also specify
parser
(by default it uses https://github.com/eslint/espree - but it seems like version we/eslint (also version of eslint we use) doesn't support optional chaining?.
- used version isespree@^6
, and according to https://github.com/eslint/espree/blob/master/CHANGELOG.md support was added inespree@^7
).Other part is
emitWarning: true
, which should prevent errors coming fromeslint-loader
from blocking users - per https://github.com/webpack-contrib/eslint-loader#noemitonerrorspluginCurrent:
With
emitWarning: true
- so it still is confusing, and we need to fix those, but at least it doesn't prevent webpack from compiling (or rather emitting I guess):It prooved to be whack'a'mole with this minimal eslint config for fast-refresh rules, so there are few things to consider here:
Related Issues
#29105 (comment)
Fixes #29133