The code powering m.abunchtell.com https://m.abunchtell.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

205 lines
4.6 KiB

  1. module.exports = {
  2. root: true,
  3. env: {
  4. browser: true,
  5. node: true,
  6. es6: true,
  7. jest: true,
  8. },
  9. globals: {
  10. ATTACHMENT_HOST: false,
  11. },
  12. parser: 'babel-eslint',
  13. plugins: [
  14. 'react',
  15. 'jsx-a11y',
  16. 'import',
  17. 'promise',
  18. ],
  19. parserOptions: {
  20. sourceType: 'module',
  21. ecmaFeatures: {
  22. experimentalObjectRestSpread: true,
  23. jsx: true,
  24. },
  25. ecmaVersion: 2018,
  26. },
  27. settings: {
  28. react: {
  29. version: 'detect',
  30. },
  31. 'import/extensions': [
  32. '.js',
  33. ],
  34. 'import/ignore': [
  35. 'node_modules',
  36. '\\.(css|scss|json)$',
  37. ],
  38. 'import/resolver': {
  39. node: {
  40. paths: ['app/javascript'],
  41. },
  42. },
  43. },
  44. rules: {
  45. 'brace-style': 'warn',
  46. 'comma-dangle': ['error', 'always-multiline'],
  47. 'comma-spacing': [
  48. 'warn',
  49. {
  50. before: false,
  51. after: true,
  52. },
  53. ],
  54. 'comma-style': ['warn', 'last'],
  55. 'consistent-return': 'error',
  56. 'dot-notation': 'error',
  57. eqeqeq: 'error',
  58. indent: ['warn', 2],
  59. 'jsx-quotes': ['error', 'prefer-single'],
  60. 'no-catch-shadow': 'error',
  61. 'no-cond-assign': 'error',
  62. 'no-console': [
  63. 'warn',
  64. {
  65. allow: [
  66. 'error',
  67. 'warn',
  68. ],
  69. },
  70. ],
  71. 'no-fallthrough': 'error',
  72. 'no-irregular-whitespace': 'error',
  73. 'no-mixed-spaces-and-tabs': 'warn',
  74. 'no-nested-ternary': 'warn',
  75. 'no-trailing-spaces': 'warn',
  76. 'no-undef': 'error',
  77. 'no-unreachable': 'error',
  78. 'no-unused-expressions': 'error',
  79. 'no-unused-vars': [
  80. 'error',
  81. {
  82. vars: 'all',
  83. args: 'after-used',
  84. ignoreRestSiblings: true,
  85. },
  86. ],
  87. 'object-curly-spacing': ['error', 'always'],
  88. 'padded-blocks': [
  89. 'error',
  90. {
  91. classes: 'always',
  92. },
  93. ],
  94. quotes: ['error', 'single'],
  95. semi: 'error',
  96. strict: 'off',
  97. 'valid-typeof': 'error',
  98. 'react/jsx-boolean-value': 'error',
  99. 'react/jsx-closing-bracket-location': ['error', 'line-aligned'],
  100. 'react/jsx-curly-spacing': 'error',
  101. 'react/jsx-equals-spacing': 'error',
  102. 'react/jsx-first-prop-new-line': ['error', 'multiline-multiprop'],
  103. 'react/jsx-indent': ['error', 2],
  104. 'react/jsx-no-bind': 'error',
  105. 'react/jsx-no-duplicate-props': 'error',
  106. 'react/jsx-no-undef': 'error',
  107. 'react/jsx-tag-spacing': 'error',
  108. 'react/jsx-uses-react': 'error',
  109. 'react/jsx-uses-vars': 'error',
  110. 'react/jsx-wrap-multilines': 'error',
  111. 'react/no-multi-comp': 'off',
  112. 'react/no-string-refs': 'error',
  113. 'react/prop-types': 'error',
  114. 'react/self-closing-comp': 'error',
  115. 'jsx-a11y/accessible-emoji': 'warn',
  116. 'jsx-a11y/alt-text': 'warn',
  117. 'jsx-a11y/anchor-has-content': 'warn',
  118. 'jsx-a11y/anchor-is-valid': [
  119. 'warn',
  120. {
  121. components: [
  122. 'Link',
  123. 'NavLink',
  124. ],
  125. specialLink: [
  126. 'to',
  127. ],
  128. aspect: [
  129. 'noHref',
  130. 'invalidHref',
  131. 'preferButton',
  132. ],
  133. },
  134. ],
  135. 'jsx-a11y/aria-activedescendant-has-tabindex': 'warn',
  136. 'jsx-a11y/aria-props': 'warn',
  137. 'jsx-a11y/aria-proptypes': 'warn',
  138. 'jsx-a11y/aria-role': 'warn',
  139. 'jsx-a11y/aria-unsupported-elements': 'warn',
  140. 'jsx-a11y/heading-has-content': 'warn',
  141. 'jsx-a11y/html-has-lang': 'warn',
  142. 'jsx-a11y/iframe-has-title': 'warn',
  143. 'jsx-a11y/img-redundant-alt': 'warn',
  144. 'jsx-a11y/interactive-supports-focus': 'warn',
  145. 'jsx-a11y/label-has-for': 'off',
  146. 'jsx-a11y/mouse-events-have-key-events': 'warn',
  147. 'jsx-a11y/no-access-key': 'warn',
  148. 'jsx-a11y/no-distracting-elements': 'warn',
  149. 'jsx-a11y/no-noninteractive-element-interactions': [
  150. 'warn',
  151. {
  152. handlers: [
  153. 'onClick',
  154. ],
  155. },
  156. ],
  157. 'jsx-a11y/no-onchange': 'warn',
  158. 'jsx-a11y/no-redundant-roles': 'warn',
  159. 'jsx-a11y/no-static-element-interactions': [
  160. 'warn',
  161. {
  162. handlers: [
  163. 'onClick',
  164. ],
  165. },
  166. ],
  167. 'jsx-a11y/role-has-required-aria-props': 'warn',
  168. 'jsx-a11y/role-supports-aria-props': 'off',
  169. 'jsx-a11y/scope': 'warn',
  170. 'jsx-a11y/tabindex-no-positive': 'warn',
  171. 'import/extensions': [
  172. 'error',
  173. 'always',
  174. {
  175. js: 'never',
  176. },
  177. ],
  178. 'import/newline-after-import': 'error',
  179. 'import/no-extraneous-dependencies': [
  180. 'error',
  181. {
  182. devDependencies: [
  183. 'config/webpack/**',
  184. 'app/javascript/mastodon/test_setup.js',
  185. 'app/javascript/**/__tests__/**',
  186. ],
  187. },
  188. ],
  189. 'import/no-unresolved': 'error',
  190. 'import/no-webpack-loader-syntax': 'error',
  191. 'promise/catch-or-return': 'error',
  192. },
  193. };