Dan
Dan

Reputation: 1411

.eslintignore is ignored by create-react-app?

I've placed a .eslintignore file in the root of my create-react-app installation, so I can ignore warnings from vendor libs.

It works fine if I run eslint from the commandline:

./node_modules/.bin/eslint src/js/vendor/jquery.js
...warnings ignored...

However running npm start and npm run build seem to ignore the ignore file.

How can I achieve what I want to do here - without editing individual vendor files to add eslint options?

Upvotes: 15

Views: 12129

Answers (3)

sebbab
sebbab

Reputation: 1046

This was fixed with this commit in CRA codebase: https://github.com/facebook/create-react-app/commit/6f5221c2d7df0b7a097cfdd461967422c3013e12#diff-dc0c4e7c623b73660da1809fc60cf6ba

Simply add EXTEND_ESLINT=true to a .env file in your project root.

Upvotes: 15

Julha
Julha

Reputation: 1125

YES .eslintignore is ignored. According to this issue.

CRA 1.x+ purposely does not support .eslintignore. Sorry!

Workarround

  • add /* eslint-disable */ to the beginning of the file.

  • move vendor files into public/ or use a NPM package.

Upvotes: 9

Dan
Dan

Reputation: 1411

Seems to work if I exclude complete directories from the .eslintignore in the root. Here is my .eslintignore

src/js/vendor/
src/vendor/

Upvotes: 1

Related Questions