一、注釋不要的掃描段落,特別是拷貝的網上的代碼
/* 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" }}新聞熱點
疑難解答