I can't seem to get eslint to correctly directories in my project.
Using eslint config inspector, I can see my ignores
look correct.
const globals = require("globals");
module.exports =[{
languageOptions: {
globals: {
...globals.commonjs,
...globals.node,
...globals.mocha,
},
ecmaVersion: 2022,
sourceType: "module",
},
rules: {
"no-const-assign": "warn"
},
ignores: ["media/mermaid.min.js"]
}];
Result:
The media
folder is in the root of the project and I am running commands while in the project root directory. In addition to trying a specific file as per the screenshot, I have tried the following patterns without success:
**/media/**
media/**
media/**/*.js
media/*
media
**/*.js
(as a test)I have also tried setting the eslint working directory via .vscode/settings.json
but that had no effect.
Using eslint -c eslint.config.js .
in the project root directory produces the same result as eslint .
. Both appear to detect the correct config file and corroborate the eslint config inspector.
node: v22.10.0
eslint: v9.13.0
It seems like the documentation for how to use the ignores
property is misleading. Try specifying it as a separate configuration:
module.exports =[
{
ignores: ["media/mermaid.min.js"]
},
{
languageOptions: {
globals: {
...globals.commonjs,
...globals.node,
...globals.mocha,
},
ecmaVersion: 2022,
sourceType: "module",
},
rules: {
"no-const-assign": "warn"
}
}];
See discussion.