一、注释不要的扫描段落,特别是拷贝的网上的代码
/* eslint-disable */ var codeNotOk; /* eslint-enable */二、 注释不要扫描的单行代码
var thing = new Thing(); // eslint-disable-line no-use-before-define// eslint-disable-next-line no-use-before-definevar thing = new Thing();三、eslint 等级 “off”, “warn”, “error” 不重要的off, warn警告
四、批量扫描
// 扫描某个js文件夹下的所有js$ eslint webapp/js/**.js// 扫描某个js文件夹及其子文件夹下的所有js$ eslint webapp/js/**/**.js五、.eslintrc.json放在相关的js目录下,当前.eslintrc.json示例:
{ "extends": "airbnb-es5", "rules": { "func-names": "off", "no-console": "off", "no-multi-str": "off", "linebreak-style": "off", "quotes": "off", "space-before-function-paren": "off", "no-param-reassign": "warn", "consistent-return": "off", "no-shadow": "off", "no-else-return": "off", "one-var": "off", "guard-for-in": "warn", "no-unused-vars": "warn", "spaced-commnet": "warn", "eol-last": "warn", "padded-blocks": "warn", "spaced-comment": "off", "yoda": "off" }}新闻热点
疑难解答