Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

7.21.0 release not ignoring node_modules ? #14158

Closed
Techn1x opened this issue Mar 2, 2021 · 7 comments
Closed

7.21.0 release not ignoring node_modules ? #14158

Techn1x opened this issue Mar 2, 2021 · 7 comments
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly core Relates to ESLint's core APIs and features
Projects

Comments

@Techn1x
Copy link

Techn1x commented Mar 2, 2021

Node version: v14.15.5
npm version: v6.14.11
Local ESLint version: v7.21.0 (Currently used)
Global ESLint version: Not found
Operating System: Linux (ubuntu variant)

What parser (default, @babel/eslint-parser, @typescript-eslint/parser, etc.) are you using?
I think @babel/eslint-parser ?

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

Upgraded from eslint 7.20.0 to 7.21.0, then ran the command below;

yarn eslint .

What did you expect to happen?
No eslint errors when upgrading from eslint 7.20.0 to 7.21.0

What actually happened? Please copy-paste the actual, raw output from ESLint.
Eslint errors in node_modules (ignore the warnings, tonnes of those in the app)

$ yarn eslint .
yarn run v1.22.10
$ /home/username/my-app/node_modules/.bin/eslint .

/home/username/my-app/node_modules/.bin/sha.js
   3:1   error  Unexpected var, use let or const instead                                       no-var
   3:1   error  Expected 1 empty line after require statement not followed by another require  import/newline-after-import
   4:1   error  Unexpected var, use let or const instead                                       no-var
   7:3   error  Unexpected var, use let or const instead                                       no-var
   8:3   error  Unexpected var, use let or const instead                                       no-var
  35:5   error  All 'var' declarations must be at the top of the function scope                vars-on-top
  35:5   error  Unexpected var, use let or const instead                                       no-var
  36:5   error  All 'var' declarations must be at the top of the function scope                vars-on-top
  36:5   error  Unexpected var, use let or const instead                                       no-var
  37:21  error  Unexpected require()                                                           global-require

✖ 1297 problems (10 errors, 1287 warnings)
  7 errors and 227 warnings potentially fixable with the `--fix` option.

error Command failed with exit code 1.

Steps to reproduce this issue:

  1. Have a yarn-based application (I say yarn, but I am not sure if that has anything to do with it)
  2. Upgrade to 7.21.0
  3. Run yarn eslint . in the application directory

These errors are solved by either;

Are you willing to submit a pull request to fix this bug?

@Techn1x Techn1x added bug ESLint is working incorrectly triage An ESLint team member will look at this issue soon labels Mar 2, 2021
@mdjermanovic mdjermanovic added core Relates to ESLint's core APIs and features and removed triage An ESLint team member will look at this issue soon labels Mar 2, 2021
@mdjermanovic mdjermanovic added this to Needs Triage in Triage via automation Mar 2, 2021
@mdjermanovic mdjermanovic moved this from Needs Triage to Evaluating in Triage Mar 2, 2021
@mdjermanovic
Copy link
Member

Hi @Techn1x, thanks for the issue!

