安裝
shell> npm install -g jshint
shell> jshint
function main() {
"use strict";
return 'Hello, World!';
}
main();
.jshintrc
{
"strict" : true,
"undef" : true,
"validthis" : true,
"node" : true,
"esversion" : 6,
"curly" : true,
"unused" : true
}
Semicolon
[͵sɛmɪˋkolən] 分號
Expected
[ɪkˋspɛktɪd] 需要
參考網站:
ESLint
安裝
shell> npm install -g eslint
shell> eslint --init
.eslintrc
{
"rules": {
"semi": ["error", "always"],
"quotes": ["error", "single"]
}
}
"eqeqeq": "off",
"eqeqeq": "warn"
"strict": "off"
"strict": "warn"
"strict": "error"
"curly": "error",
"quotes": ["error", "double"],
"quotes": ["error", "single"],
"indent": ["error", 4],
"linebreak-style": ["error", "unix"],
"semi": ["error", "always"],
"one-var": "off", // ["error", "never"]
"no-console": "off",
"no-cond-assign": ["error", "always"],
"no-inline-comments": "off",
"comma-dangle": ["error", "always"],
{
"extends": "google",
"installedESLint": true
}
'use strict';
function doSomething() {
}
Complete!