Tip: Things to check if you get an npm run lint error or build error
See original GitHub issueI am opening this issue as I also caught up in the npm run lint error issues. After a few hours research on github issues and googling, I found the current checklist to resolve this issue. (Note: this applies to both react-slingshot and react-redux course git repo)
- First Make Sure
.eslintrc
is in your project root folder. The current ESW have some weird behavior in terms of reading.eslintrc
. Even your.eslintrc
is not in your root folder, for example, I accidentally put mine in the/tools
folder, some of the setting will still be activated likeparserOptions
but none of therules
are valid. - Putting the
.eslintrc
in the wrong folder would lead toParsing error: The keyword 'import' is reserved
And it is not related to the setting of your .eslintrc
but whether it is in your root folder or not.
If you didn’t put
"sourceType": "module", "ecmaFeatures": { "jsx": true, "modules": true }
- Missing modules setting would lead to
Parsing error: 'import' and 'export' may appear only with 'sourceType: module'
- Second change the
npm run lint
script to"esw webpack.config.* src tools; exit 0"
and change thenpm run lint:watch
script to"esw webpack.config.* src tools --watch; exit 0"
If ESW found any error or warning in your project like console statement or missing semi, the lint thread will be exit withExit status 1
. This will lead to anELIFECYCLE
error. This is actually not an error but a warning of ESW to indicate that it will print out all the warning and error. Adding exit 0 will not break the eslint checking but allow npm script to ignore the status 1 and allow ESW to print all all the warning and error. - Third check eslint/esw global install version and the local version to match.
This is not an issue I encounter but, make sure the global install is not outdate or out-sync with local project will help you resolve the ‘esw’ keyword. And this means we could use
esw
to replace the/node_modules/.bin/esw
.
These are all the issues I found regarding debugging npm run lint
issues. I hope this helps a lot current unresolved opened issues. Including some closed issues with is not correctly resolved.
This include: https://github.com/coryhouse/react-slingshot/issues/133 https://github.com/coryhouse/react-slingshot/issues/84 https://github.com/coryhouse/react-slingshot/issues/150
Note: I did not reproduce the issue above, some my solution could be not working with the above issues but I think this is a pretty solid solution to the current version of eslint/esw/npm script
.
Credit to: modules solution exit 0 solution
Issue Analytics
- State:
- Created 7 years ago
- Reactions:9
- Comments:16 (8 by maintainers)
Top GitHub Comments
This lint thing does not work for me on Windows… Even if I applied all the suggestions. I just ignore it for the time being… In general this is why it is difficult for me to start with all these tools: versioning nightmare + completely unreadable error messages… We are still in medieval when it comes to building software! 😃
esw webpack.config.* src buildScripts --color; exit 0 npm ERR! code ELIFECYCLE npm ERR! errno 1
Hi @romarioraffington - Thanks! I corrected a minor typo by editing your comment. Let’s omit the first bullet since that code is already included in the project. but otherwise looks great. Thanks!