No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

333 líneas
10 KiB

  1. {
  2. "env": {
  3. "es6": true
  4. },
  5. "extends": [
  6. "eslint:recommended",
  7. "plugin:@typescript-eslint/strict-type-checked",
  8. "plugin:@typescript-eslint/stylistic-type-checked",
  9. "plugin:import/recommended",
  10. "plugin:import/typescript",
  11. "prettier"
  12. ],
  13. "parser": "@typescript-eslint/parser",
  14. "parserOptions": {
  15. "ecmaVersion": 2022,
  16. "sourceType": "module",
  17. "ecmaFeatures": {
  18. "impliedStrict": true
  19. },
  20. "project": true
  21. },
  22. "plugins": ["anti-trojan-source", "import", "@typescript-eslint"],
  23. "reportUnusedDisableDirectives": true,
  24. "root": true,
  25. "rules": {
  26. "anti-trojan-source/no-bidi": "error",
  27. "arrow-parens": ["off"],
  28. "brace-style": ["off", "stroustrup"],
  29. "consistent-return": "off",
  30. "curly": ["error", "multi-line", "consistent"],
  31. "eol-last": "error",
  32. "linebreak-style": ["error", "unix"],
  33. "new-parens": "error",
  34. "no-console": "off",
  35. "no-constant-condition": ["warn", { "checkLoops": false }],
  36. "no-constant-binary-expression": "error",
  37. "no-caller": "error",
  38. "no-debugger": "off",
  39. "no-dupe-class-members": "off",
  40. "no-else-return": "warn",
  41. "no-empty": ["warn", { "allowEmptyCatch": true }],
  42. "no-eval": "error",
  43. "no-ex-assign": "warn",
  44. "no-extend-native": "error",
  45. "no-extra-bind": "error",
  46. "no-floating-decimal": "error",
  47. "no-implicit-coercion": "error",
  48. "no-implied-eval": "error",
  49. "no-inner-declarations": "off",
  50. "no-lone-blocks": "error",
  51. "no-lonely-if": "error",
  52. "no-loop-func": "error",
  53. "no-multi-spaces": "error",
  54. "no-restricted-globals": ["error", "process"],
  55. "no-restricted-imports": [
  56. "error",
  57. {
  58. "paths": [
  59. // Disallow node imports below
  60. "assert",
  61. "buffer",
  62. "child_process",
  63. "cluster",
  64. "crypto",
  65. "dgram",
  66. "dns",
  67. "domain",
  68. "events",
  69. "freelist",
  70. "fs",
  71. "http",
  72. "https",
  73. "module",
  74. "net",
  75. "os",
  76. "path",
  77. "process",
  78. "punycode",
  79. "querystring",
  80. "readline",
  81. "repl",
  82. "smalloc",
  83. "stream",
  84. "string_decoder",
  85. "sys",
  86. "timers",
  87. "tls",
  88. "tracing",
  89. "tty",
  90. "url",
  91. "util",
  92. "vm",
  93. "zlib"
  94. ],
  95. "patterns": [
  96. {
  97. "group": ["**/env/**/*"],
  98. "message": "Use @env/ instead"
  99. },
  100. {
  101. "group": ["src/**/*"],
  102. "message": "Use relative paths instead"
  103. }
  104. ]
  105. }
  106. ],
  107. "no-return-assign": "error",
  108. "no-return-await": "warn",
  109. "no-self-compare": "error",
  110. "no-sequences": "error",
  111. "no-template-curly-in-string": "warn",
  112. "no-throw-literal": "error",
  113. "no-unmodified-loop-condition": "warn",
  114. "no-unneeded-ternary": "error",
  115. "no-unused-expressions": "error",
  116. "no-use-before-define": "off",
  117. "no-useless-call": "error",
  118. "no-useless-catch": "error",
  119. "no-useless-computed-key": "error",
  120. "no-useless-concat": "error",
  121. "no-useless-rename": "error",
  122. "no-useless-return": "error",
  123. "no-var": "error",
  124. "no-with": "error",
  125. "object-shorthand": ["error", "never"],
  126. "one-var": ["error", "never"],
  127. "prefer-arrow-callback": "error",
  128. "prefer-const": [
  129. "error",
  130. {
  131. "destructuring": "all",
  132. "ignoreReadBeforeAssign": true
  133. }
  134. ],
  135. "prefer-numeric-literals": "error",
  136. "prefer-object-spread": "error",
  137. "prefer-promise-reject-errors": ["error", { "allowEmptyReject": true }],
  138. "prefer-rest-params": "error",
  139. "prefer-spread": "error",
  140. "prefer-template": "error",
  141. "quotes": ["error", "single", { "avoidEscape": true, "allowTemplateLiterals": true }],
  142. "require-atomic-updates": "off",
  143. "semi": ["error", "always"],
  144. "semi-style": ["error", "last"],
  145. "sort-imports": [
  146. "error",
  147. {
  148. "ignoreCase": true,
  149. "ignoreDeclarationSort": true,
  150. "ignoreMemberSort": false,
  151. "memberSyntaxSortOrder": ["none", "all", "multiple", "single"]
  152. }
  153. ],
  154. "yoda": "error",
  155. "import/consistent-type-specifier-style": ["error", "prefer-top-level"],
  156. "import/extensions": ["error", "never"],
  157. "import/newline-after-import": "warn",
  158. "import/no-absolute-path": "error",
  159. "import/no-cycle": "off",
  160. "import/no-default-export": "error",
  161. "import/no-duplicates": ["error", { "prefer-inline": false }],
  162. "import/no-dynamic-require": "error",
  163. "import/no-self-import": "error",
  164. "import/no-unresolved": ["warn", { "ignore": ["vscode", "@env"] }],
  165. "import/no-useless-path-segments": "error",
  166. "import/order": [
  167. "warn",
  168. {
  169. "alphabetize": {
  170. "order": "asc",
  171. "orderImportKind": "asc",
  172. "caseInsensitive": true
  173. },
  174. "groups": ["builtin", "external", "internal", "parent", "sibling", "index"],
  175. "newlines-between": "never"
  176. }
  177. ],
  178. "@typescript-eslint/ban-types": [
  179. "error",
  180. {
  181. "extendDefaults": false,
  182. "types": {
  183. "String": {
  184. "message": "Use string instead",
  185. "fixWith": "string"
  186. },
  187. "Boolean": {
  188. "message": "Use boolean instead",
  189. "fixWith": "boolean"
  190. },
  191. "Number": {
  192. "message": "Use number instead",
  193. "fixWith": "number"
  194. },
  195. "Symbol": {
  196. "message": "Use symbol instead",
  197. "fixWith": "symbol"
  198. },
  199. // "Function": {
  200. // "message": "The `Function` type accepts any function-like value.\nIt provides no type safety when calling the function, which can be a common source of bugs.\nIt also accepts things like class declarations, which will throw at runtime as they will not be called with `new`.\nIf you are expecting the function to accept certain arguments, you should explicitly define the function shape."
  201. // },
  202. "Object": {
  203. "message": "The `Object` type actually means \"any non-nullish value\", so it is marginally better than `unknown`.\n- If you want a type meaning \"any object\", you probably want `Record<string, unknown>` instead.\n- If you want a type meaning \"any value\", you probably want `unknown` instead."
  204. },
  205. "{}": {
  206. "message": "`{}` actually means \"any non-nullish value\".\n- If you want a type meaning \"any object\", you probably want `object` or `Record<string, unknown>` instead.\n- If you want a type meaning \"any value\", you probably want `unknown` instead.",
  207. "fixWith": "object"
  208. }
  209. // "object": {
  210. // "message": "The `object` type is currently hard to use ([see this issue](https://github.com/microsoft/TypeScript/issues/21732)).\nConsider using `Record<string, unknown>` instead, as it allows you to more easily inspect and use the keys."
  211. // }
  212. }
  213. }
  214. ],
  215. "@typescript-eslint/class-literal-property-style": "off",
  216. "@typescript-eslint/consistent-type-assertions": [
  217. "error",
  218. {
  219. "assertionStyle": "as",
  220. "objectLiteralTypeAssertions": "allow-as-parameter"
  221. }
  222. ],
  223. "@typescript-eslint/consistent-type-definitions": "off",
  224. "@typescript-eslint/consistent-type-imports": ["error", { "disallowTypeAnnotations": false }],
  225. "@typescript-eslint/dot-notation": "off",
  226. "@typescript-eslint/naming-convention": [
  227. "error",
  228. {
  229. "selector": "variable",
  230. "format": ["camelCase", "PascalCase"],
  231. "leadingUnderscore": "allow",
  232. "filter": {
  233. "regex": "^_$",
  234. "match": false
  235. }
  236. },
  237. {
  238. "selector": "variableLike",
  239. "format": ["camelCase"],
  240. "leadingUnderscore": "allow",
  241. "filter": {
  242. "regex": "^_$",
  243. "match": false
  244. }
  245. },
  246. {
  247. "selector": "memberLike",
  248. "modifiers": ["private"],
  249. "format": ["camelCase"],
  250. "leadingUnderscore": "allow"
  251. },
  252. {
  253. "selector": "memberLike",
  254. "modifiers": ["private", "readonly"],
  255. "format": ["camelCase", "PascalCase"],
  256. "leadingUnderscore": "allow"
  257. },
  258. {
  259. "selector": "memberLike",
  260. "modifiers": ["static", "readonly"],
  261. "format": ["camelCase", "PascalCase"]
  262. },
  263. {
  264. "selector": "interface",
  265. "format": ["PascalCase"],
  266. "custom": {
  267. "regex": "^I[A-Z]",
  268. "match": false
  269. }
  270. }
  271. ],
  272. "@typescript-eslint/no-confusing-void-expression": [
  273. "error",
  274. { "ignoreArrowShorthand": true, "ignoreVoidOperator": true }
  275. ],
  276. "@typescript-eslint/no-empty-function": "off",
  277. "@typescript-eslint/no-explicit-any": "off",
  278. "@typescript-eslint/no-inferrable-types": ["warn", { "ignoreParameters": true, "ignoreProperties": true }],
  279. "@typescript-eslint/no-invalid-void-type": "off", // Seems to error on `void` return types
  280. "@typescript-eslint/no-misused-promises": ["error", { "checksVoidReturn": false }],
  281. "@typescript-eslint/no-non-null-assertion": "off",
  282. "@typescript-eslint/no-redundant-type-constituents": "off",
  283. "@typescript-eslint/no-unnecessary-condition": "off",
  284. "@typescript-eslint/no-unnecessary-boolean-literal-compare": "off",
  285. "@typescript-eslint/no-unsafe-argument": "off",
  286. "@typescript-eslint/no-unsafe-assignment": "off",
  287. "@typescript-eslint/no-unsafe-call": "off",
  288. "@typescript-eslint/no-unsafe-member-access": "off",
  289. "@typescript-eslint/no-unused-expressions": ["warn", { "allowShortCircuit": true }],
  290. "@typescript-eslint/no-unused-vars": [
  291. "warn",
  292. {
  293. "args": "after-used",
  294. "argsIgnorePattern": "^_",
  295. "ignoreRestSiblings": true,
  296. "varsIgnorePattern": "^_$"
  297. }
  298. ],
  299. "@typescript-eslint/no-unsafe-enum-comparison": "off",
  300. "@typescript-eslint/no-use-before-define": ["error", { "functions": false, "classes": false }],
  301. "@typescript-eslint/prefer-for-of": "warn",
  302. "@typescript-eslint/prefer-includes": "warn",
  303. "@typescript-eslint/prefer-literal-enum-member": ["warn", { "allowBitwiseExpressions": true }],
  304. "@typescript-eslint/prefer-nullish-coalescing": "off", // warn
  305. "@typescript-eslint/prefer-optional-chain": "warn",
  306. "@typescript-eslint/prefer-reduce-type-parameter": "warn",
  307. "@typescript-eslint/restrict-template-expressions": [
  308. "error",
  309. { "allowAny": true, "allowBoolean": true, "allowNumber": true, "allowNullish": true }
  310. ],
  311. "@typescript-eslint/unbound-method": "off", // Too many bugs right now: https://github.com/typescript-eslint/typescript-eslint/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+unbound-method
  312. "@typescript-eslint/unified-signatures": ["error", { "ignoreDifferentlyNamedParameters": true }]
  313. },
  314. "settings": {
  315. "import/parsers": {
  316. "@typescript-eslint/parser": [".ts", ".tsx"]
  317. },
  318. "import/resolver": {
  319. "typescript": {
  320. "alwaysTryTypes": true // always try to resolve types under `<root>@types` directory even it doesn't contain any source code, like `@types/unist`
  321. }
  322. }
  323. },
  324. "ignorePatterns": ["dist/*", "out/*", "**/@types/*", "emojis.json", "tsconfig*.tsbuildinfo", "webpack.config*.js"],
  325. "overrides": [
  326. {
  327. "files": ["src/env/node/**/*"],
  328. "rules": {
  329. "no-restricted-imports": "off"
  330. }
  331. }
  332. ]
  333. }