Closed pom421 closed 3 years ago
Hi @pom421, thanks for the issue!
It could be that your shell is expanding patterns, so ESLint actually gets a list of all .js
files in all sub dirs, and then resolves configs for each of them starting from the subdir where the file is located.
Can you try with quotes, e.g.: npx eslint "*.js" "*/**/*.js"
Can you try with quotes, e.g.:
npx eslint "*.js" "*/**/*.js"
You're right! :) With quotes like that, it works :
npx eslint "**/*.js"
Thanks @mdjermanovic !
Tell us about your environment
I am on Mac OS. Node version: v12.19.0 npm version: v6.14.8 ESLint : 7.14.0 (with the CLI, it returns vundefined (Currently used) by the --env-info helper ??)
What parser (default,
@babel/eslint-parser
,@typescript-eslint/parser
, etc.) are you using?babel-eslint : 10.1.0
Please show your full configuration:
Configuration
```js package.json { "name": "conferences", "version": "1.0.0", "description": "Conférences audio et vidéo pour les fonctionnaires de l'Etat", "main": "index.js", "directories": { "test": "test" }, "scripts": { "checkHTML": "site-validator --verbose --url", "checkHTMLLocal": "site-validator --verbose --local --url http://localhost:8080", "dev": "nodemon index.js", "lint": "eslint *.js */**/*.js", "fix": "eslint *.js lib/** controllers/** --fix", "migrate": "knex migrate:latest", "makeMigration": "knex migrate:make", "rollback": "knex migrate:rollback", "listMigrations": "knex migrate:list", "start": "node index.js", "test": "mocha --recursive --exit --require ./test/setup.js" }, "repository": { "type": "git", "url": "git+https://github.com/betagouv/conferences.git" }, "author": "", "license": "MIT", "bugs": { "url": "https://github.com/betagouv/conferences/issues" }, "homepage": "https://github.com/betagouv/conferences#readme", "dependencies": { "@gouvfr/design-system": "^0.2.0", "chart.js": "^2.9.4", "connect-flash": "^0.1.1", "connect-session-knex": "^2.0.0", "cron": "^1.8.2", "dotenv": "^8.2.0", "ejs": "^3.1.5", "express": "^4.17.1", "express-session": "^1.17.1", "intl": "^1.2.5", "knex": "^0.21.6", "nodemailer": "^6.4.14", "ovh": "^2.0.3", "pg": "^8.4.2" }, "devDependencies": { "chai": "^4.2.0", "chai-http": "^4.3.0", "mocha": "^8.2.0", "nodemon": "^2.0.5", "eslint": "^7.14.0", "eslint-config-node": "^4.1.0", "eslint-config-prettier": "^6.15.0", "eslint-plugin-node": "^11.1.0", "eslint-plugin-prettier": "^3.1.4", "prettier": "^2.2.0", "sinon": "^9.2.0", "site-validator-cli": "^1.3.5" } } .eslintrc.json { "extends": ["prettier", "plugin:node/recommended"], "plugins": ["prettier"], "rules": { "prettier/prettier": "error", "no-unused-vars": "warn", "no-console": "off", "func-names": "off", "no-process-exit": "off", "object-shorthand": "off" }, "ignorePatterns": ["node_modules/", "dist", ".next/"] } .eslintignore controllers/** lib/** node_modules/* **/.eslintrc node_modules/**/.eslintrc node_modules/**/.eslintrc.js node_modules/**/.eslintrc.json ```What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
What did you expect to happen?
To see the ESLint report.
What actually happened? Please include the actual, raw output from ESLint.
An error is throwed.
=> obviously, the node_modules is not ignored. It should be, because of the rules of ESLint. I even try to add it in .eslintignore (see above) but with no effect. It seems that the files like .eslintrc in node_modules (and event package.json with ESLint config in it) are detected and analysed.
It is really problematic when your project doesn't have a src directory, which prevent to have .js files at the same level than the node_modules directory.
Are you willing to submit a pull request to fix this bug?
No.