我用jslint来修正jslint违规行为。在这里,我修正了违规行为,并忽略了JSLint.net.json文件中的文件。
之后,当我构建项目时,我在jslint文件中看到了警告。
警告:数组元素后面缺少逗号。如何修复这些警告?
我的JSlintNet json文件:
{
"version": "2.3.0",
"output": "Warning",
"module": true,
"ignore": [
"\\Scripts\\Menu\\fileone.js",
"\\Scripts\\Menu\\filetwo.js",
"\\Scripts\\Others\\filethree.js",
"\\Scripts\\Others\\filefour.js",
"\\Scripts\\Others\\filefive.js",
"\\Scripts\\Others\\filesix.js",
"\\Scripts\\Others\\fileseven.js",
"\\Scripts\\Others\\fileeight.js"
],
"options": {
"this": true,
"for": true,
"browser": true,
"single": true,
"devel": true,
"sloppy": true
},
"globalVariables": [
"$",
"swal",
"window"
],
"runOnBuild": false,
"cancelBuild": false
}发布于 2017-05-25 07:23:13
我正在使用eslint,它具有自动修复几个皮线错误的功能。
例子:
eslint -c .eslintrc -修复./src/script/**/*..js
eslintrc是带有规则的json文件。
此外,该更漂亮的可用于自动修复缩进错误。
更漂亮--打印宽度120 --标签宽度4--单引号--无逗号--写--解析器巴比伦./src/script/**/*..js
如果您将运行更漂亮,然后埃林特自动修复,大多数常见的棉线错误将自动解决。其余的错误需要手动更改代码。
参考埃斯林特更漂亮
此外,它还可以链接到Package.json
`"eslint": "eslint -c .eslintrc --fix ./src/scripts/**/*.js || exit 0",
"prettier": "prettier --print-width 120 --tab-width 4 --single-quote --trailing-comma none --write --parser babylon ./src/scripts/**/*.js || exit 0"`https://stackoverflow.com/questions/44174459
复制相似问题