|
| 1 | +// .eslintrc.js |
| 2 | +const globals = require('globals'); |
| 3 | + |
| 4 | +module.exports = { |
| 5 | + env: { |
| 6 | + browser: true, |
| 7 | + es2021: true, |
| 8 | + }, |
| 9 | + extends: [ |
| 10 | + 'eslint:recommended', |
| 11 | + 'plugin:import/errors', |
| 12 | + 'plugin:import/warnings', |
| 13 | + 'plugin:react/recommended', |
| 14 | + 'plugin:react/jsx-runtime', |
| 15 | + 'plugin:@typescript-eslint/recommended', |
| 16 | + 'prettier', |
| 17 | + 'next/core-web-vitals', |
| 18 | + ], |
| 19 | + overrides: [ |
| 20 | + { |
| 21 | + files: ['*.ts', '*.tsx'], |
| 22 | + parser: '@typescript-eslint/parser', |
| 23 | + parserOptions: { |
| 24 | + project: './tsconfig.json', |
| 25 | + sourceType: 'module', |
| 26 | + ecmaVersion: 'latest', |
| 27 | + ecmaFeatures: { jsx: true }, |
| 28 | + }, |
| 29 | + }, |
| 30 | + { |
| 31 | + files: ['.eslintrc.js', 'next.config.js'], |
| 32 | + rules: { |
| 33 | + '@typescript-eslint/no-require-imports': 'off', |
| 34 | + }, |
| 35 | + }, |
| 36 | + ], |
| 37 | + parserOptions: { |
| 38 | + ecmaVersion: 'latest', |
| 39 | + sourceType: 'module', |
| 40 | + ecmaFeatures: { jsx: true }, |
| 41 | + }, |
| 42 | + plugins: ['react', '@typescript-eslint', 'react-hooks', 'import', 'prettier'], |
| 43 | + globals: { |
| 44 | + ...globals.browser, |
| 45 | + ...globals.node, |
| 46 | + }, |
| 47 | + rules: { |
| 48 | + 'no-var': 'warn', |
| 49 | + 'no-extra-semi': 'error', |
| 50 | + 'react/jsx-filename-extension': [2, { extensions: ['.js', '.jsx', '.ts', '.tsx'] }], |
| 51 | + 'react-hooks/exhaustive-deps': ['warn'], |
| 52 | + 'react/jsx-pascal-case': 'warn', |
| 53 | + 'react/prop-types': 'off', |
| 54 | + 'react-hooks/rules-of-hooks': 'error', |
| 55 | + 'react/react-in-jsx-scope': 'off', |
| 56 | + 'import/no-named-as-default': 'off', |
| 57 | + 'import/order': [ |
| 58 | + 'error', |
| 59 | + { |
| 60 | + groups: [ |
| 61 | + 'builtin', |
| 62 | + 'external', |
| 63 | + 'internal', |
| 64 | + ['parent', 'sibling', 'index'], |
| 65 | + 'object', |
| 66 | + 'type', |
| 67 | + ], |
| 68 | + pathGroups: [ |
| 69 | + { |
| 70 | + pattern: 'react', |
| 71 | + group: 'external', |
| 72 | + position: 'before', |
| 73 | + }, |
| 74 | + { |
| 75 | + pattern: '@src/**', |
| 76 | + group: 'internal', |
| 77 | + position: 'after', |
| 78 | + }, |
| 79 | + ], |
| 80 | + pathGroupsExcludedImportTypes: ['react'], |
| 81 | + 'newlines-between': 'always', |
| 82 | + alphabetize: { order: 'asc', caseInsensitive: true }, |
| 83 | + }, |
| 84 | + ], |
| 85 | + 'prettier/prettier': ['error', { endOfLine: 'auto' }], |
| 86 | + semi: ['error', 'always'], |
| 87 | + }, |
| 88 | +}; |
0 commit comments