.eslintrc.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. module.exports = {
  2. extends: [
  3. 'eslint:recommended',
  4. 'airbnb'
  5. ],
  6. parserOptions: {
  7. sourceType: 'module',
  8. ecmaVersion: 2020,
  9. },
  10. globals: {
  11. window: true,
  12. document: true,
  13. WebSocket: true,
  14. },
  15. rules: {
  16. 'import/no-import-module-exports': 'off',
  17. 'react/jsx-props-no-spreading': 'off',
  18. 'no-console': 'warn',
  19. 'no-nested-ternary': 'warn',
  20. 'import/no-unresolved': 'off',
  21. 'import/extensions': 'off',
  22. 'no-trailing-spaces': 'off',
  23. 'no-bitwise': 'off',
  24. 'jsx-a11y/anchor-is-valid': 'off',
  25. 'jsx-a11y/tabindex-no-positive': 'off',
  26. 'jsx-a11y/no-static-element-interactions': 'off',
  27. 'jsx-a11y/click-events-have-key-events': 'off',
  28. 'jsx-a11y/no-noninteractive-element-interactions': 'off',
  29. 'react/jsx-one-expression-per-line': 'off',
  30. 'react/no-unused-prop-types': 'warn',
  31. 'no-multi-spaces': 'off',
  32. 'spaced-comment': 'off',
  33. 'react/jsx-closing-tag-location': 'off',
  34. 'react/jsx-wrap-multilines': 'off',
  35. 'react/jsx-filename-extension': ['error', { extensions: ['.tsx', '.jsx'] }],
  36. 'no-confusing-arrow': ['error', { allowParens: true }],
  37. 'no-plusplus': 'off',
  38. 'react/no-find-dom-node': 'warn',
  39. 'prefer-template': 'warn',
  40. 'import/no-extraneous-dependencies': [
  41. 'error',
  42. {
  43. devDependencies: [
  44. '**/webpack/**/*.js'
  45. ],
  46. }
  47. ],
  48. 'import/no-deprecated': 'error',
  49. 'import/no-dynamic-require': 'off',
  50. 'import/prefer-default-export': 'off',
  51. 'import/order': ['error',
  52. {
  53. groups: [
  54. ['builtin', 'external'],
  55. 'internal',
  56. ['parent', 'sibling', 'index']
  57. ],
  58. }
  59. ],
  60. 'react/prop-types': [
  61. 'error',
  62. {
  63. ignore: ['children'],
  64. customValidators: [],
  65. skipUndeclared: true,
  66. }
  67. ],
  68. 'react/sort-comp': ['error', {
  69. order: [
  70. 'static-methods',
  71. 'lifecycle',
  72. 'everything-else',
  73. '/^on.+$/',
  74. '/^handle.+$/',
  75. '/^.+[rR]enderer$/',
  76. '/^render.+$/',
  77. 'render'
  78. ],
  79. }],
  80. 'global-require': 'off',
  81. 'no-return-assign': ['error', 'except-parens'],
  82. 'no-unused-expressions': [
  83. 'error',
  84. {
  85. allowShortCircuit: true,
  86. allowTernary: true,
  87. }
  88. ],
  89. 'arrow-body-style': 'off',
  90. 'class-methods-use-this': 'off',
  91. 'no-restricted-syntax': [
  92. 'error',
  93. {
  94. selector: 'ForInStatement',
  95. message: 'for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.',
  96. },
  97. {
  98. selector: 'LabeledStatement',
  99. message: 'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.',
  100. },
  101. {
  102. selector: 'WithStatement',
  103. message: '`with` is disallowed in strict mode because it makes code impossible to predict and optimize.',
  104. }
  105. ],
  106. 'no-unused-vars': [
  107. 'warn',
  108. {
  109. varsIgnorePattern: '[Ll]ogger',
  110. ignoreRestSiblings: true,
  111. }
  112. ],
  113. // 'no-magic-numbers': [
  114. // 'warn',
  115. // {
  116. // enforceConst: true,
  117. // ignore: [-1, 0, 1],
  118. // ignoreArrayIndexes: true,
  119. // }
  120. // ],
  121. 'no-warning-comments': [
  122. 'warn',
  123. {
  124. terms: ['todo', 'fixme'],
  125. location: 'anywhere',
  126. }
  127. ],
  128. camelcase: [
  129. 'error',
  130. {
  131. properties: 'never',
  132. }
  133. ],
  134. 'func-names': ['error', 'as-needed'],
  135. 'comma-dangle': [
  136. 'error',
  137. {
  138. functions: 'never',
  139. arrays: 'never',
  140. imports: 'never',
  141. exports: 'never',
  142. objects: 'always-multiline',
  143. }
  144. ],
  145. },
  146. };