|
1 | 1 | /**
|
2 |
| - * @type {import('eslint').Linter.Config} |
| 2 | + * ESLint configuration for the application. |
| 3 | + * Based on the Official Remix Starters. |
3 | 4 | */
|
| 5 | + |
| 6 | +/** @type {import('eslint').Linter.Config} */ |
4 | 7 | module.exports = {
|
5 |
| - extends: ['@remix-run/eslint-config', '@remix-run/eslint-config/node', 'prettier'], |
| 8 | + root: true, |
| 9 | + parserOptions: { |
| 10 | + ecmaVersion: 'latest', |
| 11 | + sourceType: 'module', |
| 12 | + ecmaFeatures: { |
| 13 | + jsx: true, |
| 14 | + }, |
| 15 | + }, |
| 16 | + env: { |
| 17 | + browser: true, |
| 18 | + commonjs: true, |
| 19 | + es6: true, |
| 20 | + }, |
| 21 | + ignorePatterns: ['!**/.server', '!**/.client', 'remix.init/*'], |
| 22 | + |
| 23 | + // Base configuration. |
| 24 | + extends: ['eslint:recommended', 'prettier'], |
| 25 | + |
| 26 | + overrides: [ |
| 27 | + // React. |
| 28 | + { |
| 29 | + files: ['**/*.{js,jsx,ts,tsx}'], |
| 30 | + plugins: ['react'], |
| 31 | + extends: [ |
| 32 | + 'plugin:react/recommended', |
| 33 | + 'plugin:react/jsx-runtime', |
| 34 | + 'plugin:react-hooks/recommended', |
| 35 | + ], |
| 36 | + settings: { |
| 37 | + react: { |
| 38 | + version: 'detect', |
| 39 | + }, |
| 40 | + formComponents: ['Form'], |
| 41 | + linkComponents: [ |
| 42 | + { name: 'Link', linkAttribute: 'to' }, |
| 43 | + { name: 'NavLink', linkAttribute: 'to' }, |
| 44 | + ], |
| 45 | + 'import/resolver': { |
| 46 | + typescript: {}, |
| 47 | + }, |
| 48 | + }, |
| 49 | + }, |
| 50 | + |
| 51 | + // Typescript. |
| 52 | + { |
| 53 | + files: ['**/*.{ts,tsx}'], |
| 54 | + plugins: ['@typescript-eslint', 'import'], |
| 55 | + parser: '@typescript-eslint/parser', |
| 56 | + settings: { |
| 57 | + 'import/internal-regex': '^~/', |
| 58 | + 'import/resolver': { |
| 59 | + node: { |
| 60 | + extensions: ['.ts', '.tsx'], |
| 61 | + }, |
| 62 | + typescript: { |
| 63 | + alwaysTryTypes: true, |
| 64 | + }, |
| 65 | + }, |
| 66 | + }, |
| 67 | + extends: [ |
| 68 | + 'plugin:@typescript-eslint/recommended', |
| 69 | + 'plugin:import/recommended', |
| 70 | + 'plugin:import/typescript', |
| 71 | + ], |
| 72 | + }, |
| 73 | + |
| 74 | + // Node. |
| 75 | + { |
| 76 | + files: ['.eslintrc.cjs'], |
| 77 | + env: { |
| 78 | + node: true, |
| 79 | + }, |
| 80 | + }, |
| 81 | + ], |
6 | 82 | }
|
0 commit comments