Rules
Rules in ESLint are grouped by category to help you understand their purpose.
为了让你对规则有个更好的理解,ESLint 对其进行了分门别类。
No rules are enabled by default. The "extends": "eslint:recommended" property in a configuration file enables rules that report common problems, which have a check mark  below.
所有的规则默认都是禁用的。在配置文件中,使用 "extends": "eslint:recommended" 来启用推荐的规则,报告一些常见的问题,在下文中这些推荐的规则都带有一个标记。
The --fix option on the command line automatically fixes problems (currently mostly whitespace) reported by rules which have a wrench  below.
命令行的 --fix 选项用来自动修复规则所报告的问题(目前,大部分是对空白的修复),在下文中会有一个的图标。
Possible Errors
These rules relate to possible syntax or logic errors in JavaScript code:
这些规则与 JavaScript 代码中可能的错误或逻辑错误有关:
| 
         enforce “for” loop update clause moving the counter in the right direction.  | 
|||
| 
         强制 “for” 循环中更新子句的计数器朝着正确的方向移动  | 
|||
| 
         enforce   | 
|||
| 
         强制 getter 函数中出现   | 
|||
| 
         disallow using an async function as a Promise executor  | 
|||
| 
         禁止使用异步函数作为 Promise executor  | 
|||
| 
         disallow   | 
|||
| 
         禁止在循环中出现   | 
|||
| 
         disallow comparing against -0  | 
|||
| 
         禁止与 -0 进行比较  | 
|||
| 
         disallow assignment operators in conditional expressions  | 
|||
| 
         禁止条件表达式中出现赋值操作符  | 
|||
| 
         disallow the use of   | 
|||
| 
         禁用   | 
|||
| 
         disallow constant expressions in conditions  | 
|||
| 
         禁止在条件中使用常量表达式  | 
|||
| 
         disallow control characters in regular expressions  | 
|||
| 
         禁止在正则表达式中使用控制字符  | 
|||
| 
         disallow the use of   | 
|||
| 
         禁用   | 
|||
| 
         disallow duplicate arguments in   | 
|||
| 
         禁止   | 
|||
| 
         disallow duplicate keys in object literals  | 
|||
| 
         禁止对象字面量中出现重复的 key  | 
|||
| 
         disallow duplicate case labels  | 
|||
| 
         禁止出现重复的 case 标签  | 
|||
| 
         disallow empty block statements  | 
|||
| 
         禁止出现空语句块  | 
|||
| 
         disallow empty character classes in regular expressions  | 
|||
| 
         禁止在正则表达式中使用空字符集  | 
|||
| 
         disallow reassigning exceptions in   | 
|||
| 
         禁止对   | 
|||
| 
         disallow unnecessary boolean casts  | 
|||
| 
         禁止不必要的布尔转换  | 
|||
| 
         disallow unnecessary parentheses  | 
|||
| 
         禁止不必要的括号  | 
|||
| 
         disallow unnecessary semicolons  | 
|||
| 
         禁止不必要的分号  | 
|||
| 
         disallow reassigning   | 
|||
| 
         禁止对   | 
|||
| 
         disallow variable or   | 
|||
| 
         禁止在嵌套的块中出现变量声明或   | 
|||
| 
         disallow invalid regular expression strings in   | 
|||
| 
         禁止   | 
|||
| 
         disallow irregular whitespace  | 
|||
| 
         禁止不规则的空白  | 
|||
| 
         disallow characters which are made with multiple code points in character class syntax  | 
|||
| 
         不允许在字符类语法中出现由多个代码点组成的字符  | 
|||
| 
         disallow calling global object properties as functions  | 
|||
| 
         禁止把全局对象作为函数调用  | 
|||
| 
         disallow calling some   | 
|||
| 
         禁止直接调用   | 
|||
| 
         disallow multiple spaces in regular expressions  | 
|||
| 
         禁止正则表达式字面量中出现多个空格  | 
|||
| 
         disallow sparse arrays  | 
|||
| 
         禁用稀疏数组  | 
|||
| 
         disallow template literal placeholder syntax in regular strings  | 
|||
| 
         禁止在常规字符串中出现模板字面量占位符语法  | 
|||
| 
         disallow confusing multiline expressions  | 
|||
| 
         禁止出现令人困惑的多行表达式  | 
|||
| 
         disallow unreachable code after   | 
|||
| 
         禁止在   | 
|||
| 
         disallow control flow statements in   | 
