eslint

一、項目使用lint彙總

項目
構建方式
風格
自定義rules
MBF4
vue-cli
plugin:vue/essential
'no-console', 'no-debugger'
MBInfoManage
vue-cli

.editorconfig
plugin:vue/essential
'no-console', 'no-debugger'


[*]indent_style = space, indent_size=2 [*.{cs,csx}] indent_size = 4 , charset = utf-8-bom
MBInfoMobileManage-web
vue-cli

.editorconfig
plugin:vue/essential,
eslint:recommended
'no-console', 'no-debugger', semi:['warn','never''], quotes:['warn','single''], 'no-unused-vars':'warn', no-empty:'off', 'no-useless-escape':'off'


[*]indent_style = space, indent_size=2
MBPGCManage
gulp

.editorconfig
standard
eslint().eslint.format()


"indent",'kubebreaj-syle','quotes','semi','no-tabs','no-unused-vars','no-eval'

[*]indent_style = space, [*.{cs,csx}] indent_size = 4 , charset = utf-8-bom


二、vue-cli 默認的 lint ——
"eslintConfig": { "root": true, "env": { "node": true }, "extends": [ "plugin:vue/essential", "eslint:recommended" ], "rules": {}, "parserOptions": { "parser": "babel-eslint" } }

A——eslint:recommended cn.eslint.org/docs/rules/
eslint:recommended 全部的規則默認都是禁用的。在 配置文件中,使用 "extends": "eslint:recommended" 來啓用推薦的規則,
報告一些常見的問題,在下文中這些推薦的規則都帶有一個✅標記。
命令行的 --fix 選項用來自動修復規則所報告的問題(目前,大部分是對空白的修復),在下文中會有一個 🔧 的圖標。
//base.js /* * IMPORTANT! * This file has been automatically generated, * in order to update it's content execute "npm run update" */ module.exports = { parser: require.resolve('vue-eslint-parser'), parserOptions: { ecmaVersion: 2018, sourceType: 'module', ecmaFeatures: { jsx: true } }, env: { browser: true, es6: true }, plugins: [ 'vue' ], rules: { 'vue/comment-directive': 'error', 'vue/jsx-uses-vars': 'error' } }

//essential.js module.exports = { extends: require.resolve('./base'), rules: { 'vue/no-async-in-computed-properties': 'error', 'vue/no-dupe-keys': 'error', 'vue/no-duplicate-attributes': 'error', 'vue/no-parsing-error': 'error', 'vue/no-reserved-keys': 'error', 'vue/no-shared-component-data': 'error', 'vue/no-side-effects-in-computed-properties': 'error', 'vue/no-template-key': 'error', 'vue/no-textarea-mustache': 'error', 'vue/no-unused-components': 'error', 'vue/no-unused-vars': 'error', 'vue/no-use-v-if-with-v-for': 'error', 'vue/require-component-is': 'error', 'vue/require-prop-type-constructor': 'error', 'vue/require-render-return': 'error', 'vue/require-v-for-key': 'error', 'vue/require-valid-default-prop': 'error', 'vue/return-in-computed-property': 'error', 'vue/use-v-on-exact': 'error', 'vue/valid-template-root': 'error', 'vue/valid-v-bind': 'error', 'vue/valid-v-cloak': 'error', 'vue/valid-v-else-if': 'error', 'vue/valid-v-else': 'error', 'vue/valid-v-for': 'error', 'vue/valid-v-html': 'error', 'vue/valid-v-if': 'error', 'vue/valid-v-model': 'error', 'vue/valid-v-on': 'error', 'vue/valid-v-once': 'error', 'vue/valid-v-pre': 'error', 'vue/valid-v-show': 'error', 'vue/valid-v-text': 'error' } }

