代码拉取完成,页面将自动刷新
module.exports = {
// https://zhuanlan.zhihu.com/p/453320319
'@typescript-eslint/array-type': [
'error',
{
default: 'array',
readonly: 'array',
},
], //支持使用 Array<T> 与 T[] 的形式声明数组类型
'@typescript-eslint/await-thenable': ['error'], // 只允许对异步函数、Promise、PromiseLike 使用 await 调用
'@typescript-eslint/ban-ts-comment': ['error'], // 禁止 @ts- 指令的使用,或者允许其在提供了说明的情况下被使用
'@typescript-eslint/ban-types': ['error'], // 禁止部分值被作为类型标注
'@typescript-eslint/consistent-type-assertions': [
'error',
{
assertionStyle: 'as',
objectLiteralTypeAssertions: 'never',
},
], // 支持通过 as 与 <> 两种不同的语法进行类型断言
'@typescript-eslint/consistent-type-definitions': ['error', 'interface'], //TypeScript 支持通过 type 与 interface 声明对象类型
'@typescript-eslint/method-signature-style': ['error', 'property'], //方法签名的声明方式有 method 与 property 两种
'@typescript-eslint/no-extra-non-null-assertion': ['error'], //不允许额外的重复非空断言:
'@typescript-eslint/prefer-for-of': ['error'], //在你使用 for 循环遍历数组时,如果索引仅仅用来访问数组成员,则应该替换为 for...of。
'@typescript-eslint/prefer-nullish-coalescing': ['error'], //使用 ?? 而不是 ||
'@typescript-eslint/prefer-optional-chain': ['error'], //使用 a?.b 而不是 a && a.b
'@typescript-eslint/consistent-type-imports': ['error'], //使用 a?.b 而不是 a && a.b。
'@typescript-eslint/no-empty-interface': ['error'], //不允许定义空的接口
'@typescript-eslint/no-inferrable-types': ['error'], //不允许不必要的类型标注
'@typescript-eslint/no-non-null-asserted-optional-chain': ['error'], //不允许非空断言与可选链同时使用: foo?.bar!
'@typescript-eslint/no-throw-literal': ['error'], //不允许直接 throw 一个字符串
'@typescript-eslint/no-unnecessary-boolean-literal-compare': ['error'], //不允许对布尔类型变量的 === 比较,
'@typescript-eslint/no-unnecessary-type-arguments': ['error'], //不允许与默认值一致的泛型参数
'@typescript-eslint/no-unnecessary-type-assertion': ['error'], //不允许与实际值一致的类型断言
'@typescript-eslint/no-unnecessary-type-constraint': ['error'], //不允许与默认约束一致的泛型约束,
'@typescript-eslint/non-nullable-type-assertion-style': ['error'], //要求在类型断言仅起到去空值作用
'@typescript-eslint/prefer-as-const': ['error'], //对于常量断言,使用 as const 而不是 <const>
'@typescript-eslint/prefer-literal-enum-member': ['error'], //对于枚举成员值,只允许使用普通字符串、数字、null、正则,而不允许变量复制、模板字符串等需要计算的操作
'@typescript-eslint/prefer-ts-expect-error': ['error'], //使用 @ts-expect-error 而不是 @ts-ignore。
'@typescript-eslint/switch-exhaustiveness-check': ['error'], //switch 的判定条件为 联合类型 时,其每一个类型分支都需要被处理
"@typescript-eslint/no-var-requires": "0"
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。