|||
| 
         禁止在   | 
|||
| 
         disallow negating the left operand of relational operators  | 
|||
| 
         禁止对关系运算符的左操作数使用否定操作符  | 
|||
| 
         disallow assignments that can lead to race conditions due to usage of   | 
|||
| 
         禁止由于   | 
|||
| 
         require calls to   | 
|||
| 
         要求使用   | 
|||
| 
         enforce comparing   | 
|||
| 
         强制   | 
Best Practices
These rules relate to better ways of doing things to help you avoid problems:
这些规则是关于最佳实践的,帮助你避免一些问题
| 
         enforce getter and setter pairs in objects  | 
|||
| 
         强制 getter 和 setter 在对象中成对出现  | 
|||
| 
         enforce   | 
|||
| 
         强制数组方法的回调函数中有   | 
|||
| 
         enforce the use of variables within the scope they are defined  | 
|||
| 
         强制把变量的使用限制在其定义的作用域范围内  | 
|||
| 
         enforce that class methods utilize   | 
|||
| 
         强制类方法使用   | 
|||
| 
         enforce a maximum cyclomatic complexity allowed in a program  | 
|||
| 
         指定程序中允许的最大环路复杂度  | 
|||
| 
         require   | 
|||
| 
         要求   | 
|||
| 
         enforce consistent brace style for all control statements  | 
|||
| 
         强制所有控制语句使用一致的括号风格  | 
|||
| 
         require   | 
|||
| 
         要求   | 
|||
| 
         enforce consistent newlines before and after dots  | 
|||
| 
         强制在点号之前和之后一致的换行  | 
|||
| 
         enforce dot notation whenever possible  | 
|||
| 
         强制尽可能地使用点号  | 
|||
| 
         require the use of   | 
|||
| 
         要求使用   | 
|||
| 
         require   | 
|||
| 
         要求   | 
|||
| 
         enforce a maximum number of classes per file  | 
|||
| 
         强制每个文件中包含的的类的最大数量  | 
|||
| 
         disallow the use of   | 
|||
| 
         禁用   | 
|||
| 
         disallow the use of   | 
|||
| 
         禁用   | 
|||
| 
         disallow lexical declarations in case clauses  | 
|||
| 
         不允许在 case 子句中使用词法声明  | 
|||
| 
         disallow division operators explicitly at the beginning of regular expressions  | 
|||
| 
         禁止除法操作符显式的出现在正则表达式开始的位置  | 
|||
| 
         disallow   | 
|||
| 
         禁止   | 
|||
| 
         disallow empty functions  | 
|||
| 
         禁止出现空函数  | 
|||
| 
         disallow empty destructuring patterns  | 
|||
| 
         禁止使用空解构模式  | 
|||
| 
         disallow   | 
|||
| 
         禁止在没有类型检查操作符的情况下与   | 
|||
| 
         disallow the use of   | 
|||
| 
         禁用   | 
|||
| 
         disallow extending native types  | 
|||
| 
         禁止扩展原生类型  | 
|||
| 
         disallow unnecessary calls to   | 
|||
| 
         禁止不必要的   | 
|||
| 
         disallow unnecessary labels  | 
|||
| 
         禁用不必要的标签  | 
|||
| 
         disallow fallthrough of   | 
|||
| 
         禁止   | 
|||
| 
         disallow leading or trailing decimal points in numeric literals  | 
|||
| 
         禁止数字字面量中使用前导和末尾小数点  | 
|||
| 
         disallow assignments to native objects or read-only global variables  | 
|||
| 
         禁止对原生对象或只读的全局对象进行赋值  | 
|||
| 
         disallow shorthand type conversions  | 
|||
| 
         禁止使用短符号进行类型转换  | 
|||
| 
         disallow variable and   | 
|||
| 
         禁止在全局范围内使用变量声明和   | 
|||
| 
         disallow the use of   | 
|||
| 
         禁止使用类似   | 
|||
| 
         disallow   | 
|||
| 
         禁止   | 
|||
| 
         disallow the use of the   | 
|||
| 
         禁用   | 
|||
| 
         disallow labeled statements  | 
|||
| 
         禁用标签语句  | 
|||
| 
         disallow unnecessary nested blocks  | 
|||
| 
         禁用不必要的嵌套块  | 
|||
| 
         disallow function declarations that contain unsafe references inside loop statements  | 
|||
| 
         禁止在循环语句中出现包含不安全引用的函数声明  | 
