You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been wondering about this for a while why, and finally figured out what's going on. We explicitly allow no-console (i.e. we want to allow console logging). Since updating our ESLint config with 'no-console': 'off', everything has worked fine when we run ESLint directly. However, when we npm start and ESLint is run by webpack, it was still spewing console logging warnings all over the place. This was baffling.
Then create a file named .eslintrc.json with following contents in the root folder of your project: { "extends": "react-app" }
That's it! You can override the settings from eslint-config-react-app by editing the .eslintrc.json file. Learn more about configuring ESLint on the ESLint website.
I looked, and we didn't have an .eslintrc.**json** file, we had an .eslintrc.**js** file. This is perfectly legal for ESLint. This page says:
Configuration Files - use a JavaScript, JSON, or YAML file to specify configuration information for an entire directory and all of its subdirectories. This can be in the form of a .eslintrc.* file or an eslintConfig field in a package.json file, both of which ESLint will look for and read automatically, or you can specify a configuration file on the command line.
ESLint supports configuration files in several formats:
JavaScript - use .eslintrc.js and export an object containing your configuration.
JavaScript (ESM) - use .eslintrc.cjs when running ESLint in JavaScript packages that specify "type":"module" in their package.json. Note that ESLint does not support ESM configuration at this time.
YAML - use .eslintrc.yaml or .eslintrc.yml to define the configuration structure.
JSON - use .eslintrc.json to define the configuration structure. ESLint’s JSON files also allow JavaScript-style comments.
package.json - create an eslintConfig property in your package.json file and define your configuration there.
And .eslintrc.json actually is the second-lowest priority among them, coming only before package.json.
When I reformatted our .eslintrc.js file into an equivalent .eslintrc.json file, the issue went away, which strongly suggests that eslint-config-react-app is neither delegating resolution nor replicating the rules used by ESLint itself for finding configurations.
Describe the solution you'd like
I would like for these scripts to either delegate the resolution of config information to ESLint itself, or if that's not possible (as I suspect it's not, if eslint-config-react-app wants to provide configuration of its own) I would like these scripts to "hunt" for config by replicating the rules used by ESLint itself for finding configurations.
Describe alternatives you've considered
I reformatted our .eslintrc.js file into an equivalent .eslintrc.json file, and the issue went away, so we could bend to you, and probably will, until this issue is resolved. It's annoying though because in the .js format, we can have things like comments, whereas we cannot in .json. This is useful for temporarily commenting out a rule, or for leaving an explanation of why we set a rule the way we did.
Additional context
I don't think I have anything more to add.
The text was updated successfully, but these errors were encountered:
Is your proposal related to a problem?
I've been wondering about this for a while why, and finally figured out what's going on. We explicitly allow
no-console
(i.e. we want to allow console logging). Since updating our ESLint config with'no-console': 'off',
everything has worked fine when we run ESLint directly. However, when wenpm start
and ESLint is run by webpack, it was still spewing console logging warnings all over the place. This was baffling.Then I looked at this page: https://www.npmjs.com/package/eslint-config-react-app and it says, in part (emphasis mine):
I looked, and we didn't have an
.eslintrc.**json**
file, we had an.eslintrc.**js**
file. This is perfectly legal for ESLint. This page says:and then the linked Configuration File Formats list says:
And
.eslintrc.json
actually is the second-lowest priority among them, coming only beforepackage.json
.When I reformatted our
.eslintrc.js
file into an equivalent.eslintrc.json
file, the issue went away, which strongly suggests that eslint-config-react-app is neither delegating resolution nor replicating the rules used by ESLint itself for finding configurations.Describe the solution you'd like
I would like for these scripts to either delegate the resolution of config information to ESLint itself, or if that's not possible (as I suspect it's not, if eslint-config-react-app wants to provide configuration of its own) I would like these scripts to "hunt" for config by replicating the rules used by ESLint itself for finding configurations.
Describe alternatives you've considered
I reformatted our
.eslintrc.js
file into an equivalent.eslintrc.json
file, and the issue went away, so we could bend to you, and probably will, until this issue is resolved. It's annoying though because in the.js
format, we can have things like comments, whereas we cannot in.json
. This is useful for temporarily commenting out a rule, or for leaving an explanation of why we set a rule the way we did.Additional context
I don't think I have anything more to add.
The text was updated successfully, but these errors were encountered: