Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.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?

like image 346
Dan Avatar asked Feb 19 '17 07:02

Dan


2 Answers

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.

like image 184
sebbab Avatar answered Nov 15 '22 09:11

sebbab


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.

like image 24
Julha Avatar answered Nov 15 '22 09:11

Julha