|||
| 
         disallow magic numbers  | 
|||
| 
         禁用魔术数字  | 
|||
| 
         disallow multiple spaces  | 
|||
| 
         禁止使用多个空格  | 
|||
| 
         disallow multiline strings  | 
|||
| 
         禁止使用多行字符串  | 
|||
| 
         disallow   | 
|||
| 
         禁止使用   | 
|||
| 
         disallow   | 
|||
| 
         禁止对   | 
|||
| 
         disallow   | 
|||
| 
         禁止对   | 
|||
| 
         disallow octal literals  | 
|||
| 
         禁用八进制字面量  | 
|||
| 
         disallow octal escape sequences in string literals  | 
|||
| 
         禁止在字符串中使用八进制转义序列  | 
|||
| 
         disallow reassigning   | 
|||
| 
         禁止对   | 
|||
| 
         disallow the use of the   | 
|||
| 
         禁用   | 
|||
| 
         disallow variable redeclaration  | 
|||
| 
         禁止多次声明同一变量  | 
|||
| 
         disallow certain properties on certain objects  | 
|||
| 
         禁止使用对象的某些属性  | 
|||
| 
         disallow assignment operators in   | 
|||
| 
         禁止在   | 
|||
| 
         disallow unnecessary   | 
|||
| 
         禁用不必要的   | 
|||
| 
         disallow   | 
|||
| 
         禁止使用   | 
|||
| 
         disallow assignments where both sides are exactly the same  | 
|||
| 
         禁止自我赋值  | 
|||
| 
         disallow comparisons where both sides are exactly the same  | 
|||
| 
         禁止自身比较  | 
|||
| 
         disallow comma operators  | 
|||
| 
         禁用逗号操作符  | 
|||
| 
         disallow throwing literals as exceptions  | 
|||
| 
         禁止抛出异常字面量  | 
|||
| 
         disallow unmodified loop conditions  | 
|||
| 
         禁用一成不变的循环条件  | 
|||
| 
         disallow unused expressions  | 
|||
| 
         禁止出现未使用过的表达式  | 
|||
| 
         disallow unused labels  | 
|||
| 
         禁用出现未使用过的标  | 
|||
| 
         disallow unnecessary calls to   | 
|||
| 
         禁止不必要的   | 
|||
| 
         disallow unnecessary   | 
|||
| 
         禁止不必要的   | 
|||
| 
         disallow unnecessary concatenation of literals or template literals  | 
|||
| 
         禁止不必要的字符串字面量或模板字面量的连接  | 
|||
| 
         disallow unnecessary escape characters  | 
|||
| 
         禁用不必要的转义字符  | 
|||
| 
         disallow redundant return statements  | 
|||
| 
         禁止多余的 return 语句  | 
|||
| 
         disallow   | 
|||
| 
         禁用   | 
|||
| 
         disallow specified warning terms in comments  | 
|||
| 
         禁止在注释中使用特定的警告术语  | 
|||
| 
         disallow   | 
|||
| 
         禁用   | 
|||
| 
         enforce using named capture group in regular expression  | 
|||
| 
         建议在正则表达式中使用命名捕获组  | 
|||
| 
         require using Error objects as Promise rejection reasons  | 
|||
| 
         要求使用 Error 对象作为 Promise 拒绝的原因  | 
|||
| 
         enforce the consistent use of the radix argument when using   | 
|||
| 
         强制在   | 
|||
| 
         disallow async functions which have no   | 
|||
| 
         禁止使用不带   | 
|||
| 
         enforce the use of   | 
|||
| 
         强制在 RegExp 上使用   | 
|||
| 
         require   | 
|||
| 
         要求所有的   | 
|||
| 
         require parentheses around immediate   | 
|||
| 
         要求 IIFE 使用括号括起来  | 
|||
| 
         require or disallow “Yoda” conditions  | 
|||
| 
         要求或禁止 “Yoda” 条件  | 
Strict Mode
These rules relate to strict mode directives:
该规则与使用严格模式和严格模式指令有关:
| 
         require or disallow strict mode directives  | 
|||
| 
         要求或禁止使用严格模式指令  | 
Variables
These rules relate to variable declarations:
这些规则与变量声明有关:
| 
         require or disallow initialization in variable declarations  | 
|||
| 
         要求或禁止   | 
|||
| 
         disallow deleting variables  | 
|||
| 
         禁止删除变量  | 
|||
| 
         disallow labels that share a name with a variable  | 
|||
| 
         不允许标签与变量同名  | 
|||
| 
         disallow specified global variables  | 
|||
| 
         禁用特定的全局变量  | 
|||
| 
         disallow variable declarations from shadowing variables declared in the outer scope  | 
|||
| 
         禁止变量声明与外层作用域的变量同名  | 
|||
| 
         disallow identifiers from shadowing restricted names  | 
|||
| 
         禁止将标识符定义为受限的名字  | 
|||
| 
         disallow the use of undeclared variables unless mentioned in   | 
|||
| 
         禁用未声明的变量,除非它们在   | 
|||
| 
         disallow initializing variables to   | 
|||
| 
         禁止将变量初始化为   | 
|||
| 
         disallow the use of   | 
|||
| 
         禁止将   | 
|||
| 
         disallow unused variables  | 
|||
| 
         禁止出现未使用过的变量  | 
|||
| 
         disallow the use of variables before they are defined  | 
|||
| 
         禁止在变量定义之前使用它们  | 
Node.js and CommonJS
These rules relate to code running in Node.js, or in browsers with CommonJS:
这些规则是关于Node.js 或 在浏览器中使用CommonJS 的:
| 
         require   | 
|||
| 
         强制数组方法的回调函数中有   | 
|||
| 
         require   | 
|||
| 
         要求   | 
|||
| 
         require error handling in callbacks  | 
|||
| 
         要求回调函数中有容错处理  | 
|||
| 
         disallow use of the   | 
|||
| 
         禁用   | 
|||
| 
         disallow   | 
|||
| 
         禁止混合常规变量声明和   | 
|||
| 
         disallow   | 
|||
| 
         禁止调用   | 
|||
| 
         disallow string concatenation with   | 
|||
| 
         禁止对   | 
|||
| 
         disallow the use of   | 
|||
| 
         禁用   | 
|||
| 
         disallow the use of   | 
|||
| 
         禁用   | 
|||
| 
         disallow specified modules when loaded by   | 
|||
| 
         禁用通过   | 
|||
| 
         disallow synchronous methods  | 
|||
| 
         禁用同步方法  | 
Stylistic Issues
These rules relate to style guidelines, and are therefore quite subjective:
这些规则是关于风格指南的,而且是非常主观的:
| 
         enforce linebreaks after opening and before closing array brackets  | 
|||
| 
         在数组开括号后和闭括号前强制换行  | 
|||
| 
         enforce consistent spacing inside array brackets  | 
|||
| 
         强制数组方括号中使用一致的空格  | 
|||
| 
         enforce line breaks after each array element  | 
|||
| 
         强制数组元素间出现换行  | 
|||
| 
         disallow or enforce spaces inside of blocks after opening block and before closing block  | 
|||
| 
         禁止或强制在代码块中开括号前和闭括号后有空格  | 
|||
| 
         enforce consistent brace style for blocks  | 
|||
| 
         强制在代码块中使用一致的大括号风格  | 
|||
| 
         enforce camelcase naming convention  | 
|||
| 
         强制使用骆驼拼写法命名约定  | 
|||
| 
         enforce or disallow capitalization of the first letter of a comment  | 
|||
| 
         强制或禁止对注释的第一个字母大写  | 
|||
| 
         require or disallow trailing commas  | 
|||
| 
         要求或禁止末尾逗号  | 
|||
| 
         enforce consistent spacing before and after commas  | 
|||
| 
         强制在逗号前后使用一致的空格  | 
|||
| 
         enforce consistent comma style  | 
|||
| 
         强制使用一致的逗号风格  | 
|||
| 
         enforce consistent spacing inside computed property brackets  | 
|||
| 
         强制在计算的属性的方括号中使用一致的空格  | 
|||
| 
         enforce consistent naming when capturing the current execution context  | 
|||
| 
         当获取当前执行环境的上下文时,强制使用一致的命名  | 
|||
| 
         require or disallow newline at the end of files  | 
|||
| 
         要求或禁止文件末尾存在空行  | 
|||
| 
         require or disallow spacing between function identifiers and their invocations  | 
|||
| 
         要求或禁止在函数标识符和其调用之间有空格  | 
|||
| 
         require function names to match the name of the variable or property to which they are assigned  | 
|||
| 
         要求函数名与赋值给它们的变量名或属性名相匹配  | 
|||
| 
         require or disallow named   | 
|||
| 
         要求或禁止使用命名的   | 
|||
| 
         enforce the consistent use of either   | 
|||
| 
         强制一致地使用   | 
|||
| 
         enforce consistent line breaks inside function parentheses  | 
|||
| 
         强制在函数括号内使用一致的换行  | 
|||
| 
         disallow specified identifiers  | 
|||
| 
         禁用指定的标识符  | 
|||
| 
         enforce minimum and maximum identifier lengths  | 
|||
| 
         强制标识符的最小和最大长度  | 
|||
| 
         require identifiers to match a specified regular expression  | 
|||
| 
         要求标识符匹配一个指定的正则表达式  | 
|||
| 
         enforce the location of arrow function bodies  | 
|||
| 
         强制隐式返回的箭头函数体的位置  | 
|||
| 
         enforce consistent indentation  | 
|||
| 
         强制使用一致的缩进  | 
|||
| 
         enforce the consistent use of either double or single quotes in JSX attributes  | 
|||
| 
         强制在 JSX 属性中一致地使用双引号或单引号  | 
|||
| 
         enforce consistent spacing between keys and values in object literal properties  | 
|||
| 
         强制在对象字面量的属性中键和值之间使用一致的间距  | 
|||
| 
         enforce consistent spacing before and after keywords  | 
|||
| 
         强制在关键字前后使用一致的空格  | 
|||
| 
         enforce position of line comments  | 
|||
| 
         强制行注释的位置  | 
|||
| 
         enforce consistent linebreak style  | 
|||
| 
         强制使用一致的换行风格  | 
|||
| 
         require empty lines around comments  | 
|||
| 
         要求在注释周围有空行  | 
|||
| 
         require or disallow an empty line between class members  | 
|||
| 
         要求或禁止类成员之间出现空行  | 
|||
| 
         enforce a maximum depth that blocks can be nested  | 
|||
| 
         强制可嵌套的块的最大深度  | 
|||
| 
         enforce a maximum line length  | 
|||
| 
         强制一行的最大长度  | 
|||
| 
         enforce a maximum number of lines per file  | 
|||
| 
         强制最大行数  | 
|||
| 
         enforce a maximum number of line of code in a function  | 
|||
| 
         强制函数最大代码行数  | 
|||
| 
         enforce a maximum depth that callbacks can be nested  | 
|||
| 
         强制回调函数最大嵌套深度  | 
|||
| 
         enforce a maximum number of parameters in function definitions  | 
|||
| 
         强制函数定义中最多允许的参数数量  | 
|||
| 
         enforce a maximum number of statements allowed in function blocks  | 
|||
| 
         强制函数块最多允许的的语句数量  | 
|||
| 
         enforce a maximum number of statements allowed per line  | 
|||
| 
         强制每一行中所允许的最大语句数量  | 
|||
| 
         enforce a particular style for multiline comments  | 
|||
| 
         强制对多行注释使用特定风格  | 
|||
| 
         enforce newlines between operands of ternary expressions  | 
|||
| 
         要求或禁止在三元操作数中间换行  | 
|||
| 
         require constructor names to begin with a capital letter  | 
|||
| 
         要求构造函数首字母大写  | 
|||
| 
         enforce or disallow parentheses when invoking a constructor with no arguments  | 
|||
| 
         强制或禁止调用无参构造函数时有圆括号  | 
|||
| 
         require a newline after each call in a method chain  | 
|||
| 
         要求方法链中每个调用都有一个换行符  | 
|||
| 
         disallow   | 
|||
| 
         禁用   | 
|||
| 
         disallow bitwise operators  | 
|||
| 
         禁用按位运算符  | 
|||
| 
         disallow   | 
|||
| 
         禁用   | 
|||
| 
         disallow inline comments after code  | 
|||
| 
         禁止在代码后使用内联注释  | 
|||
| 
         disallow   | 
|||
| 
         禁止   | 
|||
| 
         disallow mixed binary operators  | 
|||
| 
         禁止混合使用不同的操作符  | 
|||
| 
         disallow mixed spaces and tabs for indentation  | 
|||
| 
         禁止空格和 tab 的混合缩进  | 
|||
| 
         disallow use of chained assignment expressions  | 
|||
| 
         禁止连续赋值  | 
|||
| 
         disallow multiple empty lines  | 
|||
| 
         禁止出现多行空行  | 
|||
| 
         disallow negated conditions  | 
|||
| 
         禁用否定的表达式  | 
