Does anybody know how to check nodejs code to code standards automatically? I'm looking for some features like codesniffer but for node.js (express framework).
Asked
Active
Viewed 2,463 times
3
-
https://standardjs.com/index.html#i-disagree-with-rule-x-can-you-change-it – Michael Freidgeim Feb 17 '23 at 22:26
1 Answers
7
You can use JSHint for node. Install it globally:
sudo npm install jshint -g
Basic usage:
jshint foo.js
foo.js: line 7, col 23, Missing semicolon.
You can create a custom configuration file named .jshintrc
that contain JSON JSHint options, and JSHint will pick them up. Example of a .jshintrc
file:
{
"strict": "true",
"smarttabs": "true"
}
You can read more about how to configure JSHint on their documentation page.

matth
- 6,112
- 4
- 37
- 43
-
-
Yes, there is configuration information on the [docs](http://jshint.com/docs/) page for this. – matth Dec 05 '13 at 21:09