tslint.json 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. {
  2. "defaultSeverity": "warning",
  3. "extends": [
  4. "tslint:recommended"
  5. ],
  6. "linterOptions": {
  7. "exclude": [
  8. "node_modules/**"
  9. ]
  10. },
  11. "rules": {
  12. "quotemark": false,
  13. // 字符串文字需要单引号或双引号。
  14. "indent": false,
  15. // 使用制表符或空格强制缩进。
  16. "member-access": false,
  17. // 需要类成员的显式可见性声明。
  18. "interface-name": false,
  19. // 接口名要求大写开头
  20. "ordered-imports": false,
  21. // 要求将import语句按字母顺序排列并进行分组。
  22. "object-literal-sort-keys": false,
  23. // 检查对象文字中键的排序。
  24. "no-consecutive-blank-lines": false,
  25. // 不允许连续出现一个或多个空行。
  26. "no-shadowed-variable": false,
  27. // 不允许隐藏变量声明。
  28. "no-trailing-whitespace": false,
  29. // 不允许在行尾添加尾随空格。
  30. "semicolon": false,
  31. // 是否分号结尾
  32. "trailing-comma": false,
  33. // 是否强象添加逗号
  34. "eofline": false,
  35. // 是否末尾另起一行
  36. "prefer-conditional-expression": false,
  37. // for (... in ...)语句必须用if语句过滤
  38. "curly": true,
  39. //for if do while 要有括号
  40. "forin": false,
  41. //用for in 必须用if进行过滤
  42. "import-blacklist": true,
  43. //允许使用import require导入具体的模块
  44. "no-arg": true,
  45. //不允许使用 argument.callee
  46. "no-bitwise": true,
  47. //不允许使用按位运算符
  48. "no-console": false,
  49. //不能使用console
  50. "no-construct": true,
  51. //不允许使用 String/Number/Boolean的构造函数
  52. "no-debugger": true,
  53. //不允许使用debugger
  54. "no-duplicate-super": true,
  55. //构造函数两次用super会发出警告
  56. "no-empty": false,
  57. //不允许空的块
  58. "no-eval": true,
  59. //不允许使用eval
  60. "no-floating-promises": false,
  61. //必须正确处理promise的返回函数
  62. "no-for-in-array": false,
  63. //不允许使用for in 遍历数组
  64. "no-implicit-dependencies": false,
  65. //不允许在项目的package.json中导入未列为依赖项的模块
  66. "no-inferred-empty-object-type": false,
  67. //不允许在函数和构造函数中使用{}的类型推断
  68. "no-invalid-template-strings": true,
  69. //警告在非模板字符中使用${
  70. "no-invalid-this": true,
  71. //不允许在非class中使用 this关键字
  72. "no-misused-new": true,
  73. //禁止定义构造函数或new class
  74. "no-null-keyword": false,
  75. //不允许使用null关键字
  76. "no-object-literal-type-assertion": false,
  77. //禁止object出现在类型断言表达式中
  78. "no-return-await": true,
  79. //不允许return await
  80. "arrow-parens": false,
  81. //箭头函数定义的参数需要括号
  82. "adjacent-overload-signatures": false,
  83. // Enforces function overloads to be consecutive.
  84. "ban-comma-operator": true,
  85. //禁止逗号运算符。
  86. "no-any": false,
  87. //不需使用any类型
  88. "no-empty-interface": true,
  89. //禁止空接口 {}
  90. "no-internal-module": true,
  91. //不允许内部模块
  92. "no-magic-numbers": false,
  93. //不允许在变量赋值之外使用常量数值。当没有指定允许值列表时,默认允许-1,0和1
  94. "no-namespace": [
  95. //不允许使用内部modules和命名空间
  96. true,
  97. "allow-declarations"
  98. ],
  99. "no-non-null-assertion": true,
  100. //不允许使用!后缀操作符的非空断言。
  101. "no-parameter-reassignment": false,
  102. //不允许重新分配参数
  103. "no-reference": true,
  104. // 禁止使用/// <reference path=> 导入 ,使用import代替
  105. "no-unnecessary-type-assertion": false,
  106. //如果类型断言没有改变表达式的类型就发出警告
  107. "no-var-requires": false,
  108. //不允许使用var module = require("module"),用 import foo = require('foo')导入
  109. "prefer-for-of": true,
  110. //建议使用for(..of)
  111. "promise-function-async": false,
  112. //要求异步函数返回promise
  113. "max-classes-per-file": [
  114. // 一个脚本最多几个申明类
  115. true,
  116. 2
  117. ],
  118. "max-line-length": false,
  119. "variable-name": false,
  120. "prefer-const": false,
  121. // 提示可以用const的地方
  122. "object-literal-shorthand": false
  123. // 必须使用 a = {b} 而不是 a = {b: b}
  124. }
  125. }