简体   繁体   中英

eslint not ignoring node_modules and getting error when try to lint

I'm trying to implement eslint in a Next.js project.The file structure look like below

.eslintignore
.eslintrc.js
.next
.prettierrc
.stylelintrc.js
components
forms
modals
modules
node_modules

And I have node_modules/* in my .eslintignore file. When I try to lint these by eslint --fix /sources/**/*.js I am getting below error

You are linting "/sources/node_modules/ally.js", but all of the files matching the glob pattern "/sources/node_modules/ally.js" are ignored.

Anyone can help me to solve this? Thanks

If .eslintignore located in the same directory as node_modules you can specify it as node_modules .

# .eslintignore
node_modules
**/.next/**
**/_next/**
**/dist/**

.eslintignore follows .gitignore syntax. See .gitignore specs for more details.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM