Created by: fson
tl;dr The eslintConfig
setting is used to make editor plugins such as linter
use our ESLint configuration, but at the moment this requires additional packages and configuration to work, and we should not create the project with broken configuration. The configuration can still be added manually.
At the moment, when you create an app, the eslintConfig
setting gets added to package.json. If you have an ESLint package (e.g. linter with linter-eslint) installed in your editor, you'll get a big error:
This error is shown every time you save a file, so you're forced to figure out what to do, even if you were just starting out and didn't want to configure the integrations yet.
After a little digging you'll find the instructions for installing the ESLint integration. We instruct the user to install ESLint and all the ESLint plugins globally and to configure the editor plugin to use the global ESLint. This is less than ideal for a few reasons:
- The user now needs to track the ESLint plugins dependencies used by CRA and their versions manually and keep their global packages up-to-date.
- You can't have different projects with different ESLint or ESLint plugin versions. Opening a file from a (non-CRA) project using an incompatible version now creates an error because your editor tries to use the globally installed ESLint and plugins:
I've also seen people trying to edit the eslintConfig
in package.json in order to use their own ESLint configuration, which doesn't work, which also makes having the configuration there misleading.
As we mention in the readme, having to rely on global ESlint will be fixed when ESlint is going to add support for having plugins as dependencies in packages like react-scripts, so we can enable the integration by default at that point. But until this has been fixed, it's better to not add this configuration by default. People can still find the instructions and add it manually when they want it and they're ready to do the plugin setup, but we should not create a configuration that doesn't work out of the box.