{ "parserOptions": { "ecmaVersion": 2018, "ecmaFeatures": { "jsx": true }, "sourceType": "module" }, "env": { "es6": true, "node": true }, "plugins": [ "import", "node", "promise", "standard" ], "globals": { "document": false, "navigator": false, "window": false }, "rules": { "accessor-pairs": "error", "arrow-spacing": ["error", { "before": true, "after": true }], "block-spacing": ["error", "always"], "brace-style": ["error", "1tbs", { "allowSingleLine": true }], "camelcase": ["error", { "properties": "never" }], "comma-dangle": ["error", { "arrays": "never", "objects": "never", "imports": "never", "exports": "never", "functions": "never" }], "comma-spacing": ["error", { "before": false, "after": true }], "comma-style": ["error", "last"], "constructor-super": "error", "curly": ["error", "multi-line"], "dot-location": ["error", "property"], "eol-last": "error", "eqeqeq": ["error", "always", { "null": "ignore" }], "func-call-spacing": ["error", "never"], "generator-star-spacing": ["error", { "before": true, "after": true }], "handle-callback-err": ["error", "^(err|error)$" ], "indent": ["error", 2, { "SwitchCase": 1, "VariableDeclarator": 1, "outerIIFEBody": 1, "MemberExpression": 1, "FunctionDeclaration": { "parameters": 1, "body": 1 }, "FunctionExpression": { "parameters": 1, "body": 1 }, "CallExpression": { "arguments": 1 }, "ArrayExpression": 1, "ObjectExpression": 1, "ImportDeclaration": 1, "flatTernaryExpressions": false, "ignoreComments": false }], "key-spacing": ["error", { "beforeColon": false, "afterColon": true }], "keyword-spacing": ["error", { "before": true, "after": true }], "new-cap": ["error", { "newIsCap": true, "capIsNew": false }], "new-parens": "error", "no-array-constructor": "error", "no-caller": "error", "no-class-assign": "error", "no-compare-neg-zero": "error", "no-cond-assign": "error", "no-const-assign": "error", "no-constant-condition": ["error", { "checkLoops": false }], "no-control-regex": "error", "no-debugger": "error", "no-delete-var": "error", "no-dupe-args": "error", "no-dupe-class-members": "error", "no-dupe-keys": "error", "no-duplicate-case": "error", "no-empty-character-class": "error", "no-empty-pattern": "error", "no-eval": "error", "no-ex-assign": "error", "no-extend-native": "error", "no-extra-bind": "error", "no-extra-boolean-cast": "error", "no-extra-parens": ["error", "functions"], "no-fallthrough": "error", "no-floating-decimal": "error", "no-func-assign": "error", "no-global-assign": "error", "no-implied-eval": "error", "no-inner-declarations": ["error", "functions"], "no-invalid-regexp": "error", "no-irregular-whitespace": "error", "no-iterator": "error", "no-label-var": "error", "no-labels": ["error", { "allowLoop": false, "allowSwitch": false }], "no-lone-blocks": "error", "no-mixed-operators": ["error", { "groups": [ ["==", "!=", "===", "!==", ">", ">=", "<", "<="], ["&&", "||"], ["in", "instanceof"] ], "allowSamePrecedence": true }], "no-mixed-spaces-and-tabs": "error", "no-multi-spaces": "error", "no-multi-str": "error", "no-multiple-empty-lines": ["error", { "max": 1, "maxEOF": 0 }], "no-negated-in-lhs": "error", "no-new": "error", "no-new-func": "error", "no-new-object": "error", "no-new-require": "error", "no-new-symbol": "error", "no-new-wrappers": "error", "no-obj-calls": "error", "no-octal": "error", "no-octal-escape": "error", "no-path-concat": "error", "no-proto": "error", "no-redeclare": "error", "no-regex-spaces": "error", "no-return-assign": ["error", "except-parens"], "no-return-await": "error", "no-self-assign": "error", "no-self-compare": "error", "no-sequences": "error", "no-shadow-restricted-names": "error", "no-sparse-arrays": "error", "no-tabs": "error", "no-template-curly-in-string": "error", "no-this-before-super": "error", "no-throw-literal": "error", "no-trailing-spaces": "error", "no-undef": "error", "no-undef-init": "error", "no-unexpected-multiline": "error", "no-unmodified-loop-condition": "error", "no-unneeded-ternary": ["error", { "defaultAssignment": false }], "no-unreachable": "error", "no-unsafe-finally": "error", "no-unsafe-negation": "error", "no-unused-expressions": ["error", { "allowShortCircuit": true, "allowTernary": true, "allowTaggedTemplates": true }], "no-unused-vars": ["error", { "vars": "all", "args": "none", "ignoreRestSiblings": true }], "no-use-before-define": ["error", { "functions": false, "classes": false, "variables": false }], "no-useless-call": "error", "no-useless-computed-key": "error", "no-useless-constructor": "error", "no-useless-escape": "error", "no-useless-rename": "error", "no-useless-return": "error", "no-whitespace-before-property": "error", "no-with": "error", "object-curly-spacing": ["error", "always"], "object-property-newline": ["error", { "allowMultiplePropertiesPerLine": true }], "one-var": ["error", { "initialized": "never" }], "operator-linebreak": ["error", "after", { "overrides": { "?": "before", ":": "before" } }], "padded-blocks": ["error", { "blocks": "never", "switches": "never", "classes": "never" }], "prefer-promise-reject-errors": "error", "quotes": ["error", "single", { "avoidEscape": true, "allowTemplateLiterals": true }], "rest-spread-spacing": ["error", "never"], "semi": ["error", "never"], "semi-spacing": ["error", { "before": false, "after": true }], "space-before-blocks": ["error", "always"], "space-before-function-paren": ["error", "always"], "space-in-parens": ["error", "never"], "space-infix-ops": "error", "space-unary-ops": ["error", { "words": true, "nonwords": false }], "spaced-comment": ["error", "always", { "line": { "markers": ["*package", "!", "/", ",", "="] }, "block": { "balanced": true, "markers": ["*package", "!", ",", ":", "::", "flow-include"], "exceptions": ["*"] } }], "symbol-description": "error", "template-curly-spacing": ["error", "never"], "template-tag-spacing": ["error", "never"], "unicode-bom": ["error", "never"], "use-isnan": "error", "valid-typeof": ["error", { "requireStringLiterals": true }], "wrap-iife": ["error", "any", { "functionPrototypeMethods": true }], "yield-star-spacing": ["error", "both"], "yoda": ["error", "never"], "import/export": "error", "import/first": "error", "import/no-duplicates": "error", "import/no-named-default": "error", "import/no-webpack-loader-syntax": "error", "node/no-deprecated-api": "error", "node/process-exit-as-throw": "error", "promise/param-names": "error", "standard/array-bracket-even-spacing": ["error", "either"], "standard/computed-property-even-spacing": ["error", "even"], "standard/no-callback-literal": "error", "standard/object-curly-even-spacing": ["error", "either"] } }


