UNPKG

eslint-config-alloy

Version:
509 lines (508 loc) 54.7 kB
{ "__iterator__ 是一个已废弃的属性\n使用 [Symbol.iterator] 替代它": "__iterator__ 是一个已废弃的属性\n使用 [Symbol.iterator] 替代它", "__proto__ 是已废弃的语法": "__proto__ 是已废弃的语法", "<></> 不需要额外引入 Fragment 组件": "<></> 不需要额外引入 Fragment 组件", "<button> 必须有 type 属性": "Forbid \"button\" element without an explicit \"type\" attribute", "<component> 必须有绑定的组件": "require `v-bind:is` of `<component>` elements", "<Type> 容易被理解为 jsx": "<Type> 容易被理解为 jsx", "async 函数中必须存在 await 语句": "Disallow async functions which have no `await` expression", "async 函数的返回值必须是 Promise": "Requires any function or method that returns a Promise to be marked async", "Buffer 构造函数是已废弃的语法": "Buffer 构造函数是已废弃的语法", "callback 中的 err 必须被处理": "require error handling in callbacks", "callback 之后必须立即 return": "require `return` statements after callbacks", "constructor 中必须有 super": "require `super()` calls in constructors", "defaultProps 必须按字母排序": "Enforce default props alphabetical sorting", "else 中使用 return 可以使代码结构更清晰": "else 中使用 return 可以使代码结构更清晰", "finally 中的语句会在 try 之前执行": "finally 中的语句会在 try 之前执行", "for in 内部必须有 hasOwnProperty": "require `for-in` loops to include an `if` statement", "for of 循环更加易读": "for of 循环更加易读", "generator 函数内必须有 yield": "require generator functions to contain `yield`", "getter 必须有返回值,并且禁止返回空": "enforce `return` statements in getters", "handler 的名称必须是 onXXX 或 handleXXX": "Enforce event handler naming conventions in JSX", "hasOwnProperty 比较常用": "hasOwnProperty 比较常用", "https://en.wikipedia.org/wiki/Cyclomatic_complexity": "https://en.wikipedia.org/wiki/Cyclomatic_complexity", "img, br 标签中禁止有 children": "Prevent passing of children to void DOM elements (e.g. <br />).", "interface 可以 implement, extend 和 merge": "interface 可以 implement, extend 和 merge", "interface 和 type 定义时必须声明成员的类型": "Requires type annotations to exist", "jsx 中禁止使用 bind": "Prevents usage of Function.prototype.bind and arrow functions in React component props", "module 已成为 js 的关键字": "module 已成为 js 的关键字", "new 后面的类名必须首字母大写": "require constructor names to begin with a capital letter", "new 应该作为创建一个类的实例的方法,所以不能不赋值": "new 应该作为创建一个类的实例的方法,所以不能不赋值", "no-require-imports 规则已经约束了 require": "no-require-imports 规则已经约束了 require", "parseInt 必须传入第二个参数": "enforce the consistent use of the radix argument when using `parseInt()`", "Promise 的 reject 中必须传入 Error 对象,而不是字面量": "require using Error objects as Promise rejection reasons", "prop 必须有类型限制": "require type definitions in props", "prop 的默认值必须匹配它的类型": "enforce props default values to be valid", "props 如果不是 required 的字段,必须有默认值": "require default value for props", "props 必须按字母排序": "Enforce props alphabetical sorting", "props 必须用驼峰式": "enforce specific casing for the Prop name in Vue components", "props 的取值必须是基本类型的构造函数,而不是字符串": "require prop type to be a constructor", "props, state, context 必须用解构赋值": "Enforce consistent usage of destructuring assignment of props, state, and context", "propTypes 的属性必须按照字母排序": "Enforce propTypes declarations alphabetical sorting", "public 方法必须定义输入输出参数的类型": "Requires that all public method arguments and return type will be explicitly typed", "render 函数必须有返回值": "enforce render function to always return value", "render 方法中必须有返回值": "Enforce ES5 or ES6 class for returning value in render function", "require 必须在全局作用域下": "require `require()` calls to be placed at top-level module scope", "setter 必须有对应的 getter,getter 可以没有对应的 setter": "enforce getter and setter pairs in objects and classes", "style 属性的取值必须是 object": "Enforce style prop value is an object", "switch 的 case 内必须有 break, return 或 throw,空的 case 除外": "disallow fallthrough of `case` statements", "switch 的 case 内有变量定义的时候,必须使用大括号将 case 内变成一个代码块": "disallow lexical declarations in case clauses", "switch 语句必须有 default": "require `default` cases in `switch` statements", "template 的根节点必须合法": "enforce valid template root", "typeof 表达式比较的对象必须是 'undefined', 'object', 'boolean', 'number', 'string', 'function', 'symbol', 或 'bigint'": "enforce comparing `typeof` expressions against valid strings", "v-bind 指令必须合法": "enforce valid `v-bind` directives", "v-cloak 指令必须合法": "enforce valid `v-cloak` directives", "v-else 指令必须合法": "enforce valid `v-else` directives", "v-else-if 指令必须合法": "enforce valid `v-else-if` directives", "v-for 指令必须合法": "enforce valid `v-for` directives", "v-for 指令的元素必须有 v-bind:key": "require `v-bind:key` with `v-for` directives", "v-html 指令必须合法": "enforce valid `v-html` directives", "v-if 指令必须合法": "enforce valid `v-if` directives", "v-model 指令必须合法": "enforce valid `v-model` directives", "v-on 指令必须合法": "enforce valid `v-on` directives", "v-once 指令必须合法": "enforce valid `v-once` directives", "v-pre 指令必须合法": "enforce valid `v-pre` directives", "v-show 指令必须合法": "enforce valid `v-show` directives", "v-slot 指令必须合法": "enforce valid `v-slot` directives", "v-text 指令必须合法": "enforce valid `v-text` directives", "var 必须在作用域的最前面": "require `var` declarations be placed at the top of their containing scope", "一个 defaultProps 必须有对应的 propTypes": "Enforce all defaultProps are defined and not \"required\" in propTypes.", "三斜杠是已废弃的语法,但在类型声明文件中还是可以使用的": "三斜杠是已废弃的语法,但在类型声明文件中还是可以使用的", "不允许有空函数": "disallow empty functions", "不同平台下的路径符号不一致,建议使用 path 处理平台差异性": "不同平台下的路径符号不一致,建议使用 path 处理平台差异性", "不强制要求写 displayName": "不强制要求写 displayName", "代码块嵌套的深度禁止超过 5 层": "enforce a maximum depth that blocks can be nested", "优先使用 interface 而不是 type": "Consistent with type definition either `interface` or `type`", "优先使用正则表达式字面量,而不是 RegExp 构造函数": "disallow use of the `RegExp` constructor in favor of regular expression literals", "优先级:\n1. static > instance\n2. field > constructor > method\n3. public > protected > private": "优先级:\n1. static > instance\n2. field > constructor > method\n3. public > protected > private", "使用 ES2018 中的正则表达式命名组": "enforce using named capture group in regular expression", "使用 es6 引入模块,才是更标准的方式。\n但是允许使用 declare namespace ... {} 来定义外部命名空间": "使用 es6 引入模块,才是更标准的方式。\n但是允许使用 declare namespace ... {} 来定义外部命名空间", "使用 Flow 时,props 必须设置为只读的": "Require read-only props.", "使用 for 循环遍历数组时,如果索引仅用于获取成员,则必须使用 for of 循环替代 for 循环": "Prefer a ‘for-of’ loop over a standard ‘for’ loop if the index is only used to access the array being iterated", "使用 includes 而不是 indexOf": "Enforce `includes` method over `indexOf` method", "使用 let 就已经解决了这个问题了": "使用 let 就已经解决了这个问题了", "使用 non-null 断言时就已经清楚了风险": "使用 non-null 断言时就已经清楚了风险", "使用 RegExp#exec 而不是 String#match": "Prefer RegExp#exec() over String#match() if no global flag is provided", "使用 sort 时必须传入比较函数": "Enforce giving `compare` argument to `Array#sort`", "使用 String#startsWith 而不是其他方式": "Enforce the use of `String#startsWith` and `String#endsWith` instead of other equivalent methods of checking substrings", "使用加号时,两者必须同为数字或同为字符串": "When adding two variables, operands must both be of type number or of type string", "使用缩写的 : 而不是 v-bind:": "enforce `v-bind` directive style", "使用缩写的 @click 而不是 v-on:click": "enforce `v-on` directive style", "使用缩写的 #one 而不是 v-slot:one": "enforce `v-slot` directive style", "修复 no-unused-vars 不检查 jsx 的问题": "prevent variables used in JSX to be marked as unused", "修复 React 被误报为未使用的变量的问题(仅在开启 no-unused-vars 时有效)": "Prevent React to be marked as unused", "修改原生对象可能会与将来版本的 js 冲突": "修改原生对象可能会与将来版本的 js 冲突", "允许灵活运用两者": "允许灵活运用两者", "几乎不会遇到这种场景": "几乎不会遇到这种场景", "出现 jsx 的地方必须导入 React": "Prevent missing React when using JSX", "出现这种情况时,一般不需要使用 new Promise 实现异步了": "出现这种情况时,一般不需要使用 new Promise 实现异步了", "函数必须有名字": "require or disallow named `function` expressions", "函数的参数禁止超过 3 个": "enforce a maximum number of parameters in function definitions", "函数赋值给变量的时候,函数名必须与变量名一致": "require function names to match the name of the variable or property to which they are assigned", "函数返回值必须与声明的类型一致": "Require explicit return types on functions and class methods", "函数重载时,若能通过联合类型将两个函数的类型声明合为一个,则使用联合类型而不是两个函数声明": "Warns for any two overloads that could be unified into one by using a union or an optional/rest parameter", "创建 Symbol 时必须传入参数": "require symbol descriptions", "单独的 if 可以把逻辑表达的更清楚": "单独的 if 可以把逻辑表达的更清楚", "单行注释必须写在上一行": "enforce position of line comments", "参数为一个时表示创建一个指定长度的数组,比较常用\n参数为多个时表示创建一个指定内容的数组,此时可以用数组字面量实现,不必使用构造函数": "参数为一个时表示创建一个指定长度的数组,比较常用\n参数为多个时表示创建一个指定内容的数组,此时可以用数组字面量实现,不必使用构造函数", "变量名必须是 camelcase 风格的": "Enforce camelCase naming convention", "变量必须先定义后使用": "disallow the use of variables before they are defined", "变量必须在定义的时候赋值": "require or disallow initialization in variable declarations", "变量申明必须排好序": "require variables within the same declaration block to be sorted", "只允许在 class 中使用 this": "只允许在 class 中使用 this", "使用函数类型别名替代包含函数调用声明的接口": "Use function types instead of interfaces with call signatures", "可以简化代码": "可以简化代码", "同构应用需要在 didMount 里使用 setState": "同构应用需要在 didMount 里使用 setState", "后者表达的更清晰": "后者表达的更清晰", "否定的表达式可以把逻辑表达的更清楚": "否定的表达式可以把逻辑表达的更清楚", "回调函数嵌套禁止超过 3 层,多了请用 async await 替代": "enforce a maximum depth that callbacks can be nested", "在命名空间中,可以直接使用内部变量,不需要添加命名空间前缀": "Warns when a namespace qualifier is unnecessary", "在类的非静态方法中,必须存在对 this 的引用": "enforce that class methods utilize `this`", "增加可读性": "增加可读性", "它们是已废弃的语法": "它们是已废弃的语法", "它是已废弃的语法": "它是已废弃的语法", "它是通过字符串匹配来判断函数参数 err 的,不准确": "它是通过字符串匹配来判断函数参数 err 的,不准确", "对象字面量的键名必须排好序": "require object keys to be sorted", "导入必须按规则排序": "enforce sorted import declarations within modules", "将 var 定义的变量视为块作用域,禁止在块外使用": "enforce the use of variables within the scope they are defined", "将不需要公开的成员设为私有的,可以增强代码的可理解性,对文档输出也很友好": "将不需要公开的成员设为私有的,可以增强代码的可理解性,对文档输出也很友好", "已定义的 state 必须使用": "Prevent definition of unused state fields", "已定义的变量必须使用": "disallow unused variables", "已有 private 修饰符了,没必要限制变量名": "已有 private 修饰符了,没必要限制变量名", "已经在 no-undef 中限制了": "已经在 no-undef 中限制了", "已经禁止使用 componentWillUpdate 了": "已经禁止使用 componentWillUpdate 了", "已经禁止使用 label 了": "已经禁止使用 label 了", "已经禁止使用 var 了": "已经禁止使用 var 了", "布尔值的属性必须显式的声明值为 true": "Enforce boolean attributes notation in JSX", "布尔值类型的 propTypes 的 name 必须为 is 或 has 开头": "Enforces consistent naming for boolean props", "当一个节点上出现两个 v-on:click 时,其中一个必须为 exact": "enforce usage of `exact` modifier on `v-on`", "当需要写一系列属性的时候,可以更统一": "当需要写一系列属性的时候,可以更统一", "很多 api 或文件名都不是 camelcase 风格的": "很多 api 或文件名都不是 camelcase 风格的", "很多时候函数的形参和传参是同名的": "很多时候函数的形参和传参是同名的", "循环内必须对循环条件中的变量有修改": "disallow unmodified loop conditions", "必须使用 !a 替代 a ? false : true": "disallow ternary operators when simpler alternatives exist", "必须使用 ... 而不是 apply,比如 foo(...args)": "require spread operators instead of `.apply()`", "必须使用 ... 而不是 Object.assign,除非 Object.assign 的第一个参数是一个变量": "disallow using Object.assign with an object literal as the first argument and prefer the use of object spread instead.", "必须使用 ...args 而不是 arguments": "require rest parameters instead of `arguments`", "必须使用 <></> 而不是 React.Fragment": "Enforce shorthand or standard form for React fragments", "必须使用 === 或 !==,禁止使用 == 或 !=": "require the use of `===` and `!==`", "必须使用 0b11111011 而不是 parseInt()": "disallow `parseInt()` and `Number.parseInt()` in favor of binary, octal, and hexadecimal literals", "必须使用 a = {b} 而不是 a = {b: b}": "require or disallow method and property shorthand syntax for object literals", "必须使用 Class 的形式创建组件": "Enforce ES5 or ES6 class for React Components", "必须使用 if (foo === 5) 而不是 if (5 === foo)": "require or disallow \"Yoda\" conditions", "必须使用 isNaN(foo) 而不是 foo === NaN": "require calls to `isNaN()` when checking for `NaN`", "必须使用 x = x + y 而不是 x += y": "require or disallow assignment operator shorthand where possible", "必须使用函数式组件": "Enforce stateless components to be written as a pure function", "必须使用模版字符串而不是字符串连接": "require template literals instead of string concatenation", "必须使用解构赋值": "require destructuring from arrays and/or objects", "必须只使用函数声明或只使用函数表达式": "enforce the consistent use of either `function` declarations or expressions", "必须在构造函数中初始化 state": "State initialization in an ES6 class component should be in a constructor", "必须直接使用 export default 导出组件": "require the component to be directly exported", "必须设置类的成员的可访问性": "Require explicit accessibility modifiers on class properties and methods", "指定类成员的排序规则": "Require a consistent member declaration order", "接口名称必须以 I 开头": "Require that interface names should or should not prefixed with `I`", "支持在模版中使用 eslint-disable-next-line 等注释": "support comment-directives in `<template>`", "数组中的 jsx 必须有 key": "Report missing `key` props in iterators/collection literals", "数组的方法除了 forEach 之外,回调函数必须有返回值": "enforce `return` statements in callbacks of array methods", "方法调用时需要绑定到正确的 this 上": "Enforces unbound methods are called with their expected scope", "既然已经使用注释来忽略编译错误了,说明已经清楚可能带来的后果": "既然已经使用注释来忽略编译错误了,说明已经清楚可能带来的后果", "是否允许使用 // @ts-ignore 来忽略编译错误": "Bans “// @ts-ignore” comments from being used", "有一个 bug:https://github.com/yannickcr/eslint-plugin-react/issues/1181": "有一个 bug:https://github.com/yannickcr/eslint-plugin-react/issues/1181", "有些场景下还是需要用到这个": "有些场景下还是需要用到这个", "有代码高亮的话,在阅读这种代码时,也完全不会产生歧义或理解上的困难": "有代码高亮的话,在阅读这种代码时,也完全不会产生歧义或理解上的困难", "有时为了紧凑需要挨在一起,有时为了可读性需要空一行": "有时为了紧凑需要挨在一起,有时为了可读性需要空一行", "有时后者可以使代码结构更清晰": "有时后者可以使代码结构更清晰", "有时需要将一个空函数设置为某个项的默认值": "有时需要将一个空函数设置为某个项的默认值", "有默认值的参数必须放在函数参数的末尾": "enforce default parameters to be last", "条件判断必须传入布尔值": "Restricts the types allowed in boolean expressions", "条件表达式禁止是永远为真(或永远为假)的": "Prevents conditionals where the type is always truthy or always falsy", "某些特殊字符很难看出差异,最好不要在正则中使用": "某些特殊字符很难看出差异,最好不要在正则中使用", "标签属性必须按规则排序": "enforce order of attributes", "模块化之后,不会出现这种在全局作用域下定义变量的情况": "模块化之后,不会出现这种在全局作用域下定义变量的情况", "模版中已定义的变量必须使用": "disallow unused variable definitions of v-for directives or scope attributes", "模版中的变量名禁止与前一个作用域重名": "disallow variable declarations from shadowing variables declared in the outer scope", "模版字符串中的变量类型必须是字符串": "Enforce template literal expressions to be of string type", "正则表达式中必须要加上 u 标志": "enforce the use of `u` flag on RegExp", "正则表达式已经较难理解了,没必要强制加上命名组": "正则表达式已经较难理解了,没必要强制加上命名组", "没有官方文档,并且存在很多 bug:https://github.com/yannickcr/eslint-plugin-react/search?q=no-unused-state&type=Issues&utf8=%E2%9C%93": "没有官方文档,并且存在很多 bug:https://github.com/yannickcr/eslint-plugin-react/search?q=no-unused-state&type=Issues&utf8=%E2%9C%93", "注释的斜线或 * 后必须有空格": "enforce consistent spacing after the `//` or `/*` in a comment", "注释的首字母必须大写": "enforce or disallow capitalization of the first letter of a comment", "申明后不再被修改的变量必须使用 const 来申明": "require `const` declarations for variables that are never reassigned after declared", "相同类型的 require 必须放在一起": "disallow `require` calls to be mixed with regular variable declarations", "禁止 <template> 使用 key 属性": "disallow `key` attribute on `<template>`", "禁止 delete 时传入的 key 是动态的": "Bans usage of the delete operator with computed key expressions", "禁止 else 中只有一个单独的 if": "disallow `if` statements as the only statement in `else` blocks", "禁止 if 里有否定的表达式": "disallow negated conditions", "禁止 jsx 中使用无用的引号": "Disallow unnecessary JSX expressions when literals alone are sufficient or enfore JSX expressions on literals in JSX children or attributes", "禁止 label 名称与已定义的变量重复": "disallow labels that share a name with a variable", "禁止 throw 字面量,必须 throw 一个 Error 对象": "disallow throwing literals as exceptions", "禁止不必要的布尔类型转换": "disallow unnecessary boolean casts", "禁止与负零进行比较": "disallow comparing against -0", "禁止使用 __iterator__": "disallow the use of the `__iterator__` property", "禁止使用 __proto__": "disallow the use of the `__proto__` property", "禁止使用 'strict';": "require or disallow strict mode directives", "禁止使用 {...props}": "Prevent JSX prop spreading", "禁止使用 \\ 来换行字符串": "disallow multiline strings", "禁止使用 ++ 或 --": "disallow the unary operators `++` and `--`", "禁止使用 ~+ 等难以理解的类型转换,仅允许使用 !!": "disallow shorthand type conversions", "禁止使用 0 开头的数字表示八进制数": "disallow octal literals", "禁止使用 alert": "disallow the use of `alert`, `confirm`, and `prompt`", "禁止使用 any": "Disallow usage of the `any` type", "禁止使用 Array 构造函数": "disallow `Array` constructors", "禁止使用 Array 构造函数时传入的参数超过一个": "disallow `Array` constructors", "禁止使用 caller 或 callee": "disallow the use of `arguments.caller` or `arguments.callee`", "禁止使用 console": "disallow the use of `console`", "禁止使用 continue": "disallow `continue` statements", "禁止使用 dangerouslySetInnerHTML": "Prevent usage of dangerous JSX props", "禁止使用 debugger": "disallow the use of `debugger`", "禁止使用 eval": "disallow the use of `eval()`", "禁止使用 findDOMNode": "Prevent usage of findDOMNode", "禁止使用 foo == null,必须使用 foo === null": "disallow `null` comparisons without type-checking operators", "禁止使用 foo['bar'],必须写成 foo.bar": "enforce dot notation whenever possible", "禁止使用 hasOwnProperty, isPrototypeOf 或 propertyIsEnumerable": "disallow calling some `Object.prototype` methods directly on objects", "禁止使用 isMounted": "Prevent usage of isMounted", "禁止使用 label": "disallow labeled statements", "禁止使用 magic numbers": "Disallows magic numbers", "禁止使用 module 来定义命名空间": "Require the use of the `namespace` keyword instead of the `module` keyword to declare custom TypeScript modules", "禁止使用 namespace 来定义命名空间": "Disallow the use of custom TypeScript modules and namespaces", "禁止使用 new Function": "disallow `new` operators with the `Function` object", "禁止使用 new 来生成 String, Number 或 Boolean": "disallow `new` operators with the `String`, `Number`, and `Boolean` objects", "禁止使用 new 来生成 Symbol": "disallow `new` operators with the `Symbol` object", "禁止使用 node 中的同步的方法,比如 fs.readFileSync": "disallow synchronous methods", "禁止使用 non-null 断言(感叹号)": "Disallows non-null assertions using the `!` postfix operator", "组件的名称必须符合 PascalCase": "Enforce PascalCase for user-defined JSX components", "禁止使用 process.env.NODE_ENV": "disallow the use of `process.env`", "禁止使用 process.exit(0)": "disallow the use of `process.exit()`", "禁止使用 PropTypes.any PropTypes.array 和 PropTypes.object": "Forbid certain propTypes", "禁止使用 ReactDOM.render 的返回值": "Prevent usage of the return value of React.render", "禁止使用 require": "Disallows invocation of `require()`", "禁止使用 require 来引入模块": "Disallows the use of require statements except in import statements", "禁止使用 setState": "Prevent usage of setState", "禁止使用 target=\"_blank\"": "Forbid target=\"_blank\" attribute without rel=\"noopener noreferrer\"", "禁止使用 undefined": "disallow the use of `undefined` as an identifier", "禁止使用 v-html": "disallow use of v-html to prevent XSS attack", "禁止使用 var": "require `let` or `const` instead of `var`", "禁止使用 void": "disallow `void` operators", "禁止使用 with": "disallow `with` statements", "禁止使用三元表达式": "disallow ternary operators", "禁止使用三斜杠导入文件": "Sets preference level for triple slash directives versus ES6-style import declarations", "禁止使用不安全的生命周期方法 componentWillMount, componentWillReceiveProps, componentWillUpdate": "Prevent usage of unsafe lifecycle methods", "禁止使用位运算": "disallow bitwise operators", "禁止使用保留字作为变量名": "disallow identifiers from shadowing restricted names", "禁止使用八进制的转义符": "disallow octal escape sequences in string literals", "禁止使用另一个组件的 propTypes": "Forbid using another component's propTypes", "禁止使用字符串 ref": "Prevent string definitions for references and prevent referencing this.refs", "禁止使用嵌套的三元表达式,比如 a ? b : c ? d : e": "disallow nested ternary expressions", "禁止使用已废弃的 api": "Prevent usage of deprecated methods", "禁止使用指定的全局变量": "disallow specified global variables", "禁止使用指定的对象属性": "disallow certain properties on certain objects", "禁止使用指定的标识符": "disallow specified identifiers", "禁止使用指定的模块": "disallow specified modules when loaded by `require`", "禁止使用指定的类型": "Bans specific types from being used", "禁止使用指定的组件": "Forbid certain elements", "禁止使用指定的语法": "disallow specified syntax", "禁止使用数组的索引作为 key": "Prevent usage of Array index in keys", "禁止使用未定义的变量": "disallow the use of undeclared variables", "禁止使用未定义的组件": "Disallow undeclared variables in JSX", "禁止使用没必要的 {} 作为代码块": "disallow unnecessary nested blocks", "禁止使用特殊空白符(比如全角空格),除非是出现在字符串、正则表达式或模版字符串中": "disallow irregular whitespace", "禁止使用类型别名": "Disallow the use of type aliases", "禁止使用逗号操作符": "disallow comma operators", "禁止修改原生对象": "disallow extending native types", "禁止出现 HTML 中的属性,如 class": "Prevent usage of unknown DOM property", "禁止出现 location.href = 'javascript:void(0)';": "disallow `javascript:` urls", "禁止出现未使用的 propTypes": "Prevent definitions of unused prop types", "禁止出现没必要的 bind": "disallow unnecessary calls to `.bind()`", "禁止出现没必要的 call 或 apply": "disallow unnecessary calls to `.call()` and `.apply()`", "禁止出现没必要的 constructor": "disallow unnecessary constructors", "禁止出现没必要的 label": "disallow unnecessary labels", "禁止出现没必要的字符串连接": "disallow unnecessary concatenation of literals or template literals", "禁止出现没必要的计算键名": "disallow unnecessary computed property keys in object literals", "禁止出现没必要的转义": "disallow unnecessary escape characters", "禁止出现没用到的 label": "disallow unused labels", "禁止出现空代码块,允许 catch 为空代码块": "disallow empty block statements", "禁止出现语法错误": "disallow parsing errors in `<template>`", "禁止出现重复的 props": "Enforce no duplicate props", "禁止出现重复的属性": "disallow duplication of attributes", "禁止函数在不同分支返回不同类型的值": "require `return` statements to either always or never specify values", "禁止函数的循环复杂度超过 20": "enforce a maximum cyclomatic complexity allowed in a program", "禁止变量名出现下划线": "disallow dangling underscores in identifiers", "禁止变量申明时用逗号一次申明多个": "enforce variables to be declared either together or separately in functions", "禁止在 <textarea> 中出现模版语法 {{message}}": "disallow mustaches in `<textarea>`", "禁止在 catch 中仅仅只是把错误 throw 出去": "disallow unnecessary `catch` clauses", "禁止在 componentDidMount 里使用 setState": "Prevent usage of setState in componentDidMount", "禁止在 componentDidUpdate 里使用 setState": "Prevent usage of setState in componentDidUpdate", "禁止在 componentWillUpdate 中使用 setState": "Prevent usage of setState in componentWillUpdate", "禁止在 dom 组件中使用指定的 props": "Forbid certain props on DOM Nodes", "禁止在 else 内使用 return,必须改为提前结束": "disallow `else` blocks after `return` statements in `if` statements", "禁止在 finally 中出现 return, throw, break 或 continue": "disallow control flow statements in `finally` blocks", "禁止在 if 代码块内出现函数声明": "disallow variable or `function` declarations in nested blocks", "禁止在 in 或 instanceof 操作符的左侧变量前使用感叹号": "disallow negating the left operand of relational operators", "禁止在 jsx 中使用像注释的字符串": "Comments inside children section of tag should be placed inside braces", "禁止在 jsx 中出现字符串": "Prevent using string literals in React component definition", "禁止在 React.PureComponent 中使用 shouldComponentUpdate": "Flag shouldComponentUpdate when extending PureComponent", "禁止在 RegExp 构造函数中出现非法的正则表达式": "disallow invalid regular expression strings in `RegExp` constructors", "禁止在 return 语句里使用 await": "disallow unnecessary `return await`", "禁止在 return 语句里赋值": "disallow assignment operators in `return` statements", "禁止在 return, throw, break 或 continue 之后还有代码": "disallow unreachable code after `return`, `throw`, `continue`, and `break` statements", "禁止在 setState 中使用 this.state": "Reports when this.state is accessed within setState", "禁止在 setTimeout 或 setInterval 中传入字符串": "disallow the use of `eval()`-like methods", "禁止在 super 被调用之前使用 this 或 super": "disallow `this`/`super` before calling `super()` in constructors", "禁止在 switch 语句中出现重复测试表达式的 case": "disallow duplicate case labels", "禁止在 v-on 的值中调用函数": "enforce or forbid parentheses after method calls without arguments in `v-on` directives", "禁止在一个文件创建两个组件": "Prevent multiple component definition per file", "禁止在代码后添加单行注释": "disallow inline comments after code", "禁止在使用了 dangerouslySetInnerHTML 的组件内添加 children": "Report when a DOM element is using both children and dangerouslySetInnerHTML", "禁止在全局作用域下定义变量或申明函数": "disallow variable and `function` declarations in the global scope", "禁止在函数参数中出现重复名称的参数": "disallow duplicate arguments in `function` definitions", "禁止在函数组件中使用 this": "Report \"this\" being used in stateless components", "禁止在同一个元素上使用 v-if 和 v-for 指令": "disallow use v-if on the same element as v-for", "禁止在定义变量之前就使用它": "Disallow the use of variables before they are defined", "禁止在对象字面量中出现重复的键名": "disallow duplicate keys in object literals", "禁止在循环内的函数内部出现循环体条件语句中定义的变量": "disallow function declarations that contain unsafe references inside loop statements", "禁止在接口中定义 constructor,或在类中定义 new": "Enforce valid definition of `new` and `constructor`", "禁止在数组中出现连续的逗号": "disallow sparse arrays", "禁止在普通字符串中出现模版字符串里的变量形式": "disallow template literal placeholder syntax in regular strings", "禁止在模版中用 this": "disallow usage of `this` in template", "禁止在正则表达式中使用空的字符集 []": "disallow empty character classes in regular expressions", "禁止在正则表达式中出现 Ctrl 键的 ASCII 表示,即禁止使用 /\\x1f/": "disallow control characters in regular expressions", "禁止在正则表达式中出现形似除法操作符的开头,如 let a = /=foo/": "disallow division operators explicitly at the beginning of regular expressions", "禁止在正则表达式中出现连续的空格": "disallow multiple spaces in regular expressions", "禁止在测试表达式中使用赋值语句,除非这个赋值语句被括号包起来了": "disallow assignment operators in conditional expressions", "禁止在类之外的地方使用 this": "disallow `this` keywords outside of classes or class-like objects", "禁止在组件的内部存在未转义的 >, \", ' 或 }": "Detect unescaped HTML entities, which might represent malformed tags", "禁止在自定义组件中使用指定的 props": "Forbid certain props on components", "禁止在计算属性中对属性修改": "disallow side effects in computed properties", "禁止定义在 components 中的组件未使用": "disallow registering components that are not used inside templates", "禁止定义没必要的类,比如只有静态方法的类": "Forbids the use of classes as namespaces", "禁止定义空的接口": "Disallow the declaration of empty interfaces", "禁止对 __dirname 或 __filename 使用字符串连接": "disallow string concatenation with `__dirname` and `__filename`", "禁止对 array 使用 for in 循环": "Disallow iterating over an array with a for-in loop", "禁止对一个变量使用 delete": "disallow deleting variables", "禁止对使用 const 定义的常量重新赋值": "disallow reassigning `const` variables", "禁止对全局变量赋值": "disallow assignments to native objects or read-only global variables", "禁止对函数的参数重新赋值": "disallow reassigning `function` parameters", "禁止对导入的模块进行赋值": "disallow assigning to imported bindings", "禁止对已定义的 class 重新赋值": "disallow reassigning class members", "禁止对没有 then 方法的对象使用 await": "Disallows awaiting a value that is not a Thenable", "禁止导入指定的模块": "disallow specified modules when loaded by `import`", "禁止将 async 函数做为 new Promise 的回调函数": "disallow using an async function as a Promise executor", "禁止将 await 写在循环里,因为这样就无法同时发送多个异步请求了": "disallow `await` inside of loops", "禁止将 await 或 yield 的结果做为运算符的后面项": "disallow assignments that can lead to race conditions due to usage of `await` or `yield`", "禁止将 catch 的第一个参数 error 重新赋值": "disallow reassigning exceptions in `catch` clauses", "禁止将 children 作为一个 prop": "Prevent passing of children as props.", "禁止将 Math, JSON 或 Reflect 直接作为函数调用": "disallow calling global object properties as functions", "禁止将 this 赋值给其他变量,除非是解构赋值": "Disallow aliasing `this`", "禁止将 undefined 赋值给变量": "disallow initializing variables to `undefined`", "禁止将一个函数声明重新赋值": "disallow reassigning `function` declarations", "禁止将常量作为分支条件判断中的测试表达式,但允许作为循环条件判断中的测试表达式": "disallow constant expressions in conditions", "禁止将自己与自己比较": "disallow comparisons where both sides are exactly the same", "禁止将自己赋值给自己": "disallow assignments where both sides are exactly the same", "禁止方向错误的 for 循环": "enforce \"for\" loop update clause moving the counter in the right direction.", "禁止无意义的 Fragment 组件": "Disallow unnecessary fragments", "禁止无用的类型断言": "Warns if a type assertion does not change the type of an expression", "禁止无用的表达式": "Disallow unused expressions", "禁止正则表达式中使用肉眼无法区分的特殊字符": "disallow characters which are made with multiple code points in character class syntax", "禁止没必要的 return": "disallow redundant return statements", "禁止注释中出现 TODO 和 FIXME": "disallow specified warning terms in comments", "禁止直接 new Object": "disallow `Object` constructors", "禁止直接 new require('foo')": "disallow `new` operators with calls to `require`", "禁止直接 new 一个类而不赋值": "disallow `new` operators outside of assignments or comparisons", "禁止直接使用 Buffer": "disallow use of the `Buffer()` constructor", "禁止直接修改 this.state": "Prevent direct mutation of this.state", "禁止组件的属性或生命周期大小写错误": "Prevent common typos", "禁止给一个初始化时直接赋值为 number, string 的变量显式的声明类型": "Disallows explicit type declarations for variables or parameters initialized to a number, string, or boolean", "禁止给布尔值 props 添加默认值": "disallow boolean defaults", "禁止给类的构造函数的参数添加修饰符": "Disallow the use of parameter properties in class constructors", "禁止范型的类型有默认值时,将范型设置为该默认值": "Warns if an explicitly specified type argument is the default for that type parameter", "禁止覆盖保留字": "disallow overwriting reserved keys", "禁止解构赋值中出现空 {} 或 []": "disallow empty destructuring patterns", "禁止解构赋值时出现同样名字的的重命名,比如 let { foo: foo } = bar;": "disallow renaming import, export, and destructured assignments to the same name", "禁止调用 Promise 时没有处理异常情况": "Requires Promise-like values to be handled appropriately.", "禁止连续赋值,比如 foo = bar = 1": "disallow use of chained assignment expressions", "禁止重复定义变量": "disallow variable redeclaration", "禁止重复定义类的成员": "disallow duplicate class members", "禁止重复导入模块": "disallow duplicate module imports", "禁止重复的键名": "disallow duplication of field names", "禁用 var 之后,编译阶段就会报错了": "禁用 var 之后,编译阶段就会报错了", "禁用已废弃的 scope 属性": "disallow deprecated `scope` attribute (in Vue.js 2.5.0+)", "私有变量如果没有在构造函数外被赋值,则必须设为 readonly": "Requires that private members are marked as `readonly` if they're never modified outside of the constructor", "私有成员必须以 _ 开头": "Enforces naming conventions for class members by visibility", "类名与接口名必须为 PascalCase": "Require PascalCased class and interface names", "类型断言必须使用 as Type,禁止使用 <Type>,禁止对对象字面量进行类型断言(断言成 any 是允许的)": "Enforces consistent usage of type assertions.", "类型相关的约束交给 TypeScript": "类型相关的约束交给 TypeScript", "类的成员之间是否需要空行": "require or disallow an empty line between class members", "类的静态属性必须使用 static 关键字定义": "Defines where React component static properties should be positioned.", "约束多行注释的格式": "enforce a particular style for multiline comments", "约束泛型的命名规则": "Enforces naming of generic type variables", "组件内方法必须按照一定规则排序": "Enforce component methods order", "组件内没有 children 时,必须使用自闭和写法": "Prevent extra closing tags for components without children", "组件名称必须和文件名一致": "require component name property to match its file name", "组件必须写 propTypes": "Prevent missing props validation in a React component definition", "组件必须有 displayName 属性": "Prevent missing displayName in a React component definition", "组件必须有 shouldComponentUpdate": "Enforce React components to have a shouldComponentUpdate method", "组件的 data 属性的值必须是一个函数": "enforce component's data property to be a function", "组件的属性必须为一定的顺序": "enforce order of properties in components", "统一使用 import 来引入模块,特殊情况使用单行注释允许 require 引入": "统一使用 import 来引入模块,特殊情况使用单行注释允许 require 引入", "统一关闭 requires type information 的规则": "统一关闭 requires type information 的规则", "编译阶段就会报错了": "编译阶段就会报错了", "编译阶段检查就足够了": "编译阶段检查就足够了", "缺少 TypeScript 的支持,类型判断是不准确的": "缺少 TypeScript 的支持,类型判断是不准确的", "能写注释已经不容易了,不需要限制太多": "能写注释已经不容易了,不需要限制太多", "要求太严格了,有时需要在循环中写 await": "要求太严格了,有时需要在循环中写 await", "计算属性必须有返回值": "enforce that a return statement is present in computed property", "计算属性禁止包含异步方法": "disallow asynchronous actions in computed properties", "转义可以使代码更易懂": "转义可以使代码更易懂", "这和 eval 是等价的": "这和 eval 是等价的", "这样会导致不符合预期的结果\nhttps://github.com/eslint/eslint/issues/11899\n在上面 issue 修复之前,关闭此规则": "这样会导致不符合预期的结果\nhttps://github.com/eslint/eslint/issues/11899\nOff this rule until the issue above is resolved", "这样的 catch 是没有意义的,等价于直接执行 try 里的代码": "这样的 catch 是没有意义的,等价于直接执行 try 里的代码", "避免错误的使用 Promise": "Avoid using promises in places not designed to handle them", "重载的函数必须写在一起": "Require that member overloads be consecutive", "限制 jsx 层级": "Validate JSX maximum depth", "限制 this 的别名": "enforce consistent naming when capturing the current execution context", "限制一个文件中类的数量": "enforce a maximum number of classes per file", "限制一个文件最多的行数": "enforce a maximum number of lines per file", "限制一行中的语句数量": "enforce a maximum number of statements allowed per line", "限制函数块中的代码行数": "enforce a maximum number of line of code in a function", "限制函数块中的语句数量": "enforce a maximum number of statements allowed in function blocks", "限制变量名必须匹配指定的正则表达式": "require identifiers to match a specified regular expression", "限制变量名长度": "enforce minimum and maximum identifier lengths", "限制数组类型必须使用 Array<T> 或 T[]": "Requires using either `T[]` or `Array<T>` for arrays", "限制文件后缀": "Restrict file extensions that may contain JSX", "限制组件名的风格": "enforce specific casing for the component naming style in template", "限制组件的 name 属性的值的风格": "enforce specific casing for the name property in Vue components", "限制自定义组件的属性风格": "enforce attribute naming style on custom components in template", "限制语句之间的空行规则,比如变量定义完之后必须要空行": "require or disallow padding lines between statements", "非 required 的 prop 必须有 defaultProps": "Enforce a defaultProps definition for every prop that is not a required prop.", "隐藏已禁用的规则": "Hide disabled rules", "规则说明": "Rule Description", "错误的示例": "Incorrect Example", "正确的示例": "Correct Example", "配置:": "Options:", "setter 和 getter 必须写在一起": "Require grouped accessor pairs in object literals and classes", "禁止在构造函数中返回值": "Disallow returning value in constructor", "禁止 if else 的条件判断中出现重复的条件": "Disallow duplicate conditions in `if-else-if` chains", "禁止 setter 有返回值": "Disallow returning values from setters", "禁止变量名与上层作用域内的已定义的变量重复": "Disallow variable declarations from shadowing variables declared in the outer scope", "使用 ES2016 的语法 ** 替代 Math.pow": "Disallow the use of `Math.pow` in favor of the `**` operator", "禁止多余的 non-null 断言": "Disallow extra non-null assertion", "禁止已定义的变量未使用": "Disallow unused variables and arguments", "使用 ?? 替代 ||": "Enforce the usage of the nullish coalescing operator instead of logical chaining", "使用 optional chaining 替代 &&": "Prefer using concise optional chain expressions instead of chained logical ands", "async 函数必须返回 await": "Rules for awaiting returned promises", "组件的 name 属性必须符合 PascalCase": "Enforce `PascalCase` for component definition `name`", "这是官方建议的规范": "Officially recommended", "组件中必须按照 <script>, <template>, <style> 排序": "Enforce order of component top-level elements to be `<script>`, `<template>` and `<style>`", "这是官方建议的顺序": "Officially recommended", "使用 v-slot 替代已废弃的 slot": "Use `v-slot` instead of `slot`", "禁用已废弃的 slot-scope": "Disallow deprecated `slot-scope` attribute", "禁止使用特殊空白符(比如全角空格),除非是出现在字符串、正则表达式、模版字符串中或 HTML 内容中": "Disallow irregular whitespace", "组件的 name 属性静止使用保留字": "Disallow the use of reserved names in component definitions", "禁止使用 style 属性": "Disallow static inline `style` attributes", "当你的 vue 版本较老时,禁用还未支持的语法": "Disallow unsupported Vue.js syntax on the specified version", "组件必须包含 name 属性": "Require a `name` property in Vue components", "class 的值必须按字母排序": "Enforce static class names order to be alphabetical", "v-bind:foo.sync 指令必须合法": "This rule checks whether every `.sync` modifier on `v-bind` directives is valid", "限制函数式组件的函数形式(函数声明、函数表达式或箭头函数)": "Standardize the way function component get defined (fixable)", "一些场景还不能覆盖,如 export default function,自动修复功能在 ts 中有些问题": "There are some unfixable patterns such as `export default function`, and autofixer is somewhat constrained for TypeScript users", "禁止出现 href=\"javascript:void(0)\"": "Forbid `javascript:` URLs", "React 已经有 warning 了,并且会在将来禁止此类属性值": "Any URLs starting with `javascript:` scheme log a warning in React, in a future major release, React will throw an error if it encounters a `javascript:` URL", "两个 inline 元素之间必须有空格,否则视觉上它们就贴在一起了": "Prevent adjacent inline elements not separated by whitespace", "这是样式的问题,不应该由空格约束": "This is a styling issue", "<template> <script> <style> 之间必须由空行": "There should be blank lines between `<template>` `<script>` `<style>`", "代码格式问题,最好由 Prettier 解决": "This is a coding style issue, should solved by Prettier", "props 的键名必须排好序": "enforce sort-keys in a manner that is compatible with order-in-components", "禁止使用 // @ts-ignore // @ts-nocheck // @ts-check": "`// @ts-ignore` `// @ts-nocheck` `// @ts-check` is forbidden", "这种注释本身就是对特殊代码的说明": "This kind of comments is a specific explain for code itself", "有默认值或可选的参数必须放到最后": "Enforce default parameters to be last", "导出的函数或类中的 public 方法必须定义输入输出参数的类型": "Require explicit return and argument types on exported functions' and classes' public class methods", "限制各种变量或类型的命名规则": "Enforces naming conventions for everything across a codebase", "禁止在 optional chaining 之后使用 non-null 断言(感叹号)": "Disallows using a non-null assertion after an optional chain expression", "optional chaining 后面的属性一定是非空的": "properties after optional chaining is definitely non-null", "测试表达式中的布尔类型禁止与 true 或 false 直接比较": "Flags unnecessary equality comparisons against boolean literals", "使用 as const 替代 as 'bar'": "Prefer usage of `as const` over literal type", "as const 是新语法,不是很常见": "`as const` is a new grammar which is not common used", "使用联合类型作为 switch 的对象时,必须包含每一个类型的 case": "Exhaustiveness checking in switch with union type", "类的只读属性若是一个字面量,则必须使用只读属性而不是 getter": "Ensures that literals on classes are exposed in a consistent style", "接口中的方法必须用属性的方式定义": "Enforces using a particular method signature syntax", "禁止滥用 toString 方法": "Requires that `.toString()` is only called on objects which provide useful information when stringified", "禁止将变量或属性的类型设置为 any": "Disallows assigning any to variables and properties", "禁止调用 any 类型的变量上的方法": "Disallows calling an any type value", "禁止获取 any 类型的变量中的属性": "Disallows member access on any typed variables", "禁止函数的返回值的类型是 any": "Disallows returning any from a function", "函数的参数必须设置为 readonly": "Requires that function parameters are typed as readonly to prevent accidental mutation of inputs", "使用 reduce 方法时,必须传入范型,而不是对第二个参数使用 as": "Prefer using type parameter when calling Array#reduce instead of casting", "当需要忽略下一行的 ts 错误时,必须使用 @ts-expect-error 而不是 @ts-ignore": "Recommends using `// @ts-expect-error` over `// @ts-ignore`", "使用 @ts-expect-error 可以避免对不会报错的代码设置了 @ts-ignore": "Using `@ts-expect-error` can prevent use wrong usage of `@ts-ignore`", "配置了 strictFunctionTypes 之后,用属性的方式定义方法可以获得更严格的检查": "Setting `strictFunctionTypes` to true will makes typecheck more strict for property with function type", "强制所有属性都定义到类里面,比较统一": "Forcing the user to explicitly declare all properties in the class, makes code style more unified", "switch 语句中的 default 必须在最后": "Enforce default parameters to be last", "禁止导出指定的变量名": "Disallow specified names in exports", "禁止正则表达式中出现无用的回溯引用": "Disallow useless backreferences in regular expressions", "某些回溯引用语法上没问题,但是会永远匹配到空字符串": "Useless backreferences always ends up matching only zero-length (the empty string)", "禁止使用无意义的 void 类型": "Disallows usage of `void` type outside of generic or return types", "void 只能用在函数的返回值中": "`void` type can only be the return type of function", "禁止使用超出 js 精度范围的数字": "Disallow Number Literals That Lose Precision", "禁止使用类似 tslint:disable-next-line 这样的注释": "Bans `// tslint:<rule-flag>` comments from being used", "禁止使用容易混淆的非空断言": "Disallow non-null assertion in locations that may be confusing" }