|||
| 
         disallow nested ternary expressions  | 
|||
| 
         禁用嵌套的三元表达式  | 
|||
| 
         disallow   | 
|||
| 
         禁用   | 
|||
| 
         disallow the unary operators   | 
|||
| 
         禁用一元操作符   | 
|||
| 
         disallow specified syntax  | 
|||
| 
         禁用特定的语法  | 
|||
| 
         disallow all tabs  | 
|||
| 
         禁用 tab  | 
|||
| 
         disallow ternary operators  | 
|||
| 
         禁用三元操作符  | 
|||
| 
         disallow trailing whitespace at the end of lines  | 
|||
| 
         禁用行尾空格  | 
|||
| 
         disallow dangling underscores in identifiers  | 
|||
| 
         禁止标识符中有悬空下划线  | 
|||
| 
         disallow ternary operators when simpler alternatives exist  | 
|||
| 
         禁止可以在有更简单的可替代的表达式时使用三元操作符  | 
|||
| 
         disallow whitespace before properties  | 
|||
| 
         禁止属性前有空白  | 
|||
| 
         enforce the location of single-line statements  | 
|||
| 
         强制单个语句的位置  | 
|||
| 
         enforce consistent line breaks inside braces  | 
|||
| 
         强制大括号内换行符的一致性  | 
|||
| 
         enforce consistent spacing inside braces  | 
|||
| 
         强制在大括号中使用一致的空格  | 
|||
| 
         enforce placing object properties on separate lines  | 
|||
| 
         强制将对象的属性放在不同的行上  | 
|||
| 
         enforce variables to be declared either together or separately in functions  | 
|||
| 
         强制函数中的变量要么一起声明要么分开声明  | 
|||
| 
         require or disallow newlines around variable declarations  | 
|||
| 
         要求或禁止在变量声明周围换行  | 
|||
| 
         require or disallow assignment operator shorthand where possible  | 
|||
| 
         要求或禁止在可能的情况下使用简化的赋值操作符  | 
|||
| 
         enforce consistent linebreak style for operators  | 
|||
| 
         强制操作符使用一致的换行符  | 
|||
| 
         require or disallow padding within blocks  | 
|||
| 
         要求或禁止块内填充  | 
|||
| 
         require or disallow padding lines between statements  | 
|||
| 
         要求或禁止在语句间填充空行  | 
|||
| 
         disallow using Object.assign with an object literal as the first argument and prefer the use of object spread instead.  | 
|||
| 
         禁止使用以对象字面量作为第一个参数的 Object.assign,优先使用对象扩展。  | 
|||
| 
         require quotes around object literal property names  | 
|||
| 
         要求对象字面量属性名称用引号括起来  | 
|||
| 
         enforce the consistent use of either backticks, double, or single quotes  | 
|||
| 
         强制使用一致的反勾号、双引号或单引号  | 
|||
| 
         require or disallow semicolons instead of ASI  | 
|||
| 
         要求或禁止使用分号代替 ASI  | 
|||
| 
         enforce consistent spacing before and after semicolons  | 
|||
| 
         强制分号之前和之后使用一致的空格  | 
|||
| 
         enforce location of semicolons  | 
|||
| 
         强制分号的位置  | 
|||
| 
         require object keys to be sorted  | 
|||
| 
         要求对象属性按序排列  | 
|||
| 
         require variables within the same declaration block to be sorted  | 
|||
| 
         要求同一个声明块中的变量按顺序排列  | 
|||
| 
         enforce consistent spacing before blocks  | 
|||
| 
         强制在块之前使用一致的空格  | 
|||
| 
         enforce consistent spacing before   | 
|||
| 
         强制在   | 
|||
| 
         enforce consistent spacing inside parentheses  | 
|||
| 
         强制在圆括号内使用一致的空格  | 
|||
| 
         require spacing around infix operators  | 
|||
| 
         要求操作符周围有空格  | 
|||
| 
         enforce consistent spacing before or after unary operators  | 
|||
| 
         强制在一元操作符前后使用一致的空格  | 
|||
| 
         enforce consistent spacing after the   | 
|||
| 
         强制在注释中   | 
|||
| 
         enforce spacing around colons of switch statements  | 
|||
| 
         强制在 switch 的冒号左右有空格  | 
|||
| 
         require or disallow spacing between template tags and their literals  | 
|||
| 
         要求或禁止在模板标记和它们的字面量之间有空格  | 
