{ "ecmaFeatures": {}, "rules": { "no-alert": 0,//禁止使用alert confirm prompt "no-array-constructor": 0,//禁止使用数组构造器 "no-bitwise": 0,//禁止使用按位运算符 "no-caller": 1,//禁止使用arguments.caller或arguments.callee "no-catch-shadow": 0,//禁止catch子句参数与外部作用域变量同名 "no-class-assign": 0,//禁止给类赋值 "no-cond-assign": 2,//禁止在条件表达式中使用赋值语句 "no-console": 2,//禁止在Node环境中使用console "no-const-assign": 0,//禁止修改const声明的变量 "no-constant-condition": 2,//禁止在条件中使用常量表达式 if(true) if(1) "no-continue": 0,//禁止使用continue "no-control-regex": 2,//禁止在正则表达式中使用控制字符 "no-debugger": 2,//禁止使用debugger "no-delete-var": 2,//不能对var声明的变量使用delete操作符 "no-div-regex": 0,//不能使用看起来像除法的正则表达式/=foo/ "no-dupe-keys": 2,//在创建对象字面量时不允许键重复 {a:1,a:1} "no-dupe-args": 2,//函数参数不能重复 "no-duplicate-case": 2,//switch中的case标签不能重复 "no-else-return": 0,//如果if语句里面有return,后面不能跟else语句 "no-empty": 2,//块语句中的内容不能为空 "no-empty-character-class": 2,//正则表达式中的[]内容不能为空 "no-empty-label": 0,//禁止使用空label "no-eq-null": 0,//禁止对null使用==或!=运算符 "no-eval": 0,//禁止使用eval "no-ex-assign": 2,//禁止给catch语句中的异常参数赋值 "no-extend-native": 0,//禁止扩展native对象 "no-extra-bind": 0,//禁止不必要的函数绑定 "no-extra-boolean-cast": 2,//禁止不必要的bool转换 "no-extra-parens": 0,//禁止非必要的括号 "no-extra-semi": 2,//禁止多余的冒号 "no-fallthrough": 2,//禁止switch穿透 "no-floating-decimal": 0,//禁止省略浮点数中的0 .5 3. "no-func-assign": 2,//禁止重复的函数声明 "no-implicit-coercion": 0,//禁止隐式转换 "no-implied-eval": 0,//禁止使用隐式eval "no-inline-comments": 0,//禁止行内备注 "no-inner-declarations": [2, "functions"],//禁止在块语句中使用声明(变量或函数) "no-invalid-regexp": 2,//禁止无效的正则表达式 "no-invalid-this": 0,//禁止无效的this,只能用在构造器,类,对象字面量 "no-irregular-whitespace": 2,//不能有不规则的空格 "no-iterator": 0,//禁止使用__iterator__ 属性 "no-label-var": 0,//label名不能与var声明的变量名相同 "no-labels": 0,//禁止标签声明 "no-lone-blocks": 0,//禁止不必要的嵌套块 "no-lonely-if": 0,//禁止else语句内只有if语句 "no-loop-func": 0,//禁止在循环中使用函数(如果没有引用外部变量不形成闭包就可以) "no-mixed-requires": [0, false],//声明时不能混用声明类型 "no-mixed-spaces-and-tabs": [2, false],//禁止混用tab和空格 "linebreak-style": [0, "unix"],//换行风格 "no-multi-spaces": 0,//不能用多余的空格 "no-multi-str": 0, "no-multiple-empty-lines": [0, {"max": 2}], "no-native-reassign": 0,//不能重写native对象 "no-negated-in-lhs": 2,//in 操作符的左边不能有! "no-nested-ternary": 0, "no-new": 0, "no-new-func": 0, "no-new-object": 0, "no-new-require": 0, "no-new-wrappers": 0, "no-obj-calls": 2, "no-octal": 2, "no-octal-escape": 0, "no-param-reassign": 0, "no-path-concat": 0, "no-plusplus": 0,//禁止使用++,-- "no-process-env": 0, "no-process-exit": 0, "no-proto": 0,//禁止使用__proto__属性 "no-redeclare": 2,//禁止重复声明变量 "no-regex-spaces": 2, "no-restricted-modules": 0, "no-return-assign": 0, "no-script-url": 0, "no-self-compare": 0, "no-sequences": 0, "no-shadow": 0, "no-shadow-restricted-names": 0, "no-spaced-func": 0, "no-sparse-arrays": 2, "no-sync": 0, "no-ternary": 0, "no-trailing-spaces": 0, "no-this-before-super": 0, "no-throw-literal": 0, "no-undef": 2, "no-undef-init": 0, "no-undefined": 0, "no-unexpected-multiline": 0, "no-underscore-dangle": 0, "no-unneeded-ternary": 0, "no-unreachable": 2, "no-unused-expressions": 0, "no-unused-vars": [2, {"vars": "all", "args": "after-used"}], "no-use-before-define": 0, "no-useless-call": 0, "no-void": 0, "no-var": 0, "no-warning-comments": [0, { "terms": ["todo", "fixme", "xxx"], "location": "start" }], "no-with": 0, "array-bracket-spacing": [0, "never"], "arrow-parens": 0, "arrow-spacing": 0, "accessor-pairs": 0,//在对象中使用getter/setter "block-scoped-var": 0,//块语句中使用var "brace-style": [0, "1tbs"], "callback-return": 0, "camelcase": 0, "comma-dangle": [2, "never"], "comma-spacing": 0, "comma-style": 0, "complexity": [0, 11], "computed-property-spacing": [0, "never"], "consistent-return": 0, "consistent-this": [0, "that"], "constructor-super": 0, "curly": [0, "all"],//必须使用 if(){} 中的{} "default-case": 0, "dot-location": 0, "dot-notation": [0, { "allowKeywords": true }], "eol-last": 0, "eqeqeq": 1,//必须使用全等 "func-names": 0, "func-style": [0, "declaration"], "generator-star-spacing": 0, "guard-for-in": 0, "handle-callback-err": 0, "id-length": 0, "indent": 0, "init-declarations": 0, "key-spacing": [0, { "beforeColon": false, "afterColon": true }], "lines-around-comment": 0, "max-depth": [0, 4], "max-len": [0, 80, 4], "max-nested-callbacks": [0, 2], "max-params": [0, 3],//函数最多只能有3个参数 "max-statements": [0, 10], "new-cap": 0, "new-parens": 0, "newline-after-var": 0, "object-curly-spacing": [0, "never"], "object-shorthand": 0, "one-var": 0, "operator-assignment": [0, "always"], "operator-linebreak": 0, "padded-blocks": 0, "prefer-const": 0, "prefer-spread": 0, "prefer-reflect": 0, "quote-props": 0, "quotes": [0, "double"],//使用双引号 "radix": 0, "id-match": 0, "require-yield": 0, "semi": 0, "semi-spacing": [0, {"before": false, "after": true}], "sort-vars": 0, "space-after-keywords": [0, "always"], "space-before-blocks": [0, "always"], "space-before-function-paren": [0, "always"], "space-in-parens": [0, "never"], "space-infix-ops": 0, "space-return-throw-case": 0, "space-unary-ops": [0, { "words": true, "nonwords": false }], "spaced-comment": 0, "strict": 0,//使用严格模式 "use-isnan": 2,//禁止比较时使用NaN,只能用isNaN() "valid-jsdoc": 0, "valid-typeof": 2,//必须使用合法的typeof的值 "vars-on-top": 0, "wrap-iife": 0, "wrap-regex": 0, "yoda": [0, "never"] } }
to be continue。。。
时间: 2024-10-27 14:03:41