|
1 | 1 | import { defineConfig, globalIgnores } from 'eslint/config'; |
2 | | -import { fixupConfigRules } from '@eslint/compat'; |
| 2 | +import importPlugin from 'eslint-plugin-import'; |
3 | 3 | import jest from 'eslint-plugin-jest'; |
4 | | -import prettier from 'eslint-plugin-prettier'; |
| 4 | +import prettierRecommended from 'eslint-plugin-prettier/recommended'; |
5 | 5 | import globals from 'globals'; |
6 | | -import typescriptEslint from '@typescript-eslint/eslint-plugin'; |
7 | | -import tsParser from '@typescript-eslint/parser'; |
| 6 | +import typescriptEslint from 'typescript-eslint'; |
8 | 7 | import js from '@eslint/js'; |
9 | 8 | import { FlatCompat } from '@eslint/eslintrc'; |
10 | 9 |
|
@@ -38,14 +37,13 @@ export default defineConfig([ |
38 | 37 | '**/.yalc/', |
39 | 38 | ]), |
40 | 39 | { |
41 | | - files: ['**/*.[jt]s', '**/*.m[jt]s', '**/*.[jt]sx'], |
42 | | - extends: fixupConfigRules( |
43 | | - compat.extends('eslint:recommended', 'plugin:import/typescript', 'eslint-config-shakacode', 'prettier'), |
44 | | - ), |
45 | | - |
| 40 | + files: ['**/*.[jt]s', '**/*.[cm][jt]s', '**/*.[jt]sx'], |
| 41 | + }, |
| 42 | + js.configs.recommended, |
| 43 | + compat.extends('eslint-config-shakacode'), |
| 44 | + { |
46 | 45 | plugins: { |
47 | 46 | jest, |
48 | | - prettier, |
49 | 47 | }, |
50 | 48 |
|
51 | 49 | languageOptions: { |
@@ -106,14 +104,9 @@ export default defineConfig([ |
106 | 104 | }, |
107 | 105 | { |
108 | 106 | files: ['**/*.ts{x,}'], |
109 | | - extends: compat.extends('plugin:@typescript-eslint/strict-type-checked'), |
110 | | - |
111 | | - plugins: { |
112 | | - '@typescript-eslint': typescriptEslint, |
113 | | - }, |
| 107 | + extends: [importPlugin.flatConfigs.typescript, typescriptEslint.configs.strictTypeChecked], |
114 | 108 |
|
115 | 109 | languageOptions: { |
116 | | - parser: tsParser, |
117 | 110 | ecmaVersion: 5, |
118 | 111 | sourceType: 'script', |
119 | 112 |
|
@@ -174,4 +167,7 @@ export default defineConfig([ |
174 | 167 | ], |
175 | 168 | }, |
176 | 169 | }, |
| 170 | + // must be the last config in the array |
| 171 | + // https://github.com/prettier/eslint-plugin-prettier?tab=readme-ov-file#configuration-new-eslintconfigjs |
| 172 | + prettierRecommended, |
177 | 173 | ]); |
0 commit comments