I have a folder with this structure:
root
|- folderA
|- folderB
|- folderC
I want to apply two sets of rules to eslint to each folderA and folderB and completely skip folderC. so I have this:
export default defineConfig([
{
files: ["folderA/**/*.{vue,ts}", "folderB/**/*.{vue,ts}"],
ignore: ["folderC"],
},
eslintPluginPrettierRecommended,
{
files: ["folderA/**/*.{vue,ts}"],
settings: {
"vue/setup-compiler-macros": true,
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"],
},
},
plugins: {
vue: fixupPluginRules(vuePlugin),
"@typescript-eslint": fixupPluginRules(typescriptEslint),
},
languageOptions: {
globals: {
...globals.browser,
},
parser: vueParser,
parserOptions: {
ecmaVersion: "latest",
extraFileExtensions: [".vue"],
parser: tsParser,
sourceType: "module",
ecmaFeatures: {
jsx: true,
},
},
},
extends: ["plugin:prettier/recommended"],
rules: {
"prettier/prettier": [
"error",
{
tabWidth: 2,
},
],
eqeqeq: "error",
},
},
{
files: ["folderB/**/*.{vue,ts,tsx}"],
extends: ["plugin:prettier/recommended"],
settings: {
"vue/setup-compiler-macros": true,
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"],
},
},
plugins: {
vue: fixupPluginRules(vuePlugin),
"@typescript-eslint": fixupPluginRules(typescriptEslint),
},
languageOptions: {
globals: {
...globals.browser,
},
parser: vueParser,
parserOptions: {
ecmaVersion: "latest",
extraFileExtensions: [".vue"],
parser: tsParser,
sourceType: "module",
ecmaFeatures: {
jsx: true,
},
},
},
rules: {
"prettier/prettier": [
"error",
{
tabWidth: 4,
},
],
},
},
]);
However when I execute the above, things in folderC still get executed. My theory is eslintPluginPrettierRecommended is not bound with the files and ignore defined right before it.
The question is how can I achieve my goal to have different rules for folderA and folderB while completely ignore folderC?