四、編輯器格式化 .editorconfig editorconfig.org
# EditorConfig is awesome: https://EditorConfig.org # top-most EditorConfig file root = true # Unix-style newlines with a newline ending every file [*] end_of_line = lf insert_final_newline = true # Matches multiple files with brace expansion notation # Set default charset [*.{js,py}] charset = utf-8 # 4 space indentation [*.py] indent_style = space indent_size = 4 # Tab indentation (no size specified) [Makefile] indent_style = tab # Indentation override for all JS under lib directory [lib/**.js] indent_style = space indent_size = 2 # Matches the exact files either package.json or .travis.yml [{package.json,.travis.yml}] indent_style = space indent_size = 2

五、gulp-eslint 的做用
const {src, task} = require('gulp'); const eslint = require('gulp-eslint'); task('default', () => { return src(['scripts/*.js']) // eslint() attaches the lint output to the "eslint" property // of the file object so it can be used by other modules. .pipe(eslint()) // eslint.format() outputs the lint results to the console. // Alternatively use eslint.formatEach() (see Docs). .pipe(eslint.format()) // To have the process exit with an error code (1) on // lint error, return the stream and pipe to failAfterError last. .pipe(eslint.failAfterError()); });
A-若是沒有.eslintrc ,也沒有在 package.json中配置規則,也沒有行內代碼,則默認的——沒有啓動任何校驗規則
B-eslint.format(),用於定義輸出的錯誤信息提示格式,默認格式爲eslint stylish formatter github.com/sindresorhu…

五、經過插件進行格式化代碼JavaScript Standard Style standardjs.com/readme-zhcn…
JavaScript 代碼規範,自帶 linter & 代碼自動修正
本工具經過如下三種方式爲你(及你的團隊)節省大量時間:
  • 無須配置。 史上最便捷的統一代碼風格的方式,輕鬆擁有。
  • 自動代碼格式化。 只需運行 standard --fix 今後和髒亂差的代碼說再見。
  • 提早發現風格及程序問題。 減小代碼審查過程當中反反覆覆的修改過程,節約時間。
無須猶豫。不再用維護 .eslintrc, .jshintrc, or .jscsrc 。開箱即用。
npm install standard --save-dev
添加配置到 package.json
{ "name": "my-cool-package", "devDependencies": { "standard": "*" }, "scripts": { "test": "standard && node my-tests.js" } }

六、如何使用lint
A、在保存代碼時啓用lint
module: { rules: [ { enforce: 'pre', test: /\.(js|vue)$/, loader: 'eslint-loader', include: [path.resolve(__dirname, '../src')], // 指定檢查的目錄 exclude: /node_modules/, options:{ fix: true } }, ] },

B、在commit代碼時啓用
npm install pre-commit --save-dev
修改package.json
"scripts": { "dev": "webpack-dev-server --config ./build/webpack.dev.js --colors", "nodemon": "nodemon --config nodemon", "build": "webpack --config ./build/webpack.build.js", "lint": "eslint src --ext .js --cache --fix" }, "pre-commit": [ "lint" ],
C、防止使用了es6的es5的代碼

  

















備註:
一、eslint 配置項

root 限定配置文件的使用範圍
parser 指定eslint的解析器
parserOptions 設置解析器選項
extends 指定eslint規範
plugins 引用第三方的插件
env 指定代碼運行的宿主環境
rules 啓用額外的規則或覆蓋默認的規則
globals 聲明在代碼中的自定義全局變量
二、rules說明
"no-alert": 0,//禁止使用alert confirm prompt "no-array-constructor": 2,//禁止使用數組構造器 "no-bitwise": 0,//禁止使用按位運算符 "no-caller": 1,//禁止使用arguments.caller或arguments.callee "no-catch-shadow": 2,//禁止catch子句參數與外部做用域變量同名 "no-class-assign": 2,//禁止給類賦值 "no-cond-assign": 2,//禁止在條件表達式中使用賦值語句 "no-console": 2,//禁止使用console "no-const-assign": 2,//禁止修改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": 1,//不能使用看起來像除法的正則表達式/=foo/ "no-dupe-keys": 2,//在建立對象字面量時不容許鍵重複 {a:1,a:1} "no-dupe-args": 2,//函數參數不能重複 "no-duplicate-case": 2,//switch中的case標籤不能重複 "no-else-return": 2,//若是if語句裏面有return,後面不能跟else語句 "no-empty": 2,//塊語句中的內容不能爲空 "no-empty-character-class": 2,//正則表達式中的[]內容不能爲空 "no-empty-label": 2,//禁止使用空label "no-eq-null": 2,//禁止對null使用==或!=運算符 "no-eval": 1,//禁止使用eval "no-ex-assign": 2,//禁止給catch語句中的異常參數賦值 "no-extend-native": 2,//禁止擴展native對象 "no-extra-bind": 2,//禁止沒必要要的函數綁定 "no-extra-boolean-cast": 2,//禁止沒必要要的bool轉換 "no-extra-parens": 2,//禁止非必要的括號 "no-extra-semi": 2,//禁止多餘的冒號 "no-fallthrough": 1,//禁止switch穿透 "no-floating-decimal": 2,//禁止省略浮點數中的0 .5 3. "no-func-assign": 2,//禁止重複的函數聲明 "no-implicit-coercion": 1,//禁止隱式轉換 "no-implied-eval": 2,//禁止使用隱式eval "no-inline-comments": 0,//禁止行內備註 "no-inner-declarations": [2, "functions"],//禁止在塊語句中使用聲明(變量或函數) "no-invalid-regexp": 2,//禁止無效的正則表達式 "no-invalid-this": 2,//禁止無效的this,只能用在構造器,類,對象字面量 "no-irregular-whitespace": 2,//不能有不規則的空格 "no-iterator": 2,//禁止使用__iterator__ 屬性 "no-label-var": 2,//label名不能與var聲明的變量名相同 "no-labels": 2,//禁止標籤聲明 "no-lone-blocks": 2,//禁止沒必要要的嵌套塊 "no-lonely-if": 2,//禁止else語句內只有if語句 "no-loop-func": 1,//禁止在循環中使用函數(若是沒有引用外部變量不造成閉包就能夠) "no-mixed-requires": [0, false],//聲明時不能混用聲明類型 "no-mixed-spaces-and-tabs": [2, false],//禁止混用tab和空格 "linebreak-style": [0, "windows"],//換行風格 "no-multi-spaces": 1,//不能用多餘的空格 "no-multi-str": 2,//字符串不能用\換行 "no-multiple-empty-lines": [1, {"max": 2}],//空行最多不能超過2行 "no-native-reassign": 2,//不能重寫native對象 "no-negated-in-lhs": 2,//in 操做符的左邊不能有! "no-nested-ternary": 0,//禁止使用嵌套的三目運算 "no-new": 1,//禁止在使用new構造一個實例後不賦值 "no-new-func": 1,//禁止使用new Function "no-new-object": 2,//禁止使用new Object() "no-new-require": 2,//禁止使用new require "no-new-wrappers": 2,//禁止使用new建立包裝實例,new String new Boolean new Number "no-obj-calls": 2,//不能調用內置的全局對象,好比Math() JSON() "no-octal": 2,//禁止使用八進制數字 "no-octal-escape": 2,//禁止使用八進制轉義序列 "no-param-reassign": 2,//禁止給參數從新賦值 "no-path-concat": 0,//node中不能使用__dirname或__filename作路徑拼接 "no-plusplus": 0,//禁止使用++,-- "no-process-env": 0,//禁止使用process.env "no-process-exit": 0,//禁止使用process.exit() "no-proto": 2,//禁止使用__proto__屬性 "no-redeclare": 2,//禁止重複聲明變量 "no-regex-spaces": 2,//禁止在正則表達式字面量中使用多個空格 /foo bar/ "no-restricted-modules": 0,//若是禁用了指定模塊,使用就會報錯 "no-return-assign": 1,//return 語句中不能有賦值表達式 "no-script-url": 0,//禁止使用javascript:void(0) "no-self-compare": 2,//不能比較自身 "no-sequences": 0,//禁止使用逗號運算符 "no-shadow": 2,//外部做用域中的變量不能與它所包含的做用域中的變量或參數同名 "no-shadow-restricted-names": 2,//嚴格模式中規定的限制標識符不能做爲聲明時的變量名使用 "no-spaced-func": 2,//函數調用時 函數名與()之間不能有空格 "no-sparse-arrays": 2,//禁止稀疏數組, [1,,2] "no-sync": 0,//nodejs 禁止同步方法 "no-ternary": 0,//禁止使用三目運算符 "no-trailing-spaces": 1,//一行結束後面不要有空格 "no-this-before-super": 0,//在調用super()以前不能使用this或super "no-throw-literal": 2,//禁止拋出字面量錯誤 throw "error"; "no-undef": 1,//不能有未定義的變量 "no-undef-init": 2,//變量初始化時不能直接給它賦值爲undefined "no-undefined": 2,//不能使用undefined "no-unexpected-multiline": 2,//避免多行表達式 "no-underscore-dangle": 1,//標識符不能以_開頭或結尾 "no-unneeded-ternary": 2,//禁止沒必要要的嵌套 var isYes = answer === 1 ? true : false; "no-unreachable": 2,//不能有沒法執行的代碼 "no-unused-expressions": 2,//禁止無用的表達式 "no-unused-vars": [2, {"vars": "all", "args": "after-used"}],//不能有聲明後未被使用的變量或參數 "no-use-before-define": 2,//未定義前不能使用 "no-useless-call": 2,//禁止沒必要要的call和apply "no-void": 2,//禁用void操做符 "no-var": 0,//禁用var,用let和const代替 "no-warning-comments": [1, { "terms": ["todo", "fixme", "xxx"], "location": "start" }],//不能有警告備註 "no-with": 2,//禁用with "array-bracket-spacing": [2, "never"],//是否容許非空數組裏面有多餘的空格 "arrow-parens": 0,//箭頭函數用小括號括起來 "arrow-spacing": 0,//=>的前/後括號 "accessor-pairs": 0,//在對象中使用getter/setter "block-scoped-var": 0,//塊語句中使用var "brace-style": [1, "1tbs"],//大括號風格 "callback-return": 1,//避免屢次調用回調什麼的 "camelcase": 2,//強制駝峯法命名 "comma-dangle": [2, "never"],//對象字面量項尾不能有逗號 "comma-spacing": 0,//逗號先後的空格 "comma-style": [2, "last"],//逗號風格,換行時在行首仍是行尾 "complexity": [0, 11],//循環複雜度 "computed-property-spacing": [0, "never"],//是否容許計算後的鍵名什麼的 "consistent-return": 0,//return 後面是否容許省略 "consistent-this": [2, "that"],//this別名 "constructor-super": 0,//非派生類不能調用super,派生類必須調用super "curly": [2, "all"],//必須使用 if(){} 中的{} "default-case": 2,//switch語句最後必須有default "dot-location": 0,//對象訪問符的位置,換行的時候在行首仍是行尾 "dot-notation": [0, { "allowKeywords": true }],//避免沒必要要的方括號 "eol-last": 0,//文件以單一的換行符結束 "eqeqeq": 2,//必須使用全等 "func-names": 0,//函數表達式必須有名字 "func-style": [0, "declaration"],//函數風格,規定只能使用函數聲明/函數表達式 "generator-star-spacing": 0,//生成器函數*的先後空格 "guard-for-in": 0,//for in循環要用if語句過濾 "handle-callback-err": 0,//nodejs 處理錯誤 "id-length": 0,//變量名長度 "indent": [2, 4],//縮進風格 "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": 2,//函數名首行大寫必須使用new方式調用,首行小寫必須用不帶new方式調用 "new-parens": 2,//new時必須加小括號 "newline-after-var": 2,//變量聲明後是否須要空一行 "object-curly-spacing": [0, "never"],//大括號內是否容許沒必要要的空格 "object-shorthand": 0,//強制對象字面量縮寫語法 "one-var": 1,//連續聲明 "operator-assignment": [0, "always"],//賦值運算符 += -=什麼的 "operator-linebreak": [2, "after"],//換行時運算符在行尾仍是行首 "padded-blocks": 0,//塊語句內行首行尾是否要空行 "prefer-const": 0,//首選const "prefer-spread": 0,//首選展開運算 "prefer-reflect": 0,//首選Reflect的方法 "quotes": [1, "single"],//引號類型 `` "" '' "quote-props":[2, "always"],//對象字面量中的屬性名是否強制雙引號 "radix": 2,//parseInt必須指定第二個參數 "id-match": 0,//命名檢測 "require-yield": 0,//生成器函數必須有yield "semi": [2, "always"],//語句強制分號結尾 "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": 2,//return throw case後面要不要加空格 "space-unary-ops": [0, { "words": true, "nonwords": false }],//一元運算符的前/後要不要加空格 "spaced-comment": 0,//註釋風格要不要有空格什麼的 "strict": 2,//使用嚴格模式 "use-isnan": 2,//禁止比較時使用NaN,只能用isNaN() "valid-jsdoc": 0,//jsdoc規則 "valid-typeof": 2,//必須使用合法的typeof的值 "vars-on-top": 2,//var必須放在做用域頂部 "wrap-iife": [2, "inside"],//當即執行函數表達式的小括號風格 "wrap-regex": 0,//正則表達式字面量用小括號包起來 "yoda": [2, "never"]//禁止尤達條件
相關文章
相關標籤/搜索