It looks like you have an ESLint configuration file in the Project folder, which is up the directory structure of your actual project folder.
When you run ESLint in a folder, ESLint first looks for configuration files in that folder. Then, it looks in the parent folder - if there is a configuration file there, it merges it with the initial configuration file. ESLint keeps going up the directory structure and merges each configuration file it finds, until it reaches your root directory.
If you want to limit ESLint to the configuration file in your project, add this in the eslintrc.js or eslintrc.json file:
{
"root": true
}
This will make ESLint stop looking for configuration files beyond this one.
Whichever file you add the root key to, delete the other file. If there is more than one configuration file in a folder, ESLint will use only one (between eslintrc.js and eslintrc.json, it will use the former, because each format has a priority order).
You can find more information about the priority order here and how ESLint looks for configuration files here.
Answer from Akasha on Stack OverflowVideos
» npm install eslint-plugin-json
I want to use eslint (v 9.1.1) for a react project. From following the documentation, I did the following:
npm init eslint/config
Following that it says the following: https://eslint.org/docs/v8.x/use/getting-started#configuration
After running
npm init eslint/config, you’ll have an .eslintrc.{js,yml,json} file in your directory.
Yet that file doesn't exist in my directory. Any idea why this file wasn't included?
I'm trying to replace all require with import statements, per my ESLint rules, and changing all extensions from .js to .ts where possible. I changed .eslintrc.js to .eslintrc.ts and now my lint command is failing, stating "ESLint couldn't find a configuration file." I've set up a monorepo using Turborepo. Any insight would be appreciated.
.eslintrc.ts
export default {
env: {
node: true,
},
parser: '@typescript-eslint/parser',
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
],
plugins: ['@typescript-eslint'],
parserOptions: {
sourceType: 'module',
ecmaVersion: 'latest',
},
rules: {
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-var-requires': 'off',
'no-console': 2,
},
};.eslintrc.cjs
import 'config/.eslintrc';
Any advice would be appreciated!