|
| 1 | +module.exports = { |
| 2 | + env: { |
| 3 | + browser: true, |
| 4 | + es2021: true, |
| 5 | + node: true, |
| 6 | + jest: true, |
| 7 | + }, |
| 8 | + extends: [ |
| 9 | + 'eslint:recommended', |
| 10 | + 'plugin:react/recommended', |
| 11 | + 'plugin:@typescript-eslint/recommended', |
| 12 | + ], |
| 13 | + parser: '@typescript-eslint/parser', |
| 14 | + parserOptions: { |
| 15 | + ecmaFeatures: { |
| 16 | + jsx: true, |
| 17 | + }, |
| 18 | + ecmaVersion: 12, |
| 19 | + sourceType: 'module', |
| 20 | + }, |
| 21 | + plugins: ['react', 'react-hooks', '@typescript-eslint'], |
| 22 | + rules: { |
| 23 | + 'react/jsx-closing-bracket-location': 'warn', |
| 24 | + 'react/jsx-tag-spacing': 'off', |
| 25 | + 'array-bracket-spacing': [0, 'never'], |
| 26 | + 'react/prop-types': 'off', |
| 27 | + 'prefer-const': 'warn', |
| 28 | + 'jsx-quotes': ['error', 'prefer-double'], |
| 29 | + 'no-console': 'off', |
| 30 | + 'react-hooks/rules-of-hooks': 'error', |
| 31 | + 'react-hooks/exhaustive-deps': 'warn', |
| 32 | + 'no-useless-escape': 'off', |
| 33 | + // unknown is I don't know; any is I don't care |
| 34 | + '@typescript-eslint/no-explicit-any': ['off', { ignoreRestArgs: true }], |
| 35 | + '@typescript-eslint/no-var-requires': 0, |
| 36 | + '@typescript-eslint/ban-types': ['off'], |
| 37 | + }, |
| 38 | + // Fix warning https://github.com/yannickcr/eslint-plugin-react#configuration |
| 39 | + settings: { |
| 40 | + react: { |
| 41 | + createClass: 'createReactClass', // Regex for Component Factory to use, |
| 42 | + // default to "createReactClass" |
| 43 | + pragma: 'React', // Pragma to use, default to "React" |
| 44 | + fragment: 'Fragment', // Fragment to use (may be a property of <pragma>), default to "Fragment" |
| 45 | + version: 'detect', // React version. "detect" automatically picks the version you have installed. |
| 46 | + // You can also use `16.0`, `16.3`, etc, if you want to override the detected value. |
| 47 | + // default to latest and warns if missing |
| 48 | + // It will default to "detect" in the future |
| 49 | + flowVersion: '0.53', // Flow version |
| 50 | + }, |
| 51 | + propWrapperFunctions: [ |
| 52 | + // The names of any function used to wrap propTypes, e.g. `forbidExtraProps`. If this isn't set, any propTypes wrapped in a function will be skipped. |
| 53 | + 'forbidExtraProps', |
| 54 | + { property: 'freeze', object: 'Object' }, |
| 55 | + { property: 'myFavoriteWrapper' }, |
| 56 | + ], |
| 57 | + linkComponents: [ |
| 58 | + // Components used as alternatives to <a> for linking, eg. <Link to={ url } /> |
| 59 | + 'Hyperlink', |
| 60 | + { name: 'Link', linkAttribute: 'to' }, |
| 61 | + ], |
| 62 | + }, |
| 63 | +}; |
0 commit comments