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