I think the only change in 7.21.0 that could be related to this problem is to not ignore symbolic links (#14126), Do you have any symbolic links in your project?

Can you please run yarn eslint . --debug and share the output?

@mdjermanovic
Copy link
Member

The default pattern is /**/node_modules/*, we should fix the documentation to be more specific.

@Techn1x
Copy link
Author

Techn1x commented Mar 2, 2021

Thanks for the quick follow up.

Adding /**/node_modules/* to my eslint ignore file also stops the errors from appearing.

It looks like the .bin folder (a yarn thing, I think) is full of symlimks

$ ls-la /home/username/my-app/node_modules/.bin
drwxrwxr-x    2 username username  4096 Mar  2 13:12 .
drwxrwxr-x 1575 username username 53248 Mar  2 13:12 ..
lrwxrwxrwx    1 username username    18 Mar  2 13:12 acorn -> ../acorn/bin/acorn
lrwxrwxrwx    1 username username    26 Mar  2 13:12 ansi-html -> ../ansi-html/bin/ansi-html
lrwxrwxrwx    1 username username    32 Mar  2 13:12 ansi-to-html -> ../ansi-to-html/bin/ansi-to-html
lrwxrwxrwx    1 username username    19 Mar  2 13:12 atob -> ../atob/bin/atob.js
...
lrwxrwxrwx    1 username username    16 Mar  2 13:12 sha.js -> ../sha.js/bin.js
...
(and so on)

The debug output is quite large, I'll try to just share the relevant parts of it if thats OK

$ yarn eslint . --debug
yarn run v1.22.10
$ /home/username/my-app/node_modules/.bin/eslint . --debug
2021-03-02T03:16:51.805Z eslint:cli CLI args: [ '.', '--debug' ]
2021-03-02T03:16:51.806Z eslint:cli Running on files
2021-03-02T03:16:51.812Z eslintrc:config-array-factory Loading .eslintignore file: /home/username/my-app/.eslintignore
2021-03-02T03:16:51.813Z eslintrc:ignore-pattern Create with: [ IgnorePattern { patterns: [ '/**/node_modules/*' ], basePath: '/home/username/my-app', loose: false } ]
2021-03-02T03:16:51.814Z eslintrc:ignore-pattern   processed: { basePath: '/home/username/my-app', patterns: [ '/**/node_modules/*' ] }
2021-03-02T03:16:51.814Z eslintrc:ignore-pattern Create with: [ IgnorePattern { patterns: [ '/**/node_modules/*' ], basePath: '/home/username/my-app', loose: false } ]
2021-03-02T03:16:51.814Z eslintrc:ignore-pattern   processed: { basePath: '/home/username/my-app', patterns: [ '/**/node_modules/*' ] }
2021-03-02T03:16:51.814Z eslint:file-enumerator Start to iterate files: [ '.' ]
2021-03-02T03:16:51.814Z eslint:file-enumerator Directory: /home/username/my-app
2021-03-02T03:16:51.815Z eslint:file-enumerator Enter the directory: /home/username/my-app
2021-03-02T03:16:51.815Z eslintrc:cascading-config-array-factory Load config files for /home/username/my-app.
2021-03-02T03:16:51.815Z eslintrc:cascading-config-array-factory No cache found: /home/username/my-app.
2021-03-02T03:16:51.815Z eslintrc:config-array-factory Loading JS config file: /home/username/my-app/.eslintrc.js
2021-03-02T03:16:51.816Z eslintrc:config-array-factory Config file found: /home/username/my-app/.eslintrc.js
...
...
2021-03-02T03:17:05.832Z eslintrc:ignore-pattern Check {
  filePath: '/home/username/my-app/node_modules/',
  dot: false,
  relativePath: 'node_modules/',
  result: false
}
2021-03-02T03:17:05.832Z eslint:file-enumerator Enter the directory: /home/username/my-app/node_modules
2021-03-02T03:17:05.833Z eslintrc:cascading-config-array-factory Load config files for /home/username/my-app/node_modules.
2021-03-02T03:17:05.833Z eslintrc:cascading-config-array-factory No cache found: /home/username/my-app/node_modules.
2021-03-02T03:17:05.833Z eslintrc:config-array-factory Config file not found on /home/username/my-app/node_modules
2021-03-02T03:17:05.833Z eslintrc:cascading-config-array-factory Cache hit: /home/username/my-app.
2021-03-02T03:17:05.833Z eslintrc:ignore-pattern Check {
  filePath: '/home/username/my-app/node_modules/.bin/',
  dot: false,
  relativePath: 'node_modules/.bin/',
  result: false
}
2021-03-02T03:17:05.833Z eslint:file-enumerator Enter the directory: /home/username/my-app/node_modules/.bin
2021-03-02T03:17:05.833Z eslintrc:cascading-config-array-factory Load config files for /home/username/my-app/node_modules/.bin.
2021-03-02T03:17:05.833Z eslintrc:cascading-config-array-factory No cache found: /home/username/my-app/node_modules/.bin.
2021-03-02T03:17:05.833Z eslintrc:config-array-factory Config file not found on /home/username/my-app/node_modules/.bin
2021-03-02T03:17:05.833Z eslintrc:cascading-config-array-factory Cache hit: /home/username/my-app/node_modules.
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: acorn
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: ansi-html
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: ansi-to-html
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: atob
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: autoprefixer
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: babylon
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: browserslist
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: cake
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: can-symlink
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: caper-build
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: cdl
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: cleancss
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: coffee
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: css-blank-pseudo
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: css-has-pseudo
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: css-prefers-color-scheme
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: cssesc
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: detective
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: ember
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: ember-source-channel-url
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: ember-template-lint
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: ember-template-recast
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: errno
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: escodegen
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: esgenerate
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: eslint
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: eslint-config-prettier
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: esparse
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: esvalidate
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: extract-zip
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: fd-extract-manifest
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: fd-modify-ember-config
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: flat
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: gonzales
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: handlebars
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: highlight
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: image-size
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: inline-source-map-comment
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: is-ci
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: js-yaml
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: jsesc
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: json5
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: lerna-changelog
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: loose-envify
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: make-plural
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: markdown-it
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: miller-rabin
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: mime
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: mkdirp
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: mustache
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: nanoid
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: node-gyp
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: node-sass
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: node-which
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: nopt
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: npm-run-all
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: parser
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: phantomjs
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: pidtree
2021-03-02T03:17:05.834Z eslint:file-enumerator Didn't match: pixelmatch
2021-03-02T03:17:05.835Z eslint:file-enumerator Didn't match: prettier
2021-03-02T03:17:05.835Z eslint:file-enumerator Didn't match: purgecss
2021-03-02T03:17:05.835Z eslint:file-enumerator Didn't match: qunit
2021-03-02T03:17:05.835Z eslint:file-enumerator Didn't match: rc
2021-03-02T03:17:05.835Z eslint:file-enumerator Didn't match: regjsparser
2021-03-02T03:17:05.835Z eslint:file-enumerator Didn't match: release-it
2021-03-02T03:17:05.835Z eslint:file-enumerator Didn't match: rimraf
2021-03-02T03:17:05.835Z eslint:file-enumerator Didn't match: rollup
2021-03-02T03:17:05.835Z eslint:file-enumerator Didn't match: run-p
2021-03-02T03:17:05.835Z eslint:file-enumerator Didn't match: run-s
2021-03-02T03:17:05.835Z eslint:file-enumerator Didn't match: sane
2021-03-02T03:17:05.835Z eslint:file-enumerator Didn't match: sassgraph
2021-03-02T03:17:05.835Z eslint:file-enumerator Didn't match: semver
2021-03-02T03:17:05.835Z eslintrc:ignore-pattern Check {
  filePath: '/home/username/my-app/node_modules/.bin/sha.js',
  dot: false,
  relativePath: 'node_modules/.bin/sha.js',
  result: false
}
2021-03-02T03:17:05.835Z eslint:file-enumerator Yield: sha.js
2021-03-02T03:17:05.835Z eslintrc:cascading-config-array-factory Load config files for /home/username/my-app/node_modules/.bin.
2021-03-02T03:17:05.835Z eslintrc:cascading-config-array-factory Cache hit: /home/username/my-app/node_modules/.bin.
2021-03-02T03:17:05.835Z eslint:cli-engine Lint /home/username/my-app/node_modules/.bin/sha.js
2021-03-02T03:17:05.835Z eslint:linter Linting code for /home/username/my-app/node_modules/.bin/sha.js (pass 1)
2021-03-02T03:17:05.835Z eslint:linter Verify
2021-03-02T03:17:05.835Z eslint:linter With ConfigArray: /home/username/my-app/node_modules/.bin/sha.js
2021-03-02T03:17:05.844Z eslint:linter Generating fixed text for /home/username/my-app/node_modules/.bin/sha.js (pass 1)
2021-03-02T03:17:05.844Z eslint:source-code-fixer Applying fixes
2021-03-02T03:17:05.844Z eslint:source-code-fixer shouldFix parameter was false, not attempting fixes
2021-03-02T03:17:05.844Z eslint:file-enumerator Didn't match: shjs
2021-03-02T03:17:05.844Z eslint:file-enumerator Didn't match: sort-package-json
2021-03-02T03:17:05.844Z eslint:file-enumerator Didn't match: specificity
2021-03-02T03:17:05.844Z eslint:file-enumerator Didn't match: sshpk-conv
2021-03-02T03:17:05.844Z eslint:file-enumerator Didn't match: sshpk-sign
2021-03-02T03:17:05.844Z eslint:file-enumerator Didn't match: sshpk-verify
2021-03-02T03:17:05.844Z eslint:file-enumerator Didn't match: strip-indent
2021-03-02T03:17:05.844Z eslint:file-enumerator Didn't match: stylelint
2021-03-02T03:17:05.845Z eslint:file-enumerator Didn't match: svg2png
2021-03-02T03:17:05.845Z eslint:file-enumerator Didn't match: tailwind
2021-03-02T03:17:05.845Z eslint:file-enumerator Didn't match: tailwindcss
2021-03-02T03:17:05.845Z eslint:file-enumerator Didn't match: tap-parser
2021-03-02T03:17:05.845Z eslint:file-enumerator Didn't match: terser
2021-03-02T03:17:05.845Z eslint:file-enumerator Didn't match: testem
2021-03-02T03:17:05.845Z eslint:file-enumerator Didn't match: uglifyjs
2021-03-02T03:17:05.845Z eslint:file-enumerator Didn't match: uuid
2021-03-02T03:17:05.845Z eslint:file-enumerator Didn't match: watch
2021-03-02T03:17:05.845Z eslint:file-enumerator Didn't match: webpack
2021-03-02T03:17:05.845Z eslint:file-enumerator Leave the directory: /home/username/my-app/node_modules/.bin
...
...

@mdjermanovic
Copy link
Member

2021-03-02T03:17:05.833Z eslintrc:ignore-pattern Check {
  filePath: '/home/username/my-app/node_modules/.bin/',
  dot: false,
  relativePath: 'node_modules/.bin/',
  result: false
}
2021-03-02T03:17:05.833Z eslint:file-enumerator Enter the directory: /home/username/my-app/node_modules/.bin
'''

This result: false seems to be the problem. node_modules/.bin/ is ignored by both the default pattern and the dot pattern, but is probably unignored somewhere in the configuration.

Do you have a pattern like !.* in .eslintignore, or in the ignorePatterns property of your .eslintrc.js config, or in the ignorePatterns property of a config specified in extends?

Adding another /**/node_modules/* to .eslintignore helps because it re-ignores node_modules/.bin/ (order of patterns matters). Adding node_modules/ also helps as it ignores the parent node_modules/ dir and stops ESLint from entering it.

This probably wasn't noticed before v7.21.0 as the symbolic links in node_modules/.bin/ were being skipped, and there are no other *.js files inside.

2021-03-02T03:16:51.812Z eslintrc:config-array-factory Loading .eslintignore file: /home/username/my-app/.eslintignore
2021-03-02T03:16:51.813Z eslintrc:ignore-pattern Create with: [ IgnorePattern { patterns: [ '/**/node_modules/*' ], basePath: '/home/username/my-app', loose: false } ]
2021-03-02T03:16:51.814Z eslintrc:ignore-pattern   processed: { basePath: '/home/username/my-app', patterns: [ '/**/node_modules/*' ] }
2021-03-02T03:16:51.814Z eslintrc:ignore-pattern Create with: [ IgnorePattern { patterns: [ '/**/node_modules/*' ], basePath: '/home/username/my-app', loose: false } ]
2021-03-02T03:16:51.814Z eslintrc:ignore-pattern   processed: { basePath: '/home/username/my-app', patterns: [ '/**/node_modules/*' ] }
2021-03-02T03:16:51.814Z eslint:file-enumerator Start to iterate files: [ '.' ]
2021-03-02T03:16:51.814Z eslint:file-enumerator Directory: /home/username/my-app
2021-03-02T03:16:51.815Z eslint:file-enumerator Enter the directory: /home/username/my-app
2021-03-02T03:16:51.815Z eslintrc:cascading-config-array-factory Load config files for /home/username/my-app.
2021-03-02T03:16:51.815Z eslintrc:cascading-config-array-factory No cache found: /home/username/my-app.
2021-03-02T03:16:51.815Z eslintrc:config-array-factory Loading JS config file: /home/username/my-app/.eslintrc.js
2021-03-02T03:16:51.816Z eslintrc:config-array-factory Config file found: /home/username/my-app/.eslintrc.js

Is there another sequence of eslintrc:ignore-pattern Create with: ... and eslintrc:ignore-pattern processed: ... after this line?

@Techn1x
Copy link
Author

Techn1x commented Mar 3, 2021

Do you have a pattern like !.* in .eslintignore, or in the ignorePatterns property of your .eslintrc.js config, or in the ignorePatterns property of a config specified in extends?

You are totally right @mdjermanovic , I've located a !.* being added to the ignore config, that's exactly it. Commenting it out makes the lint errors go away.

Thanks ! Hopefully anyone else experiencing this problem will find this issue, I suspect I'm not the only one

@Techn1x Techn1x closed this as completed Mar 3, 2021
Triage automation moved this from Evaluating to Complete Mar 3, 2021
@Techn1x
Copy link
Author

Techn1x commented Mar 3, 2021

As it turns out, this !.* is present in the default eslint ignore file generated by ember-cli (as of v3.24 anyway)
https://github.com/ember-cli/ember-new-output/blob/7faae3f8d1c029efb0e47664d5ef232a9ef912ac/.eslintignore#L15

I'll submit an issue there and see what they think about adjusting it

@Techn1x
Copy link
Author

Techn1x commented Apr 12, 2021

For anyone stumbling onto this, this will be fixed in an upcoming version of ember-cli
ember-cli/ember-cli#9456

Until then you can add the .*/ into the .eslintignore file yourself

@eslint-github-bot eslint-github-bot bot locked and limited conversation to collaborators Aug 31, 2021
@eslint-github-bot eslint-github-bot bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Aug 31, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly core Relates to ESLint's core APIs and features
Projects
Archived in project
Triage
Complete
Development

No branches or pull requests

2 participants