{ "defaultSeverity": "warning", "extends": [ "tslint:recommended" ], "linterOptions": { "exclude": [ "node_modules/**" ] }, "rules": { "quotemark": false, // 字符串文字需要单引号或双引号。 "indent": false, // 使用制表符或空格强制缩进。 "member-access": false, // 需要类成员的显式可见性声明。 "interface-name": false, // 接口名要求大写开头 "ordered-imports": false, // 要求将import语句按字母顺序排列并进行分组。 "object-literal-sort-keys": false, // 检查对象文字中键的排序。 "no-consecutive-blank-lines": false, // 不允许连续出现一个或多个空行。 "no-shadowed-variable": false, // 不允许隐藏变量声明。 "no-trailing-whitespace": false, // 不允许在行尾添加尾随空格。 "semicolon": false, // 是否分号结尾 "trailing-comma": false, // 是否强象添加逗号 "eofline": false, // 是否末尾另起一行 "prefer-conditional-expression": false, // for (... in ...)语句必须用if语句过滤 "curly": true, //for if do while 要有括号 "forin": false, //用for in 必须用if进行过滤 "import-blacklist": true, //允许使用import require导入具体的模块 "no-arg": true, //不允许使用 argument.callee "no-bitwise": true, //不允许使用按位运算符 "no-console": false, //不能使用console "no-construct": true, //不允许使用 String/Number/Boolean的构造函数 "no-debugger": true, //不允许使用debugger "no-duplicate-super": true, //构造函数两次用super会发出警告 "no-empty": false, //不允许空的块 "no-eval": true, //不允许使用eval "no-floating-promises": false, //必须正确处理promise的返回函数 "no-for-in-array": false, //不允许使用for in 遍历数组 "no-implicit-dependencies": false, //不允许在项目的package.json中导入未列为依赖项的模块 "no-inferred-empty-object-type": false, //不允许在函数和构造函数中使用{}的类型推断 "no-invalid-template-strings": true, //警告在非模板字符中使用${ "no-invalid-this": true, //不允许在非class中使用 this关键字 "no-misused-new": true, //禁止定义构造函数或new class "no-null-keyword": false, //不允许使用null关键字 "no-object-literal-type-assertion": false, //禁止object出现在类型断言表达式中 "no-return-await": true, //不允许return await "arrow-parens": false, //箭头函数定义的参数需要括号 "adjacent-overload-signatures": false, // Enforces function overloads to be consecutive. "ban-comma-operator": true, //禁止逗号运算符。 "no-any": false, //不需使用any类型 "no-empty-interface": true, //禁止空接口 {} "no-internal-module": true, //不允许内部模块 "no-magic-numbers": false, //不允许在变量赋值之外使用常量数值。当没有指定允许值列表时,默认允许-1,0和1 "no-namespace": [ //不允许使用内部modules和命名空间 true, "allow-declarations" ], "no-non-null-assertion": true, //不允许使用!后缀操作符的非空断言。 "no-parameter-reassignment": false, //不允许重新分配参数 "no-reference": true, // 禁止使用/// 导入 ,使用import代替 "no-unnecessary-type-assertion": false, //如果类型断言没有改变表达式的类型就发出警告 "no-var-requires": false, //不允许使用var module = require("module"),用 import foo = require('foo')导入 "prefer-for-of": true, //建议使用for(..of) "promise-function-async": false, //要求异步函数返回promise "max-classes-per-file": [ // 一个脚本最多几个申明类 true, 2 ], "max-line-length": false, "variable-name": false, "prefer-const": false, // 提示可以用const的地方 "object-literal-shorthand": false // 必须使用 a = {b} 而不是 a = {b: b} } }