.eslintrc.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. module.exports = {
  2. env: {
  3. browser: true,
  4. node: true,
  5. },
  6. extends: [
  7. 'prettier',
  8. 'eslint:recommended',
  9. 'plugin:@typescript-eslint/recommended',
  10. ],
  11. parser: '@typescript-eslint/parser',
  12. parserOptions: {
  13. project: 'tsconfig.json',
  14. sourceType: 'module',
  15. },
  16. plugins: ['eslint-plugin-import', '@typescript-eslint'],
  17. root: true,
  18. rules: {
  19. '@typescript-eslint/await-thenable': 'error',
  20. '@typescript-eslint/consistent-type-assertions': 'error',
  21. '@typescript-eslint/member-delimiter-style': [
  22. 'error',
  23. {
  24. multiline: {
  25. delimiter: 'none',
  26. requireLast: true,
  27. },
  28. singleline: {
  29. delimiter: 'semi',
  30. requireLast: false,
  31. },
  32. },
  33. ],
  34. '@typescript-eslint/naming-convention': 'off',
  35. '@typescript-eslint/no-empty-function': 'error',
  36. '@typescript-eslint/no-extra-semi': 'off',
  37. '@typescript-eslint/no-explicit-any': 'error',
  38. '@typescript-eslint/no-floating-promises': 'error',
  39. '@typescript-eslint/no-misused-new': 'error',
  40. '@typescript-eslint/no-unnecessary-qualifier': 'error',
  41. '@typescript-eslint/no-unnecessary-type-assertion': 'error',
  42. '@typescript-eslint/no-unused-expressions': [
  43. 'error',
  44. {
  45. allowTaggedTemplates: true,
  46. allowShortCircuit: true,
  47. },
  48. ],
  49. '@typescript-eslint/prefer-namespace-keyword': 'error',
  50. '@typescript-eslint/quotes': [
  51. 'error',
  52. 'single',
  53. {
  54. avoidEscape: true,
  55. },
  56. ],
  57. '@typescript-eslint/semi': 'off',
  58. '@typescript-eslint/triple-slash-reference': [
  59. 'error',
  60. {
  61. path: 'always',
  62. types: 'prefer-import',
  63. lib: 'always',
  64. },
  65. ],
  66. '@typescript-eslint/type-annotation-spacing': 'error',
  67. '@typescript-eslint/unified-signatures': 'error',
  68. 'brace-style': ['error', '1tbs'],
  69. 'comma-dangle': 'off',
  70. curly: ['error', 'multi-line'],
  71. 'eol-last': 'error',
  72. eqeqeq: ['error', 'smart'],
  73. 'id-denylist': [
  74. 'error',
  75. 'any',
  76. 'Number',
  77. 'String',
  78. 'string',
  79. 'Boolean',
  80. 'boolean',
  81. 'Undefined',
  82. 'undefined',
  83. ],
  84. 'id-match': 'error',
  85. 'import/no-deprecated': 'error',
  86. 'new-parens': 'error',
  87. 'no-caller': 'error',
  88. 'no-case-declarations': 'off',
  89. 'no-cond-assign': 'error',
  90. 'no-constant-condition': 'error',
  91. 'no-control-regex': 'error',
  92. 'no-duplicate-imports': 'error',
  93. 'no-empty': 'error',
  94. 'no-empty-function': 'error',
  95. 'no-eval': 'error',
  96. 'no-fallthrough': 'error',
  97. 'no-invalid-regexp': 'error',
  98. 'no-multiple-empty-lines': 'error',
  99. 'no-redeclare': 'error',
  100. 'no-regex-spaces': 'error',
  101. 'no-return-await': 'error',
  102. 'no-throw-literal': 'error',
  103. 'no-trailing-spaces': 'error',
  104. 'no-underscore-dangle': 'off',
  105. 'no-unexpected-multiline': 'off',
  106. 'no-unused-expressions': 'off',
  107. 'no-unused-labels': 'error',
  108. 'no-var': 'error',
  109. 'one-var': ['error', 'never'],
  110. quotes: 'off',
  111. radix: 'error',
  112. semi: 'off',
  113. 'space-in-parens': ['error', 'never'],
  114. 'spaced-comment': [
  115. 'error',
  116. 'always',
  117. {
  118. markers: ['/'],
  119. },
  120. ],
  121. 'use-isnan': 'error',
  122. },
  123. overrides: [
  124. {
  125. files: ['*.test.*'],
  126. rules: {
  127. '@typescript-eslint/no-unused-expressions': 'off',
  128. },
  129. },
  130. ],
  131. }