.eslintrc.js 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. module.exports = {
  2. parser: '@babel/eslint-parser',
  3. parserOptions: {
  4. sourceType: 'module',
  5. ecmaFeatures: {
  6. experimentalObjectRestSpread: true,
  7. jsx: true,
  8. },
  9. },
  10. extends: [
  11. 'prettier',
  12. 'preact',
  13. 'plugin:import/react',
  14. 'plugin:testing-library/recommended',
  15. 'plugin:jest/recommended',
  16. ],
  17. plugins: ['import', 'testing-library', 'jest'],
  18. env: {
  19. es6: true,
  20. node: true,
  21. browser: true,
  22. },
  23. rules: {
  24. 'constructor-super': 'error',
  25. 'default-case': ['error', { commentPattern: '^no default$' }],
  26. 'handle-callback-err': ['error', '^(err|error)$'],
  27. 'new-cap': ['error', { newIsCap: true, capIsNew: false }],
  28. 'no-alert': 'error',
  29. 'no-array-constructor': 'error',
  30. 'no-caller': 'error',
  31. 'no-case-declarations': 'error',
  32. 'no-class-assign': 'error',
  33. 'no-cond-assign': 'error',
  34. 'no-console': 'error',
  35. 'no-const-assign': 'error',
  36. 'no-control-regex': 'error',
  37. 'no-debugger': 'error',
  38. 'no-delete-var': 'error',
  39. 'no-dupe-args': 'error',
  40. 'no-dupe-class-members': 'error',
  41. 'no-dupe-keys': 'error',
  42. 'no-duplicate-case': 'error',
  43. 'no-duplicate-imports': 'error',
  44. 'no-empty-character-class': 'error',
  45. 'no-empty-pattern': 'error',
  46. 'no-eval': 'error',
  47. 'no-ex-assign': 'error',
  48. 'no-extend-native': 'error',
  49. 'no-extra-bind': 'error',
  50. 'no-extra-boolean-cast': 'error',
  51. 'no-fallthrough': 'error',
  52. 'no-floating-decimal': 'error',
  53. 'no-func-assign': 'error',
  54. 'no-implied-eval': 'error',
  55. 'no-inner-declarations': ['error', 'functions'],
  56. 'no-invalid-regexp': 'error',
  57. 'no-irregular-whitespace': 'error',
  58. 'no-iterator': 'error',
  59. 'no-label-var': 'error',
  60. 'no-labels': ['error', { allowLoop: false, allowSwitch: false }],
  61. 'no-lone-blocks': 'error',
  62. 'no-loop-func': 'error',
  63. 'no-multi-str': 'error',
  64. 'no-native-reassign': 'error',
  65. 'no-negated-in-lhs': 'error',
  66. 'no-new': 'error',
  67. 'no-new-func': 'error',
  68. 'no-new-object': 'error',
  69. 'no-new-require': 'error',
  70. 'no-new-symbol': 'error',
  71. 'no-new-wrappers': 'error',
  72. 'no-obj-calls': 'error',
  73. 'no-octal': 'error',
  74. 'no-octal-escape': 'error',
  75. 'no-path-concat': 'error',
  76. 'no-proto': 'error',
  77. 'no-redeclare': 'error',
  78. 'no-regex-spaces': 'error',
  79. 'no-return-assign': ['error', 'except-parens'],
  80. 'no-script-url': 'error',
  81. 'no-self-assign': 'error',
  82. 'no-self-compare': 'error',
  83. 'no-sequences': 'error',
  84. 'no-shadow-restricted-names': 'error',
  85. 'no-sparse-arrays': 'error',
  86. 'no-this-before-super': 'error',
  87. 'no-throw-literal': 'error',
  88. 'no-trailing-spaces': 'error',
  89. 'no-undef': 'error',
  90. 'no-undef-init': 'error',
  91. 'no-unexpected-multiline': 'error',
  92. 'no-unmodified-loop-condition': 'error',
  93. 'no-unneeded-ternary': ['error', { defaultAssignment: false }],
  94. 'no-unreachable': 'error',
  95. 'no-unsafe-finally': 'error',
  96. 'no-unused-vars': ['error', { vars: 'all', args: 'none', ignoreRestSiblings: true }],
  97. 'no-useless-call': 'error',
  98. 'no-useless-computed-key': 'error',
  99. 'no-useless-concat': 'error',
  100. 'no-useless-constructor': 'error',
  101. 'no-useless-escape': 'error',
  102. 'no-var': 'error',
  103. 'no-with': 'error',
  104. 'prefer-const': 'error',
  105. 'prefer-rest-params': 'error',
  106. 'use-isnan': 'error',
  107. 'valid-typeof': 'error',
  108. camelcase: 'off',
  109. eqeqeq: ['error', 'allow-null'],
  110. indent: ['error', 2, { SwitchCase: 1 }],
  111. quotes: ['error', 'single', 'avoid-escape'],
  112. radix: 'error',
  113. yoda: ['error', 'never'],
  114. 'import/no-unresolved': 'error',
  115. // 'react-hooks/exhaustive-deps': 'error',
  116. 'jest/consistent-test-it': ['error', { fn: 'test' }],
  117. 'jest/no-test-prefixes': 'error',
  118. 'jest/no-restricted-matchers': [
  119. 'error',
  120. { toMatchSnapshot: 'Use `toMatchInlineSnapshot()` and ensure you only snapshot very small elements' },
  121. ],
  122. 'jest/valid-describe': 'error',
  123. 'jest/valid-expect-in-promise': 'error',
  124. },
  125. settings: {
  126. 'import/resolver': {
  127. node: {
  128. extensions: ['.js', '.jsx'],
  129. },
  130. },
  131. },
  132. };