To configure ESLint for a specific file or folder, you can use the overrides field in your .eslintrc.json file. Hereβs an example:
{
"rules": {
"quotes": [2, "double"]
},
"overrides": [
{
"files": ["src/**/*.js"],
"rules": {
"quotes": [2, "single"]
}
}
]
}
In this example, the quotes rule is set to double for all files, but itβs overridden to single for all JavaScript files in the src directory.
You can also use the .eslintignore file or the ignorePatterns option in your .eslintrc.json file to tell ESLint to ignore specific files and directories.
Hereβs an example of how to use ignorePatterns:
{
"ignorePatterns": ["gulpfile.js", "gulp/**/*", "webpack.config.js"]
}
Top comments (2)
It's simple and good.
Thanks!