.eslintrc.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. const OFF = 0;
  2. const WARN = 1;
  3. const ERROR = 2;
  4. module.exports = {
  5. env: {
  6. browser: true,
  7. es2020: true,
  8. node: true,
  9. },
  10. extends: [
  11. 'plugin:react/recommended',
  12. 'plugin:@typescript-eslint/recommended',
  13. 'plugin:prettier/recommended',
  14. 'prettier',
  15. ],
  16. parser: '@typescript-eslint/parser',
  17. parserOptions: {
  18. ecmaFeatures: {
  19. jsx: true,
  20. },
  21. ecmaVersion: 11,
  22. sourceType: 'module',
  23. },
  24. plugins: ['prettier', 'react', 'react-hooks', 'unicorn', 'promise', '@typescript-eslint'],
  25. settings: {
  26. 'import/resolver': {
  27. node: {
  28. extensions: ['.tsx', '.ts', '.js', '.json'],
  29. },
  30. typescript: {
  31. project: './tsconfig.json',
  32. },
  33. },
  34. react: {
  35. version: 'detect',
  36. },
  37. },
  38. root: true,
  39. rules: {
  40. '@typescript-eslint/explicit-function-return-type': [OFF],
  41. '@typescript-eslint/explicit-module-boundary-types': [OFF],
  42. 'prefer-const': [OFF],
  43. 'no-var': [OFF],
  44. 'comma-dangle': [OFF],
  45. 'arrow-parens': [OFF],
  46. 'no-multiple-empty-lines': [OFF],
  47. '@typescript-eslint/no-explicit-any': [OFF],
  48. '@typescript-eslint/no-var-requires': [OFF],
  49. '@typescript-eslint/no-unused-vars': [OFF],
  50. '@typescript-eslint/explicit-member-accessibility': [OFF],
  51. '@typescript-eslint/interface-name-prefix': [OFF],
  52. '@typescript-eslint/no-empty-interface': [OFF],
  53. 'react/prop-types': [OFF],
  54. 'react/display-name': [OFF],
  55. 'unicorn/filename-case': OFF,
  56. 'no-script-url': OFF,
  57. 'import/no-dynamic-require': OFF,
  58. 'no-await-in-loop': OFF,
  59. 'no-loop-func': OFF,
  60. 'unicorn/prefer-query-selector': ERROR,
  61. 'unicorn/no-null': OFF,
  62. 'unicorn/no-array-reduce': OFF,
  63. 'unicorn/consistent-function-scoping': OFF,
  64. 'unicorn/no-array-callback-reference': OFF,
  65. 'unicorn/prefer-string-slice': OFF,
  66. 'unicorn/consistent-destructuring': OFF,
  67. 'no-underscore-dangle': OFF,
  68. 'unicorn/prefer-array-some': OFF,
  69. 'unicorn/prefer-spread': OFF,
  70. 'jsx-a11y/anchor-is-valid': OFF,
  71. '@typescript-eslint/no-useless-constructor': ERROR,
  72. '@typescript-eslint/no-empty-function': WARN,
  73. '@typescript-eslint/no-var-requires': OFF,
  74. '@typescript-eslint/explicit-function-return-type': OFF,
  75. '@typescript-eslint/explicit-module-boundary-types': OFF,
  76. '@typescript-eslint/no-explicit-any': OFF,
  77. '@typescript-eslint/no-unused-vars': WARN,
  78. '@typescript-eslint/no-non-null-assertion': OFF,
  79. '@typescript-eslint/ban-types': OFF,
  80. '@typescript-eslint/no-non-null-asserted-optional-chain': OFF,
  81. '@typescript-eslint/no-empty-interface': OFF,
  82. '@typescript-eslint/ban-ts-comment': OFF,
  83. 'react/jsx-filename-extension': [ERROR, { extensions: ['.tsx', 'ts', '.jsx', 'js'] }],
  84. 'react/jsx-indent-props': [ERROR, 2],
  85. 'react/jsx-indent': [ERROR, 2],
  86. 'react/jsx-one-expression-per-line': OFF,
  87. 'react/destructuring-assignment': OFF,
  88. 'react/state-in-constructor': OFF,
  89. 'react/jsx-props-no-spreading': OFF,
  90. 'react/prop-types': OFF,
  91. 'react/display-name': OFF,
  92. 'react/require-default-props': OFF,
  93. 'react/no-array-index-key': OFF,
  94. 'react/no-unused-prop-types': WARN,
  95. 'react-hooks/exhaustive-deps': OFF,
  96. 'jsx-a11y/click-events-have-key-events': OFF,
  97. 'jsx-a11y/no-noninteractive-element-interactions': OFF,
  98. 'jsx-a11y/no-static-element-interactions': OFF,
  99. 'lines-between-class-members': [ERROR, 'always'],
  100. // indent: [ERROR, 2, { SwitchCase: 1 }],
  101. 'linebreak-style': OFF,
  102. quotes: [ERROR, 'single'],
  103. 'no-unused-expressions': OFF,
  104. 'no-plusplus': OFF,
  105. 'no-console': WARN,
  106. 'no-continue': OFF,
  107. 'consistent-return': OFF,
  108. 'no-param-reassign': OFF,
  109. 'no-debugger': OFF,
  110. 'class-methods-use-this': OFF,
  111. 'global-require': OFF,
  112. 'no-use-before-define': OFF,
  113. 'no-restricted-syntax': OFF,
  114. 'promise/always-return': OFF,
  115. 'promise/catch-or-return': OFF,
  116. 'promise/no-nesting': OFF,
  117. 'no-async-promise-executor': OFF,
  118. 'prefer-promise-reject-errors': OFF,
  119. 'prefer-const': OFF,
  120. 'react/no-children-prop': OFF,
  121. 'max-classes-per-file': OFF,
  122. 'unicorn/no-abusive-eslint-disable': OFF,
  123. 'prettier/prettier': ['error', { endOfLine: 'auto' }],
  124. },
  125. overrides: [
  126. {
  127. files: ['*.ts', '*.tsx'],
  128. rules: {
  129. // use @typescript-eslint/no-shadow
  130. 'no-shadow': [OFF],
  131. 'no-console': WARN,
  132. },
  133. },
  134. ],
  135. };