|
1 | 1 | import js from "@eslint/js"; |
2 | | -import globals from "globals"; |
| 2 | +import { flatConfigs as pluginImportXFlatConfigs } from "eslint-plugin-import-x"; |
3 | 3 | import reactHooks from "eslint-plugin-react-hooks"; |
4 | 4 | import reactRefresh from "eslint-plugin-react-refresh"; |
5 | 5 | import tseslint from "typescript-eslint"; |
| 6 | +import tsParser from "@typescript-eslint/parser"; |
| 7 | +import * as tsResolver from "eslint-import-resolver-typescript"; |
6 | 8 |
|
7 | 9 | export default tseslint.config( |
8 | 10 | { ignores: ["dist"] }, |
9 | 11 | { |
10 | | - extends: [js.configs.recommended, ...tseslint.configs.recommended], |
| 12 | + extends: [ |
| 13 | + js.configs.recommended, |
| 14 | + tseslint.configs.recommended, |
| 15 | + pluginImportXFlatConfigs.recommended, |
| 16 | + pluginImportXFlatConfigs.typescript, |
| 17 | + ], |
11 | 18 | files: ["**/*.{ts,tsx}"], |
12 | 19 | languageOptions: { |
13 | | - ecmaVersion: 2020, |
14 | | - globals: globals.browser, |
| 20 | + parser: tsParser, |
| 21 | + ecmaVersion: "latest", |
| 22 | + sourceType: "module", |
15 | 23 | }, |
16 | 24 | plugins: { |
17 | 25 | "react-hooks": reactHooks, |
18 | 26 | "react-refresh": reactRefresh, |
19 | 27 | }, |
20 | 28 | rules: { |
21 | 29 | ...reactHooks.configs.recommended.rules, |
| 30 | + "import-x/extensions": ["error", "never"], |
| 31 | + "import-x/default": "off", |
22 | 32 | "react-refresh/only-export-components": [ |
23 | 33 | "warn", |
24 | 34 | { allowConstantExport: true }, |
25 | 35 | ], |
26 | 36 | }, |
| 37 | + settings: { |
| 38 | + "import-x/resolver": { |
| 39 | + name: "tsResolver", |
| 40 | + resolver: tsResolver, |
| 41 | + }, |
| 42 | + }, |
27 | 43 | }, |
28 | 44 | ); |
0 commit comments