.eslintrc.json 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. {
  2. "env": {
  3. "browser": true,
  4. "es6": true,
  5. "node": true
  6. },
  7. "parser": "@typescript-eslint/parser",
  8. "parserOptions": {
  9. "project": [
  10. "src/browser/tsconfig.json",
  11. "src/common/tsconfig.json",
  12. "test/api/tsconfig.json",
  13. "test/benchmark/tsconfig.json",
  14. "addons/xterm-addon-attach/src/tsconfig.json",
  15. "addons/xterm-addon-attach/test/tsconfig.json",
  16. "addons/xterm-addon-fit/src/tsconfig.json",
  17. "addons/xterm-addon-fit/test/tsconfig.json",
  18. "addons/xterm-addon-ligatures/src/tsconfig.json",
  19. "addons/xterm-addon-search/src/tsconfig.json",
  20. "addons/xterm-addon-search/test/tsconfig.json",
  21. "addons/xterm-addon-serialize/src/tsconfig.json",
  22. "addons/xterm-addon-serialize/test/tsconfig.json",
  23. "addons/xterm-addon-serialize/benchmark/tsconfig.json",
  24. "addons/xterm-addon-unicode11/src/tsconfig.json",
  25. "addons/xterm-addon-unicode11/test/tsconfig.json",
  26. "addons/xterm-addon-web-links/src/tsconfig.json",
  27. "addons/xterm-addon-web-links/test/tsconfig.json",
  28. "addons/xterm-addon-webgl/src/tsconfig.json",
  29. "addons/xterm-addon-webgl/test/tsconfig.json"
  30. ],
  31. "sourceType": "module"
  32. },
  33. "ignorePatterns": [
  34. "**/typings/*.d.ts",
  35. "**/node_modules",
  36. "**/*.js"
  37. ],
  38. "plugins": [
  39. "@typescript-eslint"
  40. ],
  41. "rules": {
  42. "no-extra-semi": "error",
  43. "@typescript-eslint/array-type": [
  44. "warn",
  45. {
  46. "default": "array-simple",
  47. "readonly": "generic"
  48. }
  49. ],
  50. "@typescript-eslint/consistent-type-definitions": "warn",
  51. "@typescript-eslint/explicit-function-return-type": [
  52. "warn",
  53. {
  54. "allowExpressions": true
  55. }
  56. ],
  57. "@typescript-eslint/explicit-member-accessibility": [
  58. "warn",
  59. {
  60. "accessibility": "explicit",
  61. "overrides": {
  62. "constructors": "off"
  63. }
  64. }
  65. ],
  66. "@typescript-eslint/indent": [
  67. "warn",
  68. 2
  69. ],
  70. "@typescript-eslint/member-delimiter-style": [
  71. "warn",
  72. {
  73. "multiline": {
  74. "delimiter": "semi",
  75. "requireLast": true
  76. },
  77. "singleline": {
  78. "delimiter": "comma",
  79. "requireLast": false
  80. }
  81. }
  82. ],
  83. "@typescript-eslint/naming-convention": [
  84. "warn",
  85. { "selector": "default", "format": ["camelCase"] },
  86. // variableLike
  87. { "selector": "variable", "format": ["camelCase", "UPPER_CASE"] },
  88. { "selector": "variable", "filter": "^I.+Service$", "format": ["PascalCase"], "prefix": ["I"] },
  89. // memberLike
  90. { "selector": "memberLike", "modifiers": ["private"], "format": ["camelCase"], "leadingUnderscore": "require" },
  91. { "selector": "memberLike", "modifiers": ["protected"], "format": ["camelCase"], "leadingUnderscore": "require" },
  92. { "selector": "enumMember", "format": ["UPPER_CASE"] },
  93. // memberLike - Allow enum-like objects to use UPPER_CASE
  94. { "selector": "property", "modifiers": ["public"], "format": ["camelCase", "UPPER_CASE"] },
  95. { "selector": "method", "modifiers": ["public"], "format": ["camelCase", "UPPER_CASE"] },
  96. // typeLike
  97. { "selector": "typeLike", "format": ["PascalCase"] },
  98. { "selector": "interface", "format": ["PascalCase"], "prefix": ["I"] }
  99. ],
  100. "@typescript-eslint/prefer-namespace-keyword": "warn",
  101. "@typescript-eslint/type-annotation-spacing": "warn",
  102. "@typescript-eslint/quotes": [
  103. "warn",
  104. "single",
  105. { "allowTemplateLiterals": true }
  106. ],
  107. "@typescript-eslint/semi": [
  108. "warn",
  109. "always"
  110. ],
  111. "comma-dangle": [
  112. "warn",
  113. {
  114. "objects": "never",
  115. "arrays": "never",
  116. "functions": "never"
  117. }
  118. ],
  119. "curly": [
  120. "warn",
  121. "multi-line"
  122. ],
  123. "eol-last": "warn",
  124. "eqeqeq": [
  125. "warn",
  126. "always"
  127. ],
  128. "keyword-spacing": "warn",
  129. "new-parens": "warn",
  130. "no-duplicate-imports": "warn",
  131. "no-else-return": [
  132. "warn",
  133. {
  134. "allowElseIf": false
  135. }
  136. ],
  137. "no-eval": "warn",
  138. "no-irregular-whitespace": "warn",
  139. "no-restricted-imports": [
  140. "warn",
  141. {
  142. "patterns": [
  143. ".*\\/out\\/.*"
  144. ]
  145. }
  146. ],
  147. "no-trailing-spaces": "warn",
  148. "no-unsafe-finally": "warn",
  149. "no-var": "warn",
  150. "one-var": [
  151. "warn",
  152. "never"
  153. ],
  154. "object-curly-spacing": [
  155. "warn",
  156. "always"
  157. ],
  158. "prefer-const": "warn",
  159. "spaced-comment": [
  160. "warn",
  161. "always",
  162. {
  163. "markers": ["/"],
  164. "exceptions": ["-"]
  165. }
  166. ]
  167. },
  168. "overrides": [
  169. {
  170. "files": ["**/*.test.ts"],
  171. "rules": {
  172. "object-curly-spacing": "off"
  173. }
  174. }
  175. ]
  176. }