.eslintignore: can't exclude files from node_modules once ignored
See original GitHub issueTell us about your environment
- ESLint Version: 4.4.1
- Node Version: 8.2.1
- npm Version: 5.3.0
What parser (default, Babel-ESLint, etc.) are you using?
default
Please show your full configuration:
Configuration
module.exports = {
extends: 'airbnb',
parser: 'babel-eslint',
plugins: [
'react',
'import',
],
rules: {
'max-len': 'off',
'react/jsx-filename-extension': ['error', { extensions: ['.js', '.jsx'] }],
'import/first': ['error', { 'absolute-first': false }],
'import/no-extraneous-dependencies': ['error', { devDependencies: true, optionalDependencies: false, peerDependencies: true }],
curly: ['error', 'all'],
},
env: {
browser: true,
jest: true,
},
settings: {
'import/cache:': {
lifetime: 2,
},
'import/resolver': {
webpack: {
config: path.join(__dirname, 'webpack.config.dev.js'),
},
},
},
};
!.*
node_modules/
coverage/
junit/
dist/
mobiles/
!node_modules/some-package/
What did you do? Please include the actual source code causing the issue.
Introduce linting error in node_modules/some-package/test.js
const test = 1 // missing semi (also unused const)
What did you expect to happen?
A linting error. When I comment node_modules
in .eslintignore
it works, but also lints node_modules
.
What actually happened? Please include the actual, raw output from ESLint.
eslint .
can't resolve reference #/definitions/basicConfig from id #
can't resolve reference #/definitions/basicConfigOrBoolean from id #
can't resolve reference #/definitions/basicConfigOrBoolean from id #
Done in 47.24s.
Thanks in advance!
Issue Analytics
- State:
- Created 6 years ago
- Comments:11 (3 by maintainers)
Top Results From Across the Web
Eslint not ignoring node_modules folder - Stack Overflow
In my case, ESLint (v7.8.1) was ignoring node_modules directories properly, but not my dist directory. I added this to .eslintignore :
Read more >Ignoring Code - ESLint - Pluggable JavaScript Linter
Create a dedicated file that contains the ignore patterns ( .eslintignore by default) ... You cannot write ignorePatterns property under overrides property.
Read more >eslintignore file doesn't seem to be working
Paths are being resolved correctly, but of course you're not going to describe files to ignore in one project from another project's eslintignore....
Read more >Ignoring ESLint - next.config.js
Next.js reports ESLint errors and warnings during builds by default. Learn how to opt-out of this behavior here.
Read more >prettier-eslint-cli - npm
--eslint-ignore Only format matching files even if they are not ignored by .eslintignore. (can use --no-eslint-ignore to disable this) ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@not-an-aardvark
According to the .gitignore rules
node_modules/*
only ignores the things inside the directory.While
node_modules/
ignores the directory and everything inside it, thennode_modules/some-packages
could not be re-included because its parent dirnode_modules/
is ignored.Ok figured it out. It was a mix of @kaelzhang 's solution, and the fact that I have nested node_modules in my project.
did the trick. Thanks to all!