|
| 1 | +/** |
| 2 | + * This is intended to be a basic starting point for linting in your app. |
| 3 | + * It relies on recommended configs out of the box for simplicity, but you can |
| 4 | + * and should modify this configuration to best suit your team's needs. |
| 5 | + */ |
| 6 | + |
| 7 | +/** @type {import('eslint').Linter.Config} */ |
| 8 | +module.exports = { |
| 9 | + root: true, |
| 10 | + parserOptions: { |
| 11 | + ecmaVersion: 'latest', |
| 12 | + sourceType: 'module', |
| 13 | + ecmaFeatures: { |
| 14 | + jsx: true, |
| 15 | + }, |
| 16 | + }, |
| 17 | + env: { |
| 18 | + browser: true, |
| 19 | + commonjs: true, |
| 20 | + es6: true, |
| 21 | + }, |
| 22 | + |
| 23 | + // Base config |
| 24 | + extends: ['eslint:recommended'], |
| 25 | + |
| 26 | + overrides: [ |
| 27 | + // React |
| 28 | + { |
| 29 | + files: ['**/*.{js,jsx,ts,tsx}'], |
| 30 | + plugins: ['react', 'jsx-a11y'], |
| 31 | + extends: [ |
| 32 | + 'plugin:react/recommended', |
| 33 | + 'plugin:react/jsx-runtime', |
| 34 | + 'plugin:react-hooks/recommended', |
| 35 | + 'plugin:jsx-a11y/recommended', |
| 36 | + ], |
| 37 | + settings: { |
| 38 | + react: { |
| 39 | + version: 'detect', |
| 40 | + }, |
| 41 | + formComponents: ['Form'], |
| 42 | + linkComponents: [ |
| 43 | + { name: 'Link', linkAttribute: 'to' }, |
| 44 | + { name: 'NavLink', linkAttribute: 'to' }, |
| 45 | + ], |
| 46 | + 'import/resolver': { |
| 47 | + typescript: {}, |
| 48 | + }, |
| 49 | + }, |
| 50 | + }, |
| 51 | + |
| 52 | + // Typescript |
| 53 | + { |
| 54 | + files: ['**/*.{ts,tsx}'], |
| 55 | + plugins: ['@typescript-eslint', 'import'], |
| 56 | + parser: '@typescript-eslint/parser', |
| 57 | + settings: { |
| 58 | + 'import/internal-regex': '^~/', |
| 59 | + 'import/resolver': { |
| 60 | + node: { |
| 61 | + extensions: ['.ts', '.tsx'], |
| 62 | + }, |
| 63 | + typescript: { |
| 64 | + alwaysTryTypes: true, |
| 65 | + }, |
| 66 | + }, |
| 67 | + }, |
| 68 | + extends: ['plugin:@typescript-eslint/recommended', 'plugin:import/recommended', 'plugin:import/typescript'], |
| 69 | + }, |
| 70 | + |
| 71 | + // Node |
| 72 | + { |
| 73 | + files: ['.eslintrc.cjs', 'server.ts'], |
| 74 | + env: { |
| 75 | + node: true, |
| 76 | + }, |
| 77 | + }, |
| 78 | + ], |
| 79 | +}; |
0 commit comments