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!