# fe-standard **Repository Path**: gzg-develop/fe-standard ## Basic Information - **Project Name**: fe-standard - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2019-08-13 - **Last Updated**: 2022-03-13 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # fe-standard 代码规范 ## for-direction > 禁止 for 循环出现方向错误的循环 [详情](https://cn.eslint.org/docs/rules/for-direction) ## getter-return > getter 必须有返回值,并且禁止返回空 [详情](https://cn.eslint.org/docs/rules/getter-return) ## no-async-promise-executor > 禁止将 async 函数做为 new Promise 的回调函数,出现这种情况时,一般不需要使用 new Promise 实现异步了 [详情](https://cn.eslint.org/docs/rules/no-async-promise-executor) ## no-compare-neg-zero > 禁止与负零进行比较 [详情](https://cn.eslint.org/docs/rules/no-compare-neg-zero) ## no-cond-assign > 禁止在测试表达式中使用赋值语句,除非这个赋值语句被括号包起来了 [详情](https://cn.eslint.org/docs/rules/no-cond-assign) ## no-constant-condition > 禁止将常量作为分支条件判断中的测试表达式,但允许作为循环条件判断中的测试表达式 [详情](https://cn.eslint.org/docs/rules/no-constant-condition) ## no-dupe-keys > 禁止在对象字面量中出现重复名称的键名 [详情](https://cn.eslint.org/docs/rules/no-dupe-keys) ## no-duplicate-case > 禁止在 switch 语句中出现重复测试表达式的 case [详情](https://cn.eslint.org/docs/rules/no-duplicate-case) ## no-empty > 禁止出现空代码块,允许 catch 为空代码块 [详情](https://cn.eslint.org/docs/rules/no-empty) ## no-empty-character-class > 禁止在正则表达式中使用空的字符集 [详情](https://cn.eslint.org/docs/rules/no-empty-character-class) ## no-ex-assign > 禁止将 catch 的第一个参数 error 重新赋值 [详情](https://cn.eslint.org/docs/rules/no-ex-assign) ## no-extra-boolean-cast > 禁止不必要的布尔类型转换,比如 !! 或 Boolean [详情](https://cn.eslint.org/docs/rules/no-extra-boolean-cast) ## no-extra-parens > 禁止函数表达式中出现多余的括号 [详情](https://cn.eslint.org/docs/rules/no-extra-parens) ## no-extra-semi > 禁止出现多余的分号 [详情](https://cn.eslint.org/docs/rules/no-extra-semi) ## no-func-assign > 禁止将一个函数声明重新赋值 [详情](https://cn.eslint.org/docs/rules/no-func-assign) ## no-inner-declarations > 禁止在 if 代码块内出现函数声明 [详情](https://cn.eslint.org/docs/rules/no-inner-declarations) ## no-invalid-regexp > 禁止在 RegExp 构造函数中出现非法的正则表达式 [详情](https://cn.eslint.org/docs/rules/no-invalid-regexp) ## no-irregular-whitespace > 禁止使用特殊空白符(比如全角空格),除非是出现在字符串、正则表达式或模版字符串中 [详情](https://cn.eslint.org/docs/rules/no-irregular-whitespace) ## no-misleading-character-class > 禁止正则表达式中使用肉眼无法区分的特殊字符,某些特殊字符很难看出差异,最好不要在正则中使用 [详情](https://cn.eslint.org/docs/rules/no-misleading-character-class) ## no-obj-calls > 禁止将 Math, JSON 或 Reflect 直接作为函数调用 [详情](https://cn.eslint.org/docs/rules/no-obj-calls) ## no-regex-spaces > 禁止在正则表达式中出现连续的空格,必须使用 /foo {3}bar/ 代替 [详情](https://cn.eslint.org/docs/rules/no-regex-spaces) ## no-sparse-arrays > 禁止在数组中出现连续的逗号 [详情](https://cn.eslint.org/docs/rules/no-sparse-arrays) ## no-template-curly-in-string > 禁止在普通字符串中出现模版字符串里的变量形式 [详情](https://cn.eslint.org/docs/rules/no-template-curly-in-string) ## no-unexpected-multiline > 禁止出现容易出错的多行表达式 [详情](https://cn.eslint.org/docs/rules/no-unexpected-multiline) ## no-unreachable > 禁止在 return, throw, break 或 continue 之后还有代码 [详情](https://cn.eslint.org/docs/rules/no-unreachable) ## no-unsafe-finally > 禁止在 finally 中出现 return, throw, break 或 continue [详情](https://cn.eslint.org/docs/rules/no-unsafe-finally) ## require-atomic-updates > 禁止将 await 或 yield 的结果做为运算符的后面项 [详情](https://cn.eslint.org/docs/rules/require-atomic-updates) ## use-isnan > 必须使用 isNaN(foo) 而不是 foo === NaN [详情](https://cn.eslint.org/docs/rules/use-isnan) ## valid-typeof > typeof 表达式比较的对象必须是 'undefined', 'object', 'boolean', 'number', 'string', 'function' 或 'symbol' [详情](https://cn.eslint.org/docs/rules/valid-typeof) ## accessor-pairs > setter 必须有对应的 getter,getter 可以没有对应的 setter [详情](https://cn.eslint.org/docs/rules/accessor-pairs) ## array-callback-return > 数组的方法除了 forEach 之外,回调函数必须有返回值 [详情](https://cn.eslint.org/docs/rules/array-callback-return) ## block-scoped-var > 将 var 定义的变量视为块作用域,禁止在块外使用 [详情](https://cn.eslint.org/docs/rules/block-scoped-var) ## complexity > 禁止函数的循环复杂度超过 20 [参考](https://en.wikipedia.org/wiki/Cyclomatic_complexity) [详情](https://cn.eslint.org/docs/rules/complexity) ## curly > if 后面必须要有 {,除非是单行 if [详情](https://cn.eslint.org/docs/rules/curly) ## dot-location > 链式调用的时候,点号必须放在第二行开头处,禁止放在第一行结尾处 [详情](https://cn.eslint.org/docs/rules/dot-location) ## eqeqeq > 必须使用 === 或 !==,禁止使用 == 或 !=,与 null 比较时除外 [详情](https://cn.eslint.org/docs/rules/eqeqeq) ## guard-for-in > for in 内部必须有 hasOwnProperty [详情](https://cn.eslint.org/docs/rules/guard-for-in) ## no-caller > 禁止使用 caller 或 callee [详情](https://cn.eslint.org/docs/rules/no-caller) ## no-case-declarations > switch 的 case 内有变量定义的时候,必须使用大括号将 case 内变成一个代码块 [详情](https://cn.eslint.org/docs/rules/no-case-declarations) ## no-eval > 禁止使用 eval [详情](https://cn.eslint.org/docs/rules/no-eval) ## no-extend-native > 禁止修改原生对象 [详情](https://cn.eslint.org/docs/rules/no-extend-native) ## no-extra-bind > 禁止出现没必要的 bind [详情](https://cn.eslint.org/docs/rules/no-extra-bind) ## no-extra-label > 禁止出现没必要的 label [详情](https://cn.eslint.org/docs/rules/no-extra-label) ## no-fallthrough > switch 的 case 内必须有 break, return 或 throw [详情](https://cn.eslint.org/docs/rules/fno-fallthrough) ## no-floating-decimal > 表示小数时,禁止省略 0,比如 .5 [详情](https://cn.eslint.org/docs/rules/no-floating-decimal) ## no-implicit-coercion > 禁止使用 !! ~ 等难以理解的运算符,仅允许使用 !! [详情](https://cn.eslint.org/docs/rules/no-implicit-coercion) ## no-implied-eval > 禁止在 setTimeout 或 setInterval 中传入字符串,如 setTimeout('alert("Hi!")', 100); [详情](https://cn.eslint.org/docs/rules/no-implied-eval) ## no-iterator > 禁止使用 \_\_iterator\_\_ [详情](https://cn.eslint.org/docs/rules/no-iterator) ## no-labels > 禁止使用 label [详情](https://cn.eslint.org/docs/rules/no-labels) ## no-lone-blocks > 禁止使用没必要的 {} 作为代码块 [详情](https://cn.eslint.org/docs/rules/no-lone-blocks) ## no-loop-func > 禁止在循环内的函数中出现循环体条件语句中定义的变量 [详情](https://cn.eslint.org/docs/rules/no-loop-func) ## no-multi-spaces > 禁止出现连续的多个空格,除非是注释前,或对齐对象的属性、变量定义、导入等 [详情](https://cn.eslint.org/docs/rules/no-multi-spaces) ## no-multi-str > 禁止使用 \ 来换行字符串 [详情](https://cn.eslint.org/docs/rules/no-multi-str) ## no-new > 禁止直接 new 一个类而不赋值 [详情](https://cn.eslint.org/docs/rules/no-new) ## no-new-func > 禁止使用 new Function,比如 let x = new Function("a", "b", "return a + b"); [详情](https://cn.eslint.org/docs/rules/no-new-func) ## no-new-wrappers > 禁止使用 new 来生成 String, Number 或 Boolean [详情](https://cn.eslint.org/docs/rules/no-new-wrappers) ## no-octal > 禁止使用 0 开头的数字表示八进制数 [详情](https://cn.eslint.org/docs/rules/no-octal) ## no-octal-escape > 禁止使用八进制的转义符 [详情](https://cn.eslint.org/docs/rules/no-octal-escape) ## no-param-reassign > 禁止对函数的参数重新赋值 [详情](https://cn.eslint.org/docs/rules/no-param-reassign) ## no-proto > 禁止使用 \_\_proto\_\_ [详情](https://cn.eslint.org/docs/rules/no-proto) ## no-redeclare > 禁止重复定义变量 [详情](https://cn.eslint.org/docs/rules/no-redeclare) ## no-return-assign > 禁止在 return 语句里赋值 [详情](https://cn.eslint.org/docs/rules/no-return-assign) ## no-return-await > 禁止在 return 语句里使用 await [详情](https://cn.eslint.org/docs/rules/no-return-await) ## no-self-assign > 禁止将自己赋值给自己 [详情](https://cn.eslint.org/docs/rules/no-self-assign) ## no-self-compare > 禁止将自己与自己比较 [详情](https://cn.eslint.org/docs/rules/no-self-compare) ## no-sequences > 禁止使用逗号操作符 [详情](https://cn.eslint.org/docs/rules/no-sequences) ## no-throw-literal > 禁止 throw 字面量,必须 throw 一个 Error 对象 [详情](https://cn.eslint.org/docs/rules/no-throw-literal) ## no-unmodified-loop-condition > 循环内必须对循环条件的变量有修改 [详情](https://cn.eslint.org/docs/rules/no-unmodified-loop-condition) ## no-unused-expressions > 禁止无用的表达式 [详情](https://cn.eslint.org/docs/rules/no-unused-expressions) ## no-unused-labels > 禁止出现没用的 label [详情](https://cn.eslint.org/docs/rules/no-unused-labels) ## no-useless-call > 禁止出现没必要的 call 或 apply [详情](https://cn.eslint.org/docs/rules/no-useless-call) ## no-useless-catch > 禁止在 catch 中仅仅只是把错误 throw 出去,这样的 catch 是没有意义的,等价于直接执行 try 里的代码 [详情](https://cn.eslint.org/docs/rules/no-useless-catch) ## no-useless-concat > 禁止出现没必要的字符串连接 [详情](https://cn.eslint.org/docs/rules/no-useless-concat) ## no-void > 禁止使用 void [详情](https://cn.eslint.org/docs/rules/no-void) ## no-with > 禁止使用 with [详情](https://cn.eslint.org/docs/rules/no-with) ## prefer-promise-reject-errors > Promise 的 reject 中必须传入 Error 对象,而不是字面量 [详情](https://cn.eslint.org/docs/rules/prefer-promise-reject-errors) ## radix > parseInt 必须传入第二个参数 [详情](https://cn.eslint.org/docs/rules/radix) ## wrap-iife > 立即执行的函数必须符合如下格式 (function () { alert('Hello') })() [详情](https://cn.eslint.org/docs/rules/wrap-iife) ## yoda > 必须使用 if (foo === 5) 而不是 if (5 === foo) [详情](https://cn.eslint.org/docs/rules/yoda) ## strict > 禁止使用 'strict' [详情](https://cn.eslint.org/docs/rules/strict) ## no-label-var > 禁止 label 名称与定义过的变量重复 [详情](https://cn.eslint.org/docs/rules/no-label-var) ## no-shadow-restricted-names > 禁止使用保留字作为变量名 [详情](https://cn.eslint.org/docs/rules/no-shadow-restricted-names) ## no-undef > 禁止使用未定义的变量 [详情](https://cn.eslint.org/docs/rules/no-undef) ## no-undef-init > 禁止将 undefined 赋值给变量 [详情](https://cn.eslint.org/docs/rules/no-undef-init) ## no-unused-vars > 定义过的变量必须使用 [详情](https://cn.eslint.org/docs/rules/no-unused-vars) ## no-use-before-define > 变量必须先定义后使用 [详情](https://cn.eslint.org/docs/rules/no-use-before-define) ## array-bracket-spacing > 数组的括号内的前后禁止有空格 [详情](https://cn.eslint.org/docs/rules/array-bracket-spacing) ## block-spacing > 代码块如果在一行内,那么大括号内的首尾必须有空格 [详情](https://cn.eslint.org/docs/rules/block-spacing) ## comma-spacing > 逗号前禁止有空格,逗号后必须要有空格 [详情](https://cn.eslint.org/docs/rules/comma-spacing) ## comma-style > 禁止在行首写逗号 [详情](https://cn.eslint.org/docs/rules/comma-style) ## computed-property-spacing > 用作对象的计算属性时,中括号内的首尾禁止有空格 [详情](https://cn.eslint.org/docs/rules/computed-property-spacing) ## func-call-spacing > 函数名和执行它的括号之间禁止有空格 [详情](https://cn.eslint.org/docs/rules/func-call-spacing) ## func-name-matching > 函数赋值给变量的时候,函数名必须与变量名一致 [详情](https://cn.eslint.org/docs/rules/func-name-matching) ## function-paren-newline > 函数参数要么同在一行要么每行一个 [详情](https://cn.eslint.org/docs/rules/function-paren-newline) ## jsx-quotes > jsx 中的属性必须用双引号 [详情](https://cn.eslint.org/docs/rules/jsx-quotes) ## key-spacing > 对象字面量中冒号前面禁止有空格,后面必须有空格 [详情](https://cn.eslint.org/docs/rules/key-spacing) ## keyword-spacing > 关键字前后必须有空格 [详情](https://cn.eslint.org/docs/rules/keyword-spacing) ## max-depth > 代码块嵌套的深度禁止超过 5 层 [详情](https://cn.eslint.org/docs/rules/max-depth) ## max-nested-callbacks > 回调函数嵌套禁止超过 3 层,多了请用 async await 替代 [详情](https://cn.eslint.org/docs/rules/max-nested-callbacks) ## max-params > 函数的参数禁止超过 7 个 [详情](https://cn.eslint.org/docs/rules/max-params) ## new-cap > new 后面的类名必须首字母大写 [详情](https://cn.eslint.org/docs/rules/new-cap) ## new-parens > new 后面的类必须有小括号 [详情](https://cn.eslint.org/docs/rules/new-parens) ## no-array-constructor > 禁止使用 Array 构造函数 [详情](https://cn.eslint.org/docs/rules/no-array-constructor) ## no-mixed-spaces-and-tabs > 禁止混用空格和缩进 [详情](https://cn.eslint.org/docs/rules/no-mixed-spaces-and-tabs) ## no-multiple-empty-lines > 禁止出现超过三行的连续空行 [详情](https://cn.eslint.org/docs/rules/no-multiple-empty-lines) ## no-new-object > 禁止直接 new Object [详情](https://cn.eslint.org/docs/rules/no-new-object) ## no-trailing-spaces > 禁止行尾有空格 [详情](https://cn.eslint.org/docs/rules/no-trailing-spaces) ## no-whitespace-before-property > 禁止属性前有空格,比如 foo. bar() [详情](https://cn.eslint.org/docs/rules/no-whitespace-before-property) ## nonblock-statement-body-position > 禁止 if 后面不加大括号而写两行代码 [详情](https://cn.eslint.org/docs/rules/nonblock-statement-body-position) ## object-curly-newline > 大括号内的首尾必须有换行 [详情](https://cn.eslint.org/docs/rules/object-curly-newline) ## object-curly-spacing > 对象字面量只有一行时,大括号内的首尾必须有空格 [详情](https://cn.eslint.org/docs/rules/object-curly-spacing) ## quotes > 必须使用单引号,禁止使用双引号 [详情](https://cn.eslint.org/docs/rules/quotes) ## semi > 结尾必须有分号 [详情](https://cn.eslint.org/docs/rules/semi) ## semi-spacing > 一行有多个语句时,分号前面禁止有空格,分号后面必须有空格 [详情](https://cn.eslint.org/docs/rules/semi-spacing) ## semi-style > 分号必须写在行尾,禁止在行首出现 [详情](https://cn.eslint.org/docs/rules/semi-style) ## space-before-blocks > if, function 等的大括号之前必须要有空格,比如 if (a) { [详情](https://cn.eslint.org/docs/rules/space-before-blocks) ## space-before-function-paren > 命名函数表达式括号前禁止有空格,箭头函数表达式括号前面必须有一个空格 [详情](https://cn.eslint.org/docs/rules/space-before-function-paren) ## space-in-parens > 小括号内的首尾禁止有空格 [详情](https://cn.eslint.org/docs/rules/space-in-parens) ## space-infix-ops > 操作符左右必须有空格 [详情](https://cn.eslint.org/docs/rules/space-infix-ops) ## space-unary-ops > new, typeof 等后面必须有空格,++, -- 等禁止有空格 [详情](https://cn.eslint.org/docs/rules/space-unary-ops) ## spaced-comment > 注释的斜线或 * 后必须有空格 [详情](https://cn.eslint.org/docs/rules/spaced-comment) ## switch-colon-spacing > case 的冒号前禁止有空格,冒号后必须有空格 [详情](https://cn.eslint.org/docs/rules/switch-colon-spacing) ## template-tag-spacing > 模版字符串的 tag 之后禁止有空格,比如 tag\`Hello World\` [详情](https://cn.eslint.org/docs/rules/template-tag-spacing) ## unicode-bom > 文件开头禁止有 BOM [详情](https://cn.eslint.org/docs/rules/unicode-bom) ## arrow-spacing > 箭头函数的箭头前后必须有空格 [详情](https://cn.eslint.org/docs/rules/arrow-spacing) ## constructor-super > constructor 中必须有 super [详情](https://cn.eslint.org/docs/rules/constructor-super) ## generator-star-spacing > generator 的 * 前面禁止有空格,后面必须有空格 [详情](https://cn.eslint.org/docs/rules/generator-star-spacing) ## no-class-assign > 禁止对定义过的 class 重新赋值 [详情](https://cn.eslint.org/docs/rules/no-class-assign) ## no-confusing-arrow > 禁止出现难以理解的箭头函数,比如 let x = a => 1 ? 2 : 3 [详情](https://cn.eslint.org/docs/rules/no-confusing-arrow) ## no-const-assign > 禁止对使用 const 定义的常量重新赋值 [详情](https://cn.eslint.org/docs/rules/no-const-assign) ## no-dupe-class-members > 禁止重复定义类 [详情](https://cn.eslint.org/docs/rules/no-dupe-class-members) ## no-duplicate-imports > 禁止重复导入模块 [详情](https://cn.eslint.org/docs/rules/no-duplicate-imports) ## no-new-symbol > 禁止使用 new 来生成 Symbol [详情](https://cn.eslint.org/docs/rules/no-new-symbol) ## no-this-before-super > 禁止在 super 被调用之前使用 this 或 super [详情](https://cn.eslint.org/docs/rules/no-this-before-super) ## no-useless-computed-key > 禁止出现没必要的计算键名,比如 let a = { ['0']: 0 }; [详情](https://cn.eslint.org/docs/rules/no-useless-computed-key) ## no-useless-constructor > 禁止出现没必要的 constructor,比如 constructor(value) { super(value) } [详情](https://cn.eslint.org/docs/rules/no-useless-constructor) ## no-useless-rename > 禁止解构时出现同样名字的的重命名,比如 let { foo: foo } = bar; [详情](https://cn.eslint.org/docs/rules/no-useless-rename) ## require-yield > generator 函数内必须有 yield [详情](https://cn.eslint.org/docs/rules/require-yield) ## rest-spread-spacing > ... 的后面禁止有空格 [详情](https://cn.eslint.org/docs/rules/rest-spread-spacing) ## symbol-description > 创建 Symbol 时必须传入参数 [详情](https://cn.eslint.org/docs/rules/symbol-description) ## template-curly-spacing > ${name} 内的首尾禁止有空格 [详情](https://cn.eslint.org/docs/rules/template-curly-spacing) ## yield-star-spacing > yield* 后面必须要有空格 [详情](https://cn.eslint.org/docs/rules/yield-star-spacing)