|||
| 
         require or disallow Unicode byte order mark (BOM)  | 
|||
| 
         要求或禁止 Unicode 字节顺序标记 (BOM)  | 
|||
| 
         require parenthesis around regex literals  | 
|||
| 
         要求正则表达式被括号括起来  | 
ECMAScript 6
These rules relate to ES6, also known as ES2015:
这些规则只与 ES6 有关, 即通常所说的 ES2015:
| 
         require braces around arrow function bodies  | 
|||
| 
         要求箭头函数体使用大括号  | 
|||
| 
         require parentheses around arrow function arguments  | 
|||
| 
         要求箭头函数的参数使用圆括号  | 
|||
| 
         enforce consistent spacing before and after the arrow in arrow functions  | 
|||
| 
         强制箭头函数的箭头前后使用一致的空格  | 
|||
| 
         require   | 
|||
| 
         要求在构造函数中有   | 
|||
| 
         enforce consistent spacing around   | 
|||
| 
         强制 generator 函数中   | 
|||
| 
         disallow reassigning class members  | 
|||
| 
         禁止修改类声明的变量  | 
|||
| 
         disallow arrow functions where they could be confused with comparisons  | 
|||
| 
         禁止在可能与比较操作符相混淆的地方使用箭头函数  | 
|||
| 
         disallow reassigning   | 
|||
| 
         禁止修改   | 
|||
| 
         disallow duplicate class members  | 
|||
| 
         禁止类成员中出现重复的名称  | 
|||
| 
         disallow duplicate module imports  | 
|||
| 
         禁止重复模块导入  | 
|||
| 
         disallow   | 
|||
| 
         禁止   | 
|||
| 
         disallow specified modules when loaded by   | 
|||
| 
         禁止使用指定的   | 
|||
| 
         disallow   | 
|||
| 
         禁止在构造函数中,在调用   | 
|||
| 
         disallow unnecessary computed property keys in object literals  | 
|||
| 
         禁止在对象中使用不必要的计算属性  | 
|||
| 
         disallow unnecessary constructors  | 
|||
| 
         禁用不必要的构造函数  | 
|||
| 
         disallow renaming import, export, and destructured assignments to the same name  | 
|||
| 
         禁止在 import 和 export 和解构赋值时将引用重命名为相同的名字  | 
|||
| 
         require   | 
|||
| 
         要求使用   | 
|||
| 
         require or disallow method and property shorthand syntax for object literals  | 
|||
| 
         要求或禁止对象字面量中方法和属性使用简写语法  | 
|||
| 
         require using arrow functions for callbacks  | 
|||
| 
         要求回调函数使用箭头函数  | 
|||
| 
         require   | 
|||
| 
         要求使用   | 
|||
| 
         require destructuring from arrays and/or objects  | 
|||
| 
         优先使用数组和对象解构  | 
|||
| 
         disallow   | 
|||
| 
         禁用   | 
|||
| 
         require rest parameters instead of   | 
|||
| 
         要求使用剩余参数而不是   | 
|||
| 
         require spread operators instead of   | 
|||
| 
         要求使用扩展运算符而非   | 
|||
| 
         require template literals instead of string concatenation  | 
|||
| 
         要求使用模板字面量而非字符串连接  | 
|||
| 
         require generator functions to contain   | 
|||
| 
         要求 generator 函数内有   | 
|||
| 
         enforce spacing between rest and spread operators and their expressions  | 
|||
| 
         强制剩余和扩展运算符及其表达式之间有空格  | 
|||
| 
         enforce sorted import declarations within modules  | 
|||
| 
         强制模块内的 import 排序  | 
|||
| 
         require symbol descriptions  | 
|||
| 
         要求 symbol 描述  | 
|||
| 
         require or disallow spacing around embedded expressions of template strings  | 
|||
| 
         要求或禁止模板字符串中的嵌入表达式周围空格的使用  | 
|||
| 
         require or disallow spacing around the   | 
|||
| 
         强制在   | 
Deprecated
These rules have been deprecated in accordance with the deprecation policy, and replaced by newer rules:
| Deprecated rule | Replaced by | 
|---|---|
| 
           (no replacement)  | 
|
| 
           (no replacement)  | 
|
| 
           (no replacement)  | 
Removed
These rules from older versions of ESLint (before the deprecation policy existed) have been replaced by newer rules:
| Removed rule | Replaced by | 
|---|---|
ESLint