This post works for linting all .js
files in a project.
How do I lint all .jsx
files in addition to all .js
files?
I've gotten this to work:
"lint": "./node_modules/.bin/eslint \"./**/*.js\" \"./**/*.jsx\""
However, I think that there is a more succint way to match both .js
and .jsx
file extensions.
This post works for linting all .js
files in a project.
How do I lint all .jsx
files in addition to all .js
files?
I've gotten this to work:
"lint": "./node_modules/.bin/eslint \"./**/*.js\" \"./**/*.jsx\""
However, I think that there is a more succint way to match both .js
and .jsx
file extensions.
2 Answers
Reset to default 10You could also try the following which is working fine on my machine:
"lint": "eslint \"**/*.{js,jsx}\""
Eslint has an --ext
flag which you can use to specify the file extensions you want eslint to look at. So you can do "lint: eslint --ext .js --ext .jsx"
https://eslint.org/docs/user-guide/command-line-interface
./node_modules/.bin/
in thescripts
section ofpackage.json
. – devius Commented Jun 18, 2018 at 17:41