123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757 |
- {
- "adjacent-overload-signatures": {
- "category": "typescript-specific",
- "description": "重载的函数必须写在一起",
- "ts-only": true
- },
- "ban-types": {
- "category": "typescript-specific",
- "description": "禁用特定的类型",
- "reason": "该规则用于禁止某个具体的类型的使用",
- "ts-only": true
- },
- "member-access": {
- "category": "typescript-specific",
- "description": "必须设置类的成员的可访问性",
- "reason": "将不需要公开的成员设为私有的,可以增强代码的可理解性,对文档输出也很友好",
- "ts-only": true,
- "has-fixer": true
- },
- "member-ordering": {
- "category": "typescript-specific",
- "description": "指定类成员的排序规则",
- "reason": "优先级:\n1. `static` > `instance`\n2. `field` > `constructor` > `method`\n3. `public` > `protected` > `private`",
- "has-fixer": true
- },
- "no-any": {
- "category": "typescript-specific",
- "description": "禁止使用 `any`",
- "reason": "太严格了",
- "ts-only": true
- },
- "no-empty-interface": {
- "category": "typescript-specific",
- "description": "禁止定义空的接口",
- "ts-only": true
- },
- "no-import-side-effect": {
- "category": "typescript-specific",
- "description": "禁止导入有副作用(立即执行)的模块,除了 `css`, `less`, `sass`, `scss`",
- "reason": "有副作用(立即执行)的模块无法控制其执行过程"
- },
- "no-inferrable-types": {
- "category": "typescript-specific",
- "description": "禁止给一个初始化时直接赋值为 `number`, `string` 或 `boolean` 的变量显式的指定类型",
- "reason": "可以简化代码,并且支持自动修复",
- "ts-only": true,
- "has-fixer": true
- },
- "no-internal-module": {
- "category": "typescript-specific",
- "description": "禁止使用 `module` 来定义命名空间",
- "reason": "`module` 已成为 js 的关键字",
- "ts-only": true,
- "has-fixer": true
- },
- "no-magic-numbers": {
- "category": "typescript-specific",
- "description": "禁止使用魔法数字,仅允许使用一部分白名单中的数字",
- "reason": "魔法数字无法理解"
- },
- "no-namespace": {
- "category": "typescript-specific",
- "description": "禁止使用 `namespace` 来定义命名空间",
- "reason": "使用 es6 引入模块,才是更标准的方式。\n允许使用 `declare namespace ... {}` 来定义外部命名空间",
- "ts-only": true
- },
- "no-non-null-assertion": {
- "category": "typescript-specific",
- "description": "禁止使用 non-null 断言(感叹号)",
- "reason": "non-null 断言不安全,最好使用条件语句把 `null` 排除掉比较好",
- "ts-only": true
- },
- "no-parameter-reassignment": {
- "category": "typescript-specific",
- "description": "禁止对函数的参数重新赋值"
- },
- "no-reference": {
- "category": "typescript-specific",
- "description": "禁止使用三斜线引入模块 `/// <reference path=\"foo\" />`",
- "reason": "引入模块时应使用更先进的 `import` 语法\n三斜线仅能用于引入一个类型文件 `/// <reference types=\"foo\" />`"
- },
- "no-unnecessary-type-assertion": {
- "category": "typescript-specific",
- "description": "禁止无用的类型断言",
- "reason": "Requires Type Info 的规则,无法在编辑器中显示错误,不方便修复",
- "ts-only": true,
- "has-fixer": true,
- "requires-type-info": true
- },
- "no-var-requires": {
- "category": "typescript-specific",
- "description": "禁止使用 `require` 来引入模块",
- "reason": "统一使用 `import` 来引入模块,特殊情况使用单行注释允许 `require` 引入",
- "ts-only": true
- },
- "only-arrow-functions": {
- "category": "typescript-specific",
- "description": "必须使用箭头函数,除非是单独的函数声明或是命名函数",
- "reason": "统一使用箭头函数,避免 `this` 指向问题"
- },
- "prefer-for-of": {
- "category": "typescript-specific",
- "description": "使用 `for` 循环遍历数组时,如果 `index` 仅用于获取成员,则必须使用 `for of` 循环替代 `for` 循环",
- "reason": "`for of` 循环更加易读"
- },
- "promise-function-async": {
- "category": "typescript-specific",
- "description": "`async` 函数的返回值必须是 `Promise`",
- "reason": "有时 `async` 函数在某个分支是同步的,不需要返回 `Promise`\nRequires Type Info 的规则,无法在编辑器中显示错误,不方便修复",
- "requires-type-info": true
- },
- "typedef": {
- "category": "typescript-specific",
- "description": "变量、函数返回值、函数参数等必须要有类型定义",
- "reason": "大部分类型都可以依靠类型推论,没必要全部手动定义",
- "ts-only": true
- },
- "typedef-whitespace": {
- "category": "typescript-specific",
- "description": "类型定义的冒号前面必须没有空格,后面必须有一个空格",
- "ts-only": true,
- "has-fixer": true,
- "prettier": true
- },
- "unified-signatures": {
- "category": "typescript-specific",
- "description": "函数重载时,若能通过联合类型将两个函数的类型声明合为一个,则使用联合类型而不是两个函数声明",
- "ts-only": true
- },
- "await-promise": {
- "category": "functionality",
- "description": "`await` 必须接受 `Promise`",
- "reason": "promise-function-async 里已经允许 `async` 函数返回值为非 `Promise` 了,故也应该允许 `await` 接受非 `Promise`\nRequires Type Info 的规则,无法在编辑器中显示错误,不方便修复",
- "ts-only": true,
- "requires-type-info": true
- },
- "ban": {
- "category": "functionality",
- "description": "禁用指定的函数或全局方法",
- "reason": "用于限制某个具体的函数不能使用"
- },
- "ban-comma-operator": { "category": "functionality", "description": "禁止使用逗号操作符" },
- "curly": {
- "category": "functionality",
- "description": "`if` 后面必须有 `{`,除非是单行 `if`",
- "has-fixer": true
- },
- "forin": { "category": "functionality", "description": "`for in` 内部必须有 `hasOwnProperty`" },
- "import-blacklist": {
- "category": "functionality",
- "description": "禁用指定的模块",
- "reason": "用于限制某个具体的模块不能使用"
- },
- "label-position": {
- "category": "functionality",
- "description": "只允许在 `do`, `for`, `while` 或 `switch` 中使用 `label`",
- "reason": "在任何情况都不应该使用 `label`"
- },
- "no-arg": { "category": "functionality", "description": "禁止使用 `arguments.callee`" },
- "no-bitwise": {
- "category": "functionality",
- "description": "禁止使用位运算",
- "reason": "位运算很常见"
- },
- "no-conditional-assignment": {
- "category": "functionality",
- "description": "禁止在分支条件判断中有赋值操作"
- },
- "no-console": {
- "category": "functionality",
- "description": "禁止使用 `console`",
- "reason": "没必要禁止,会让 autofixOnSave 很不方便"
- },
- "no-construct": {
- "category": "functionality",
- "description": "禁止使用 `new` 来生成 `String`, `Number` 或 `Boolean`"
- },
- "no-debugger": {
- "category": "functionality",
- "description": "禁止使用 `debugger`",
- "reason": "没必要禁止,会让 autofixOnSave 很不方便"
- },
- "no-duplicate-super": {
- "category": "functionality",
- "description": "禁止 `super` 在一个构造函数中出现两次"
- },
- "no-duplicate-switch-case": {
- "category": "functionality",
- "description": "禁止在 `switch` 语句中出现重复测试表达式的 `case`"
- },
- "no-duplicate-variable": {
- "category": "functionality",
- "description": "禁止出现重复的变量定义或函数参数名"
- },
- "no-dynamic-delete": {
- "category": "functionality",
- "description": "禁止 `delete` 动态的值",
- "reason": "没必要限制"
- },
- "no-empty": {
- "category": "functionality",
- "description": "禁止出现空代码块,允许 `catch` 是空代码块"
- },
- "no-eval": { "category": "functionality", "description": "禁止使用 `eval`" },
- "no-floating-promises": {
- "category": "functionality",
- "description": "函数返回值为 `Promise` 时,必须被处理",
- "reason": "太严格了\nRequires Type Info 的规则,无法在编辑器中显示错误,不方便修复",
- "ts-only": true,
- "requires-type-info": true
- },
- "no-for-in-array": {
- "category": "functionality",
- "description": "禁止对 `array` 使用 `for in` 循环",
- "reason": "没必要限制\nRequires Type Info 的规则,无法在编辑器中显示错误,不方便修复",
- "requires-type-info": true
- },
- "no-implicit-dependencies": {
- "category": "functionality",
- "description": "禁止引入 `package.json` 中不存在的模块"
- },
- "no-inferred-empty-object-type": {
- "category": "functionality",
- "description": "禁止推论出的类型是空对象类型",
- "reason": "没必要限制\nRequires Type Info 的规则,无法在编辑器中显示错误,不方便修复",
- "ts-only": true,
- "requires-type-info": true
- },
- "no-invalid-template-strings": {
- "category": "functionality",
- "description": "禁止在非模版字符串中出现 `${}`"
- },
- "no-invalid-this": {
- "category": "functionality",
- "description": "禁止在类外面使用 `this`",
- "reason": "禁止滥用 `this`,如需使用,在文件中局部禁用此规则即可"
- },
- "no-misused-new": {
- "category": "functionality",
- "description": "禁止在接口中定义 `constructor`,或在类中定义 `new`",
- "ts-only": true
- },
- "no-null-keyword": {
- "category": "functionality",
- "description": "禁止使用 `null`",
- "reason": "没必要限制",
- "has-fixer": true
- },
- "no-object-literal-type-assertion": {
- "category": "functionality",
- "description": "禁止对对象字面量进行类型断言(断言成 `any` 是允许的)",
- "ts-only": true
- },
- "no-return-await": {
- "category": "functionality",
- "description": "禁止没必要的 `return await`",
- "reason": "`return await` 用起来没问题",
- "has-fixer": true
- },
- "no-shadowed-variable": {
- "category": "functionality",
- "description": "禁止变量名与上层作用域内的定义过的变量重复",
- "reason": "很多时候函数的形参和传参是同名的"
- },
- "no-sparse-arrays": {
- "category": "functionality",
- "description": "禁止在数组中出现连续的逗号,如 `let foo = [,,]`"
- },
- "no-string-literal": {
- "category": "functionality",
- "description": "禁止出现 `foo['bar']`,必须写成 `foo.bar`",
- "has-fixer": true
- },
- "no-string-throw": {
- "category": "functionality",
- "description": "禁止 `throw` 字符串,必须 `throw` 一个 `Error` 对象",
- "has-fixer": true
- },
- "no-submodule-imports": {
- "category": "functionality",
- "description": "禁止 `import` 模块的子文件",
- "reason": "没必要限制"
- },
- "no-switch-case-fall-through": {
- "category": "functionality",
- "description": "`switch` 的 `case` 必须 `return` 或 `break`"
- },
- "no-this-assignment": {
- "category": "functionality",
- "description": "禁止将 `this` 赋值给其他变量,除非是解构赋值"
- },
- "no-unbound-method": {
- "category": "functionality",
- "description": "使用实例的方法时,必须 `bind` 到实例上",
- "reason": "Requires Type Info 的规则,无法在编辑器中显示错误,不方便修复",
- "ts-only": true,
- "requires-type-info": true
- },
- "no-unnecessary-class": {
- "category": "functionality",
- "description": "禁止定义没必要的类,比如只有静态方法的类",
- "reason": "没必要限制"
- },
- "no-unsafe-any": {
- "category": "functionality",
- "description": "禁止取用一个类型为 `any` 的对象的属性",
- "reason": "太严格了\nRequires Type Info 的规则,无法在编辑器中显示错误,不方便修复",
- "ts-only": true,
- "requires-type-info": true
- },
- "no-unsafe-finally": {
- "category": "functionality",
- "description": "禁止 `finally` 内出现 `return`, `continue`, `break`, `throw` 等",
- "reason": "`finally` 会比 `catch` 先执行"
- },
- "no-unused-expression": { "category": "functionality", "description": "禁止无用的表达式" },
- "no-use-before-declare": {
- "category": "functionality",
- "description": "变量必须先定义后使用",
- "reason": "循环引用没法处理\nRequires Type Info 的规则,无法在编辑器中显示错误,不方便修复",
- "requires-type-info": true
- },
- "no-var-keyword": {
- "category": "functionality",
- "description": "禁止使用 `var`",
- "has-fixer": true
- },
- "no-void-expression": {
- "category": "functionality",
- "description": "禁止返回值为 `void` 类型",
- "reason": "没必要限制,`void` 很常用\nRequires Type Info 的规则,无法在编辑器中显示错误,不方便修复",
- "requires-type-info": true
- },
- "prefer-conditional-expression": {
- "category": "functionality",
- "description": "可以用三元表达式时,就不用 `if else`",
- "reason": "没必要限制"
- },
- "prefer-object-spread": {
- "category": "functionality",
- "description": "使用 `{ ...foo, bar: 1 }` 代替 `Object.assign({}, foo, { bar: 1 })`",
- "reason": "前者的类型检查更完善",
- "has-fixer": true
- },
- "radix": { "category": "functionality", "description": "`parseInt` 必须传入第二个参数" },
- "restrict-plus-operands": {
- "category": "functionality",
- "description": "使用加号时,两者必须同为数字或同为字符串",
- "reason": "太严格了\nRequires Type Info 的规则,无法在编辑器中显示错误,不方便修复",
- "requires-type-info": true
- },
- "strict-boolean-expressions": {
- "category": "functionality",
- "description": "在分支条件判断中必须传入布尔类型的值",
- "reason": "太严格了\nRequires Type Info 的规则,无法在编辑器中显示错误,不方便修复",
- "ts-only": true,
- "requires-type-info": true
- },
- "strict-type-predicates": {
- "category": "functionality",
- "description": "禁止出现永远为 `true` 或永远为 `false` 的条件判断(通过类型预测出一个表达式为 `true` 还是 `false`)",
- "reason": "没必要限制\nRequires Type Info 的规则,无法在编辑器中显示错误,不方便修复",
- "ts-only": true,
- "requires-type-info": true
- },
- "switch-default": {
- "category": "functionality",
- "description": "`switch` 语句必须有 `default`"
- },
- "triple-equals": {
- "category": "functionality",
- "description": "必须使用 `===` 或 `!==`,禁止使用 `==` 或 `!=`"
- },
- "typeof-compare": {
- "category": "functionality",
- "description": "`typeof` 表达式比较的对象必须是 `'undefined'`, `'object'`, `'boolean'`, `'number'`, `'string'`, `'function'` 或 `'symbol'`",
- "reason": "TypeScirpt 2.2 之后,编译器已经只带了这个功能"
- },
- "use-default-type-parameter": {
- "category": "functionality",
- "description": "传入的类型与默认类型一致时,必须省略传入的类型",
- "reason": "没必要限制\nRequires Type Info 的规则,无法在编辑器中显示错误,不方便修复",
- "ts-only": true,
- "requires-type-info": true
- },
- "use-isnan": {
- "category": "functionality",
- "description": "必须使用 `isNaN(foo)` 而不是 `foo === NaN`"
- },
- "cyclomatic-complexity": {
- "category": "maintainability",
- "description": "禁止函数的循环复杂度超过 20,详见 https://en.wikipedia.org/wiki/Cyclomatic_complexity"
- },
- "deprecation": {
- "category": "maintainability",
- "description": "禁止使用废弃(被标识了 `@deprecated`)的 API",
- "reason": "太严格了\nRequires Type Info 的规则,无法在编辑器中显示错误,不方便修复",
- "requires-type-info": true
- },
- "eofline": {
- "category": "maintainability",
- "description": "文件最后一行必须有一个空行",
- "has-fixer": true,
- "prettier": true
- },
- "indent": {
- "category": "maintainability",
- "description": "一个缩进必须用四个空格替代",
- "has-fixer": true,
- "prettier": true
- },
- "linebreak-style": {
- "category": "maintainability",
- "description": "限制换行符为 LF 或 CRLF",
- "reason": "没必要限制",
- "has-fixer": true,
- "prettier": true
- },
- "max-classes-per-file": {
- "category": "maintainability",
- "description": "限制每个文件的类的数量",
- "reason": "没必要限制"
- },
- "max-file-line-count": {
- "category": "maintainability",
- "description": "限制每个文件的行数",
- "reason": "没必要限制"
- },
- "max-line-length": {
- "category": "maintainability",
- "description": "限制每行字符数",
- "reason": "没必要限制",
- "prettier": true
- },
- "no-default-export": {
- "category": "maintainability",
- "description": "禁止使用 `default export`",
- "reason": "没必要限制"
- },
- "no-duplicate-imports": {
- "category": "maintainability",
- "description": "禁止出现重复的 `import`"
- },
- "no-mergeable-namespace": {
- "category": "maintainability",
- "description": "禁止一个文件中出现多个相同的 `namespace`",
- "ts-only": true
- },
- "no-require-imports": {
- "category": "maintainability",
- "description": "禁止使用 `require`",
- "reason": "有时需要动态引入,还是需要用 `require`"
- },
- "object-literal-sort-keys": {
- "category": "maintainability",
- "description": "对象字面量必须按 `key` 排序",
- "reason": "太严格了"
- },
- "prefer-const": {
- "category": "maintainability",
- "description": "申明后不再被修改的变量必须使用 `const` 来申明",
- "reason": "没必要强制要求",
- "has-fixer": true
- },
- "prefer-readonly": {
- "category": "maintainability",
- "description": "如果私有变量只在构造函数中被赋值,则必须使用 `readonly` 修饰符",
- "reason": "没必要限制\nRequires Type Info 的规则,无法在编辑器中显示错误,不方便修复",
- "ts-only": true,
- "requires-type-info": true
- },
- "trailing-comma": {
- "category": "maintainability",
- "description": "限制对象、数组、解构赋值等的最后一项末尾是否需要逗号",
- "has-fixer": true,
- "prettier": true
- },
- "align": {
- "category": "style",
- "description": "变量定义需要竖向对其",
- "reason": "没必要限制",
- "has-fixer": true,
- "prettier": true
- },
- "array-type": {
- "category": "style",
- "description": "限制必须使用 `T[]` 或 `Array<T>` 之中的一种来定义数组的类型",
- "reason": "没必要限制",
- "ts-only": true,
- "has-fixer": true
- },
- "arrow-parens": {
- "category": "style",
- "description": "箭头函数的参数必须有小括号",
- "has-fixer": true,
- "prettier": true
- },
- "arrow-return-shorthand": {
- "category": "style",
- "description": "箭头函数的函数体只有 `return` 语句的时候,必须简写",
- "has-fixer": true
- },
- "binary-expression-operand-order": {
- "category": "style",
- "description": "数字字面量必须在加号的右边,即禁止 `1 + x`",
- "reason": "没必要限制"
- },
- "callable-types": {
- "category": "style",
- "description": "可以简写为函数类型的接口或字面类似,必须简写",
- "ts-only": true,
- "has-fixer": true
- },
- "class-name": { "category": "style", "description": "类名与接口名必须为驼峰式" },
- "comment-format": {
- "category": "style",
- "description": "限制单行注释的规则",
- "has-fixer": true
- },
- "completed-docs": {
- "category": "style",
- "description": "类、函数等必须写注释",
- "reason": "太严格了\nRequires Type Info 的规则,无法在编辑器中显示错误,不方便修复",
- "requires-type-info": true
- },
- "encoding": { "category": "style", "description": "文件类型必须是 utf-8" },
- "file-header": {
- "category": "style",
- "description": "文件的开头必须有指定的字符串",
- "reason": "太严格了",
- "has-fixer": true
- },
- "file-name-casing": {
- "category": "style",
- "description": "约束文件命名规范",
- "reason": "没必要约束"
- },
- "import-spacing": {
- "category": "style",
- "description": "`import` 语句中,关键字之间的间距必须是一个空格",
- "prettier": true
- },
- "interface-name": {
- "category": "style",
- "description": "接口名称必须已 `I` 开头",
- "reason": "没必要限制",
- "ts-only": true
- },
- "interface-over-type-literal": {
- "category": "style",
- "description": "优先使用接口而不是字面类型",
- "reason": "接口可以 `implement` `extend` 和 `merge`",
- "ts-only": true,
- "has-fixer": true
- },
- "jsdoc-format": { "category": "style", "description": "注释必须符合 JSDoc 规范" },
- "match-default-export-name": {
- "category": "style",
- "description": "`import` 的名称必须和 `export default` 的名称一致",
- "reason": "没必要限制\nRequires Type Info 的规则,无法在编辑器中显示错误,不方便修复",
- "ts-only": true,
- "requires-type-info": true
- },
- "new-parens": {
- "category": "style",
- "description": "`new` 后面只必须有一个空格",
- "prettier": true
- },
- "newline-before-return": {
- "category": "style",
- "description": "`return` 语句前必须有空行",
- "reason": "没必要有空行"
- },
- "newline-per-chained-call": {
- "category": "style",
- "description": "链式调用时,每次调用都必须占用一行",
- "reason": "没必要限制",
- "prettier": true
- },
- "no-angle-bracket-type-assertion": {
- "category": "style",
- "description": "类型断言必须使用 `as Type`,禁止使用 `<Type>`",
- "reason": "`<Type>` 容易被理解为 jsx",
- "ts-only": true,
- "has-fixer": true
- },
- "no-boolean-literal-compare": {
- "category": "style",
- "description": "禁止变量与 `true` 或 `false` 比较",
- "reason": "没必要限制\nRequires Type Info 的规则,无法在编辑器中显示错误,不方便修复",
- "ts-only": true,
- "has-fixer": true,
- "requires-type-info": true
- },
- "no-consecutive-blank-lines": {
- "category": "style",
- "description": "禁止连续超过三行空行",
- "has-fixer": true,
- "prettier": true
- },
- "no-irregular-whitespace": {
- "category": "style",
- "description": "禁止使用特殊空白符(比如全角空格)",
- "has-fixer": true,
- "prettier": true
- },
- "no-parameter-properties": {
- "category": "style",
- "description": "禁止给类的构造函数的参数添加修饰符",
- "ts-only": true
- },
- "no-redundant-jsdoc": {
- "category": "style",
- "description": "禁止 JSDoc 中的冗余类型声明,因为 TypeScirpt 已经包含了大部分功能",
- "ts-only": true
- },
- "no-reference-import": {
- "category": "style",
- "description": "如果已经引入过库,则禁止使用三斜杠引入类型定义文件",
- "ts-only": true
- },
- "no-trailing-whitespace": {
- "category": "style",
- "description": "禁止行尾有空格",
- "has-fixer": true,
- "prettier": true
- },
- "no-unnecessary-callback-wrapper": {
- "category": "style",
- "description": "禁止没必要的函数调用,如 `x => f(x)` 应该简写为 `f`",
- "reason": "没必要限制"
- },
- "no-unnecessary-initializer": {
- "category": "style",
- "description": "禁止变量定义时赋值为 `undefined`",
- "has-fixer": true
- },
- "no-unnecessary-qualifier": {
- "category": "style",
- "description": "在命名空间中,可以直接使用内部变量,不需要添加命名空间前缀",
- "reason": "已经禁止使用命名空间了\nRequires Type Info 的规则,无法在编辑器中显示错误,不方便修复",
- "ts-only": true,
- "has-fixer": true,
- "requires-type-info": true
- },
- "number-literal-format": {
- "category": "style",
- "description": "小数必须以 `0.` 开头,禁止以 `.` 开头,并且不能以 `0` 结尾",
- "prettier": true
- },
- "object-literal-key-quotes": {
- "category": "style",
- "description": "对象的 key 必须用引号包起来",
- "reason": "没必要限制",
- "has-fixer": true,
- "prettier": true
- },
- "object-literal-shorthand": {
- "category": "style",
- "description": "必须使用 `a = {b}` 而不是 `a = {b: b}`",
- "has-fixer": true
- },
- "one-line": {
- "category": "style",
- "description": "`if` 后的 `{` 禁止换行",
- "has-fixer": true,
- "prettier": true
- },
- "one-variable-per-declaration": {
- "category": "style",
- "description": "变量申明必须每行一个,`for` 循环的初始条件中除外"
- },
- "ordered-imports": {
- "category": "style",
- "description": "`import` 必须排序",
- "has-fixer": true
- },
- "prefer-function-over-method": {
- "category": "style",
- "description": "类中没有使用 `this` 的方法应该提取成类外的函数",
- "reason": "太严格了"
- },
- "prefer-method-signature": {
- "category": "style",
- "description": "必须使用 `foo(): void` 而不是 `foo: () => void`",
- "reason": "没必要限制",
- "has-fixer": true
- },
- "prefer-switch": {
- "category": "style",
- "description": "当 `if` 中只有 `===` 时,必须使用 `switch` 替换 `if`",
- "reason": "没必要限制"
- },
- "prefer-template": {
- "category": "style",
- "description": "必须使用模版字符串而不是字符串连接",
- "reason": "字符串连接很常用"
- },
- "prefer-while": {
- "category": "style",
- "description": "当没有初始值的时候,必须使用 `while` 而不是 `for`",
- "reason": "没必要限制",
- "has-fixer": true
- },
- "quotemark": {
- "category": "style",
- "description": "必须使用单引号,jsx 中必须使用双引号",
- "has-fixer": true,
- "prettier": true
- },
- "return-undefined": {
- "category": "style",
- "description": "使用 `return;` 而不是 `return undefined;`",
- "reason": "没必要限制\nRequires Type Info 的规则,无法在编辑器中显示错误,不方便修复",
- "requires-type-info": true
- },
- "semicolon": {
- "category": "style",
- "description": "行尾必须有分号",
- "has-fixer": true,
- "prettier": true
- },
- "space-before-function-paren": {
- "category": "style",
- "description": "函数名前必须有空格",
- "has-fixer": true,
- "prettier": true
- },
- "space-within-parens": {
- "category": "style",
- "description": "括号内首尾禁止有空格",
- "has-fixer": true,
- "prettier": true
- },
- "switch-final-break": {
- "category": "style",
- "description": "`switch` 的最后一项禁止有 `break`",
- "reason": "没必要限制",
- "has-fixer": true
- },
- "type-literal-delimiter": {
- "category": "style",
- "description": "字面类型的每个成员都必须有分号",
- "ts-only": true
- },
- "variable-name": {
- "category": "style",
- "description": "限制变量命名规则",
- "reason": "没必要限制"
- },
- "whitespace": {
- "category": "style",
- "description": "限制空格的位置",
- "has-fixer": true,
- "prettier": true
- }
- }
|