Created by: fson
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 (closed), #649, #866 (closed)).
Adding support for this in ESLint is being discussed in eslint/eslint#3458. In https://github.com/eslint/eslint/issues/3458#issuecomment-257161846, @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):
- users of
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"` - users of
eslint-config-react-app
should removeimport
,flowtype
,jsx-a11y
andreact
plugin dependencies because we will bundle them in our plugin - users of
eslint-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:
- Currently getting an error when trying to start the app:
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
). - Editor integrations need to be tested and documentation changed.