| 1 | const path = require('path') |
| 2 | const { workspaces } = require('./package.json') |
| 3 | |
| 4 | module.exports = { |
| 5 | root: true, |
| 6 | env: { |
| 7 | browser: true, |
| 8 | node: true, |
| 9 | es6: true, |
| 10 | }, |
| 11 | extends: ['eslint:recommended', 'plugin:import/recommended', 'prettier'], |
| 12 | rules: { |
| 13 | // eslint-plugin-import cannot parse exports field in package.json. |
| 14 | // https://github.com/import-js/eslint-plugin-import/issues/1810 |
| 15 | 'import/no-unresolved': ['error', { ignore: ['^swiper'] }], |
| 16 | 'import/order': ['error', { alphabetize: { order: 'asc' } }], |
| 17 | }, |
| 18 | overrides: [ |
| 19 | { |
| 20 | files: ['**/*.ts', '**/*.tsx'], |
| 21 | parser: '@typescript-eslint/parser', |
| 22 | plugins: ['@typescript-eslint'], |
| 23 | extends: [ |
| 24 | 'plugin:@typescript-eslint/recommended', |
| 25 | 'plugin:import/typescript', |
| 26 | 'prettier', |
| 27 | ], |
| 28 | rules: { |
| 29 | '@typescript-eslint/no-explicit-any': 'off', |
| 30 | '@typescript-eslint/explicit-function-return-type': 'off', |
| 31 | '@typescript-eslint/explicit-module-boundary-types': 'off', |
| 32 | }, |
| 33 | settings: { |
| 34 | 'import/resolver': { |
| 35 | typescript: { |
| 36 | project: ['', ...workspaces].map((dir) => |
| 37 | path.join(dir, 'tsconfig.json') |
| 38 | ), |
| 39 | }, |
| 40 | }, |
| 41 | }, |
| 42 | }, |
| 43 | ], |
| 44 | } |
| 45 |