You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"except-parens" (默认) 允许条件语句中出现赋值操作符,前提是它们被圆括号括起来 (例如,在 while 或 do...while 循环条件中,允许赋值给一个变量)
"always" 禁止条件语句中出现赋值语句
默认选项 "except-parens" 的 错误 代码示例:
/*eslint no-cond-assign: "error"*/// Unintentional assignmentvarx;if(x=0){varb=1;}// Practical example that is similar to an errorfunctionsetHeight(someNode){"use strict";do{someNode.height="100px";}while(someNode=someNode.parentNode);}
默认选项 "except-parens" 的 正确 代码示例:
/*eslint no-cond-assign: "error"*/// Assignment replaced by comparisonvarx;if(x===0){varb=1;}// Practical example that wraps the assignment in parenthesesfunctionsetHeight(someNode){"use strict";do{someNode.height="100px";}while((someNode=someNode.parentNode));}// Practical example that wraps the assignment and tests for 'null'functionsetHeight(someNode){"use strict";do{someNode.height="100px";}while((someNode=someNode.parentNode)!==null);}
选项 "always" 的 错误 代码示例:
/*eslint no-cond-assign: ["error", "always"]*/// Unintentional assignmentvarx;if(x=0){varb=1;}// Practical example that is similar to an errorfunctionsetHeight(someNode){"use strict";do{someNode.height="100px";}while(someNode=someNode.parentNode);}// Practical example that wraps the assignment in parenthesesfunctionsetHeight(someNode){"use strict";do{someNode.height="100px";}while((someNode=someNode.parentNode));}// Practical example that wraps the assignment and tests for 'null'functionsetHeight(someNode){"use strict";do{someNode.height="100px";}while((someNode=someNode.parentNode)!==null);}
选项 "always" 的 正确 代码示例:
/*eslint no-cond-assign: ["error", "always"]*/// Assignment replaced by comparisonvarx;if(x===0){varb=1;}
no-console
禁用 console
Rule Details
该规则禁止调用 console 对象的方法。
错误 代码示例:
/*eslint no-console: "error"*/console.log("Log a debug level message.");console.warn("Log a warn level message.");console.error("Log an error level message.");
/*eslint no-dupe-args: "error"*/functionfoo(a,b,a){console.log("value of the second a:",a);}varbar=function(a,b,a){console.log("value of the second a:",a);};
/*eslint no-func-assign: "error"*/varfoo=function(){}foo=bar;functionfoo(foo){// `foo` is shadowed.foo=bar;}functionfoo(){varfoo=bar;// `foo` is shadowed.}
\u000B - Line Tabulation (\v) - <VT>
\u000C - Form Feed (\f) - <FF>
\u00A0 - No-Break Space - <NBSP>
\u0085 - Next Line
\u1680 - Ogham Space Mark
\u180E - Mongolian Vowel Separator - <MVS>
\ufeff - Zero Width No-Break Space - <BOM>
\u2000 - En Quad
\u2001 - Em Quad
\u2002 - En Space - <ENSP>
\u2003 - Em Space - <EMSP>
\u2004 - Tree-Per-Em
\u2005 - Four-Per-Em
\u2006 - Six-Per-Em
\u2007 - Figure Space
\u2008 - Punctuation Space - <PUNCSP>
\u2009 - Thin Space
\u200A - Hair Space
\u200B - Zero Width Space - <ZWSP>
\u2028 - Line Separator
\u2029 - Paragraph Separator
\u202F - Narrow No-Break Space
\u205f - Medium Mathematical Space
\u3000 - Ideographic Space
Options
该规则有例外情况,是个对象:
"skipStrings": true (默认) 允许在字符串字面量中出现任何空白字符
"skipComments": true 允许在注释中出现任何空白字符
"skipRegExps": true 允许在正则表达式中出现任何空白字符
"skipTemplates": true 允许在模板字面量中出现任何空白字符
skipStrings
默认选项 { "skipStrings": true } 的 错误 代码示例:
/*eslint no-irregular-whitespace: "error"*/functionthing()/*<NBSP>*/{return'test';}functionthing(/*<NBSP>*/){return'test';}functionthing/*<NBSP>*/(){return'test';}functionthing/*<MVS>*/(){return'test';}functionthing(){return'test';/*<ENSP>*/}functionthing(){return'test';/*<NBSP>*/}functionthing(){// Description <NBSP>: some descriptive text}/*Description <NBSP>: some descriptive text*/functionthing(){return/<NBSP>regexp/;}/*eslint-env es6*/functionthing(){return`template <NBSP>string`;}
/*eslint no-sparse-arrays: "error"*/
var items = [];
var items = new Array(23);
// trailing comma (after the last element) is not a problem
var colors = [ "red", "blue", ];
/*eslint no-unexpected-multiline: "error"*/
var foo = bar;
(1 || 2).baz();
var foo = bar
;(1 || 2).baz()
var hello = 'world';
[1, 2, 3].forEach(addNumber);
var hello = 'world'
void [1, 2, 3].forEach(addNumber);
let x = function() {};
`hello`
let tag = function() {}
tag `hello`
/*eslint no-unsafe-negation: "error"*/if(!keyinobject){// operator precedence makes it equivalent to (!key) in object// and type conversion makes it equivalent to (key ? "false" : "true") in object}if(!objinstanceofCtor){// operator precedence makes it equivalent to (!obj) instanceof Ctor// and it equivalent to always false since boolean values are not objects.}
正确 代码示例:
/*eslint no-unsafe-negation: "error"*/
if (!(key in object)) {
// key is not in object
}
if (!(obj instanceof Ctor)) {
// obj is not an instance of Ctor
}
if(("" + !key) in object) {
// make operator precedence and type conversion explicit
// in a rare situation when that is the intended meaning
}
/*eslint no-case-declarations: "error"*//*eslint-env es6*/// Declarations outside switch-statements are validconsta=0;switch(foo){// The following case clauses are wrapped into blocks using bracketscase1: {letx=1;break;}case2: {consty=2;break;}case3: {functionf(){}break;}case4:
// Declarations using var without brackets are valid due to function-scope hoistingvarz=4;break;default: {classC{}}}
/*eslint no-self-assign: "error"*/foo=bar;[a,b]=[b,a];// This pattern is warned by the `no-use-before-define` rule.letfoo=foo;// The default values have an effect.[foo=1]=[foo];
/*eslint no-self-assign: [error, {props: true}]*/// self-assignments with properties.obj.a=obj.a;obj.a.b=obj.a.b;obj["a"]=obj["a"];obj[a]=obj[a];
选项 { "props": true } 的 正确 代码示例:
/*eslint no-self-assign: [error, {props: true}]*/// non-self-assignments with properties.obj.a=obj.b;obj.a.b=obj.c.b;obj.a.b=obj.a.c;obj[a]=obj["a"]// This ignores if there is a function call.obj.a().b=obj.a().ba().b=a().b// Known limitation: this does not support computed properties except single literal or single identifier.obj[a+b]=obj[a+b];obj["a"+"b"]=obj["a"+"b"];
/*eslint no-unused-vars: "error"*//*global some_unused_var*/// It checks variables you have defined as globalsome_unused_var=42;varx;// Write-only variables are not considered as used.vary=10;y=5;// A read for a modification of itself is not considered as used.varz=0;z=z+1;// By default, unused arguments cause warnings.(function(foo){return5;})();// Unused recursive functions also cause warnings.functionfact(n){if(n<2)return1;returnn*fact(n-1);}// When a function definition destructures an array, unused entries from the array also cause warnings.functiongetY([x,y]){returny;}
正确 代码示例:
/*eslint no-unused-vars: "error"*/varx=10;alert(x);// foo is considered used heremyFunc(functionfoo(){// ...}.bind(this));(function(foo){returnfoo;})();varmyFunc;myFunc=setTimeout(function(){// myFunc is considered usedmyFunc();},50);// Only the second argument from the descructured array is used.functiongetY([,y]){returny;}
/*eslint no-unused-vars: ["error", { "args": "all" }]*/// 2 errors// "foo" is defined but never used// "baz" is defined but never used(function(foo,bar,baz){returnbar;})();
/*eslint no-unused-vars: ["error", { "ignoreRestSiblings": true }]*/// 'type' is ignored because it has a rest property sibling.var{ type, ...coords}=data;
/*eslint no-unused-vars: ["error", { "caughtErrors": "all" }]*/// 1 error// "err" is defined but never usedtry{//...}catch(err){console.error("errors");}
/*eslint constructor-super: "error"*//*eslint-env es6*/classA{constructor(){super();// This is a SyntaxError.}}classAextendsB{constructor(){}// Would throw a ReferenceError.}// Classes which inherits from a non constructor are always problems.classAextendsnull{constructor(){super();// Would throw a TypeError.}}classAextendsnull{constructor(){}// Would throw a ReferenceError.}
/*eslint no-this-before-super: "error"*//*eslint-env es6*/classA{constructor(){this.a=0;// OK, this class doesn't have an `extends` clause.}}classAextendsB{constructor(){super();this.a=0;// OK, this is after `super()`.}}classAextendsB{foo(){this.a=0;// OK. this is not in a constructor.}}
The text was updated successfully, but these errors were encountered:
ESLint 推荐的rules
no-compare-neg-zero
Rule Details
该规则对试图与 -0 进行比较的代码发出警告,因为并不会达到预期。也就是说像 x === -0 的代码对于 +0 和 -0 都有效。作者可能想要用 Object.is(x, -0)。
错误 代码示例:
正确 代码示例:
no-cond-assign
Rule Details
该规则禁止在 if、for、while 和 do...while 语句中出现模棱两可的赋值操作符。
options
该规则有一个字符串选项:
默认选项 "except-parens" 的 错误 代码示例:
默认选项 "except-parens" 的 正确 代码示例:
选项 "always" 的 错误 代码示例:
选项 "always" 的 正确 代码示例:
no-console
Rule Details
该规则禁止调用 console 对象的方法。
错误 代码示例:
正确 代码示例:
options
该规则有例外情况,是个对象:
选项 { "allow": ["warn", "error"] } 的 正确 代码示例:
When Not To Use It
如果你在使用 Node.js,然后,console 主要用来向用户输出信息,所以不是严格用于调试目的。如果你正在做 Node.js 开发,那么你很可能不想启用此规则。
另一个可能不使用此规则的情况是,如果你想执行控制台调用,而不是控制台重写。例如:
在上面使用 no-console 规则的示例中,ESLint 将报告一个错误。对于上面的例子,你可以禁用该规则:
然而,你可能不希望手动添加 eslint-disable-next-line 或 eslint-disable-line。你可以使用 no-restricted-syntax 规则来实现控制台调用仅接收错误的效果:
no-constant-condition
Rule Details
该规则禁止在以下语句的条件中出现常量表达式:
错误 代码示例:
正确 代码示例:
options
checkLoops
默认为 true。设置该选项为 false 允许在循环中使用常量表达式。
当 checkLoops 为 false 时的 正确 代码示例:
no-control-regex
Rule Details
该规则禁止在正则表达式中出现控制字符。
错误 代码示例:
正确 代码示例:
When Not To Use It
如果你需要使用控制字符进行模式匹配,你应该关闭该规则。
no-debugger
Rule Details
该规则禁止 debugger 语句。
错误 代码示例:
正确 代码示例:
When Not To Use It
如果你的代码在很大程度上仍处于开发阶段,不想担心剥离 debugger 语句,那么就关闭此规则。通常在部署测试代码之前,你会想重新开启此规则。
no-dupe-args
Rule Details
该规则禁止在函数定义或表达中出现重名参数。该规则并不适用于箭头函数或类方法,因为解析器会报告这样的错误。
如果 ESLint 在严格模式下解析代码,解析器(不是该规则)将报告这样的错误。
错误 代码示例:
正确 代码示例:
no-dupe-keys
Rule Details
该规则禁止在对象字面量中出现重复的键。
错误 代码示例:
正确 代码示例:
no-duplicate-case
Rule Details
该规则禁止在 switch 语句中的 case 子句中出现重复的测试表达式。
错误 代码示例:
正确 代码示例:
no-empty
Rule Details
该规则禁止空语句块出现。该规则忽略包含一个注释的语句块(例如,在 try 语句中,一个空的 catch 或 finally 语句块意味着程序应该继续执行,无论是否出现错误)。
错误 代码示例:
正确 代码示例:
Options
该规则有例外情况,是个对象:
allowEmptyCatch
选项 { "allowEmptyCatch": true } 的 正确 代码示例:
When Not To Use It
如果你打算使用空语句块,那么你可以禁用此规则。
no-empty-character-class
Rule Details
该规则禁止在正则表达式中出现空字符集。
错误 代码示例:
正确 代码示例:
Known Limitations
该规则不会报告 RegExp 构造函数的字符串参数中空字符集的使用情况。
当该规则报告了正确代码时,漏报的示例:
no-ex-assign
Rule Details
该规则禁止对 catch 子句中的异常重新赋值。
错误 代码示例:
正确 代码示例:
Further Reading
no-extra-boolean-cast
Rule Details
该规则禁止不必要的布尔类型转换。
错误 代码示例:
正确 代码示例:
no-extra-semi
Rule Details
该规则禁用不必要的分号。
错误 代码示例:
正确 代码示例:
When Not To Use It
如果你有意使用额外的分号,那么你可以禁用此规则。
no-func-assign
Rule Details
该规则禁止对 function 声明重新赋值。
错误 代码示例:
与 JSHint 中对应的规则不同,该规则的 错误 代码示例:
正确 代码示例:
no-inner-declarations
Rule Details
该规则要求函数声明和变量声明(可选的)在程序或函数体的顶部。
Options
该规则有一个字符串选项:
functions
默认选项 "functions" 的 错误 代码示例:
默认选项 "functions" 的 正确 代码示例:
both
选项 "both" 的 错误 代码示例:
选项 "both" 的 正确 代码示例:
When Not To Use It
当 block-scoped functions 出现在 ES6 中时,函数声明的部分规则将被废弃,但在那之前,它应该是行之有效的。当使用 block-scoped-var 规则时或者在嵌套块中声明变量是可以接受的(尽管有变量声明提升)时候,可以不再检测变量声明。
no-invalid-regexp
Rule Details
该规则禁止在 RegExp 构造函数中出现无效的正则表达式。
错误 代码示例:
正确 代码示例:
Environments
ECMAScript 6 为 RegExp 构造函数增加了以下标志参数:
你可以在你的 ESLint 配置 中通过设置 ECMAScript 为 6 ,来使这些标志被有效地识别。
如果你想允许使用额外的标志,也不论出于什么目的,你可以在 .eslintrc 使用 allowConstructorFlags 选项指定它们。这样,不管是否有 ecmaVersion 设置,这些标记将会被该规则忽略。
Options
该规则有例外情况,是个对象:
allowConstructorFlags
选项 { "allowConstructorFlags": ["u", "y"] } 的 正确 代码示例:
Further Reading
no-irregular-whitespace
Rule Details
该规则旨在捕获无效的不是正常的tab和空格的空白。这些字符有的会在现代浏览器中引发问题,其它的会引起调试问题。
该规则禁止出现以下字符,除非该规则选项允许:
Options
该规则有例外情况,是个对象:
skipStrings
默认选项 { "skipStrings": true } 的 错误 代码示例:
默认选项 { "skipStrings": true } 正确 代码示例:
skipComments
选项 { "skipComments": true } 的 正确 代码示例:
skipRegExps
选项 { "skipRegExps": true } 的 正确 代码示例:
skipTemplates
选项 { "skipTemplates": true } 的 正确 代码示例:
When Not To Use It
如果你想在你的应用中使用 tab 和空格之外的空白字符,可以关闭此规则。
no-obj-calls
Rule Details
该规则禁止将 Math、JSON 和 Reflect 对象当作函数进行调用。
错误 代码示例:
正确 代码示例:
no-regex-spaces
Rule Details
该规则禁止在正则表达式字面量中出现多个空格。
错误 代码示例:
正确 代码示例:
no-sparse-arrays
Rule Details
该规则禁止使用稀疏数组,也就是逗号之前没有任何元素的数组。该规则不适用于紧随最后一个元素的拖尾逗号的情况。
错误 代码示例:
正确 代码示例:
no-unexpected-multiline
Rule Details
该规则禁止使用令人困惑的多行表达式。
错误 代码示例:
正确 代码示例:
no-unreachable
Rule Details
该规则禁止在 return、throw、continue 和 break 语句后出现不可达代码。
错误 代码示例:
正确 代码示例,因为 JavaScript 函数和变量提升:
no-unsafe-finally
Rule Details
该规则禁止在 finally 语句块中出现 return、throw、break 和 continue 语句。它允许间接使用,比如在 function 或 class 的定义中。
错误 代码示例:
正确 代码示例:
no-unsafe-negation
Rule Details
该规则禁止对关系运算符的左操作数使用否定操作符。
关系运算符有:
错误 代码示例:
正确 代码示例:
Options
无。
use-isnan
Rule Details
该规则禁止在正则表达式字面量中出现多个空格。
错误 代码示例:
正确 代码示例:
valid-typeof
Rule Details
该规则强制 typeof 表达式与有效的字符串进行比较。
Options
该规则有一个对象选项:
错误 代码示例:
正确 代码示例:
选项 { "requireStringLiterals": true } 的 错误 代码示例:
选项 { "requireStringLiterals": true } 的 正确 代码示例:
no-case-declarations
Rule Details
该规则旨在避免访问未经初始化的词法绑定以及跨 case 语句访问被提升的函数。
错误 代码示例:
正确 代码示例:
no-empty-pattern
Rule Details
此规则目的在于标记出在解构对象和数组中的任何的空模式,每当遇到一个这样的空模式,该规则就会报告一个问题。
错误 代码示例:
正确 代码示例:
no-fallthrough
Rule Details
该规则旨在消除非故意 case 落空行为。因此,它会标记处没有使用注释标明的落空情况。
错误 代码示例:
正确 代码示例:
注意,在上面的例子中,最后的 case 语句,不会引起警告,因为没有可落空的语句了。
Options
该规则接受单个选项参数:
commentPattern
选项 { "commentPattern": "break[\s\w]*omitted" } 的 正确 代码示例:
no-global-assign
Rule Details
该规则禁止修改只读的全局变量。
ESLint 可以配置全局变量为只读。
错误 代码示例:
正确 代码示例:
Options
该规则接受一个 exceptions 选项,可以用来指定允许进行赋值的内置对象列表:
no-octal
Rule Details
该规则禁用八进制字面量。
如果 ESLint 是在严格模式下解析代码,解析器(而不是该规则)会报告错误。
错误 代码示例:
正确 代码示例:
no-redeclare
Rule Details
此规则目旨在消除同一作用域中多次声明同一变量。
错误 代码示例:
正确 代码示例:
Options
该规则有一个选项参数,是个对象,该对象有个布尔属性为 "builtinGlobals"。默认为false。
如果设置为 true,该规则也会检查全局内建对象,比如Object、Array、Number…
builtinGlobals
"builtinGlobals" 选项将会在全局范围检查被重新声明的内置全局变量。
选项 { "builtinGlobals": true } 的 错误 代码示例:
在 browser 环境下,选项 {"builtinGlobals": true} 的 错误 代码示例:
browser 环境有很多内建的全局变量(例如,top)。一些内建的全局变量不能被重新声明。
注意,当使用 node 或 commonjs 环境 (或 ecmaFeatures.globalReturn,如果使用默认解析器)时,则程序的最大作用域不是实际的全局作用域,而是一个模块作用域。当出现这种情况时,声明一个以内置的全局变量命令的变量,不算是重声明,只是遮蔽了全局变量。在这种情况下,应该使用 no-shadow 规则的 "builtinGlobals" 选项。
no-self-assign
Rule Details
该规则旨在消除自身赋值的情况。
错误 代码示例:
正确 代码示例:
Options
该规则也有可以检查属性的选项。
props
选项 { "props": true } 的 错误 代码示例:
选项 { "props": true } 的 正确 代码示例:
no-unused-labels
Rule Details
该规则旨在消除未使用过的标签。
错误 代码示例:
正确 代码示例:
no-useless-escape
Rule Details
该规则标记在不改变代码行为的情况下可以安全移除的转义。
错误 代码示例:
正确 代码示例:
no-delete-var
Rule Details
该规则禁止对变量使用 delete 操作符。
如果 ESLint 是在严格模式下解析代码,解析器(而不是该规则)会报告错误。
错误 代码示例:
no-undef
Rule Details
对任何未声明的变量的引用都会引起一个警告,除非显式地在 /global .../ 注释中指定,或在 globals key in the configuration file 中指定。另一个常见的用例是,你有意使用定义在其他地方的全局变量(例如来自 HTML 的脚本)。
错误 代码示例:
有 global 声明时,该规则的 正确 代码示例:
有 global 声明时,该规则的 错误 代码示例:
默认情况下,/*global */ 中声明的变量是只读的,因此对其进行赋值是错误的。
Options
typeof
默认选项 { "typeof": false } 的 正确 代码示例:
如果想阻止在 typeof 运算中有未申明的变量导致的警告,可以用此项。
选项 { "typeof": true } 的 错误 代码示例:
有 global 声明时,选项 { "typeof": true } 的 正确 代码示例:
Environments
为了方便,ESlint 提供了预定义流行类库和运行时环境暴露的全局变量的快捷方式。该规则支持这些环境,如 指定 Environments 中列出的。使用如下:
browser
browser 环境下的 正确 代码示例:
Node.js
node 环境下的 正确 代码示例:
no-unused-vars
Rule Details
此规则旨在消除未使用过的变量,方法和方法中的参数名,当发现这些存在,发出警告。
符合下面条件的变量被认为是可以使用的:
一个变量仅仅是被赋值为 (var x = 5) 或者是被声明过,则认为它是没被考虑使用。
错误 代码示例:
正确 代码示例:
exported
在 CommonJS 或者 ECMAScript 模块外部,可用 var创建一个被其他模块代码引用的变量。你也可以用 /* exported variableName */ 注释快表明此变量已导出,因此此变量不会被认为是未被使用过的。
需要注意的是 /* exported */ 在下列情况下是无效的:
行注释 // exported variableName 将不起作用,因为 exported 不是特定于行的。
选项 /* exported variableName */ 的 正确 代码示例:
Options
该规则接受一个字符串或者对像类型的参数。字符串设置正如同 vars 一样(如下所示)。
配置项的默认值,变量选项是 all,参数的选项是 after-used 。
vars
此配置项有两个值:
vars: local
选项 { "vars": "local" } 的 正确 代码示例:
varsIgnorePattern
这个 varsIgnorePattern 选项指定了不需要检测的异常:变量名称匹配正则模式。例如,变量的名字包含 ignored 或者 Ignored。
选项 { "varsIgnorePattern": "[iI]gnored" } 的 正确 代码示例:
args
args 选项有三个值:
args: after-used
选项 { "args": "after-used" } 的 错误 代码示例:
选项 { "args": "after-used" } 的 正确 代码示例:
args: all
选项 { "args": "all" } 的 错误 代码示例:
args: none
选项 { "args": "none" } 的 正确 代码示例:
ignoreRestSiblings
ignoreRestSiblings 选项是个布尔类型 (默认: false)。使用 Rest 属性 可能会“省略”对象中的属性,但是默认情况下,其兄弟属性被标记为 “unused”。使用该选项可以使 rest 属性的兄弟属性被忽略。
选项 { "ignoreRestSiblings": true } 的 正确 代码示例:
argsIgnorePattern
argsIgnorePattern 选项指定排除不需要检测:这些参数的名字符合正则匹配。例如,下划线开头的变量。
选项 { "argsIgnorePattern": "^_" } 的 正确 代码示例:
caughtErrors
caughtErrors 选项被用来验证 catch 块的参数。
它有两个设置:
caughtErrors: none
没有指定该规则,相当于将它赋值为 none。
选项 { "caughtErrors": "none" } 的 正确 代码示例:
caughtErrors: all
选项 { "caughtErrors": "all" } 的 错误 代码示例:
caughtErrorsIgnorePattern
caughtErrorsIgnorePattern 选项指定例外情况,不会检查匹配正则表达式 catch 参数。例如,名字以 ‘ignore’ 开头的变量。
选项 { "caughtErrorsIgnorePattern": "^ignore" } 的 正确 代码示例:
no-mixed-spaces-and-tabs
Rule Details
该规则禁止使用 空格 和 tab 混合缩进。
错误 代码示例:
正确 代码示例:
Options
该规则有一个字符串选项。
smart-tabs
选项 "smart-tabs" 的 正确 代码示例:
constructor-super
Rule Details
该规则旨在标记无效或缺失的 super() 调用。
错误 代码示例:
正确 代码示例:
no-class-assign
Rule Details
该规则旨在标记类声明中变量的修改情况。
错误 代码示例:
正确 代码示例:
no-const-assign
Rule Details
该规则旨在标记修改用const关键字声明的变量。
错误 代码示例:
正确 代码示例:
no-dupe-class-members
Rule Details
该规则旨在标记类成员中重复名称的使用。
错误 代码示例:
正确 代码示例:
no-new-symbol
Rule Details
该规则旨在阻止使用 new 操作符调用 Symbol。
错误 代码示例:
正确 代码示例:
no-this-before-super
Rule Details
该规则旨在标记出在调用 super() 之前使用 this 或 super 的情况。
错误 代码示例:
正确 代码示例:
The text was updated successfully, but these errors were encountered: