Move ESLint configuration to an ESLint plugin #993
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Work in progress, not ready for merging before the issues have been fixed and we've decided if we want this change.
Not being able to depend on ESLint plugins in our shareable config has been a long-standing issue (#173, #649, #866).
Adding support for this in ESLint is being discussed in eslint/eslint#3458. In eslint/eslint#3458 (comment), @nzakas suggested that the problem of bundling plugins as dependencies could be solved using an ESLint plugin instead of a shareable config. This PR is a first attempt to implement Create React App ESLint configuration as a plugin.
Breaking changes if we implement this change (for projects using
eslint-config-react-app
directly, e.g. ejected projects):eslint-config-react-app
will have to switch the dependency toeslint-plugin-react-app
and replace"extends": "react-app" with
"extends": "plugin:react-app/recommended"`eslint-config-react-app
should removeimport
,flowtype
,jsx-a11y
andreact
plugin dependencies because we will bundle them in our plugineslint-config-react-app
that have extended the configuration will have to prefix plugin specific rules, e.g."react/no-is-mounted": "error"
becomes"react-app/react/no-is-mounted": "error"
Remaining issues:
Error: Failed to load plugin react-app: Cannot find module 'eslint-plugin-react-app' Referenced from: /Users/ville/Projects/create-react-app/my-es-app/node_modules/react-scripts/.eslintrc
, so I'm not sure if ESLint will be able to resolve the plugin correctly (especially if it's been bundled insidereact-scripts
).