11import eslint from '@eslint/js' ;
22import eslintConfigPrettier from 'eslint-config-prettier' ;
3- import eslintPluginImport from 'eslint-plugin-import' ;
3+ import { createTypeScriptImportResolver } from 'eslint-import-resolver-typescript' ;
4+ import * as eslintPluginImportX from 'eslint-plugin-import-x' ;
5+ import eslintPluginJsxA11y from 'eslint-plugin-jsx-a11y' ;
46import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended' ;
57import eslintPluginReact from 'eslint-plugin-react' ;
6- import eslintPluginReactHooks from 'eslint-plugin-react-hooks' ;
7- import eslintPluginJsxA11y from 'eslint-plugin-jsx-a11y' ;
8-
9- import tseslint from 'typescript-eslint' ;
8+ import * as eslintPluginReactHooks from 'eslint-plugin-react-hooks' ;
9+ import * as tseslint from 'typescript-eslint' ;
1010
1111export default tseslint . config (
1212 eslint . configs . recommended ,
13- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
14- eslintPluginImport . flatConfigs . recommended ,
13+
14+ eslintPluginImportX . flatConfigs . recommended ,
15+ eslintPluginImportX . flatConfigs . typescript ,
1516 ...tseslint . configs . strictTypeChecked ,
1617 ...tseslint . configs . stylisticTypeChecked ,
17- // Uncomment once released - https://github.com/facebook/react/pull/30774
18- // eslintPluginReactHooks.configs.recommended,
19- eslintPluginReact . configs . flat . recommended ,
2018 // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
2119 eslintPluginJsxA11y . flatConfigs . recommended ,
20+ eslintPluginReact . configs . flat . recommended ,
2221 eslintPluginPrettierRecommended ,
23- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
2422 eslintConfigPrettier ,
23+ // https://eslint.org/docs/latest/use/configure/configuration-files#excluding-files-with-ignores
24+ // When in their own config block without files, it tells ESLint to ignore those files.
25+ // When in a config block with files, it stops that specific config block from affecting those ignored files.
2526 {
2627 ignores : [ '!.*' , 'node_modules' , 'dist' , 'compiled' , 'build' ] ,
2728 } ,
2829 {
2930 languageOptions : {
3031 parserOptions : {
3132 projectService : true ,
32- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
33- tsconfigRootDir : import . meta. name ,
33+ tsconfigRootDir : import . meta. dirname ,
3434 } ,
3535 } ,
3636 settings : {
37- 'import/resolver' : {
38- typescript : { project : './tsconfig.dev.json' } ,
39- } ,
37+ 'import-x/resolver-next' : [ createTypeScriptImportResolver ( ) ] ,
4038 react : { version : 'detect' } ,
4139 } ,
4240 } ,
4341 {
4442 files : [ '**/*.{js,ts,jsx,tsx}' ] ,
4543
4644 plugins : {
47- // Remove once released - https://github.com/facebook/react/pull/30774
48- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
4945 'react-hooks' : eslintPluginReactHooks ,
5046 } ,
5147
52- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
5348 rules : {
54- // Remove once released - https://github.com/facebook/react/pull/30774
55- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
5649 ...eslintPluginReactHooks . configs . recommended . rules ,
5750
58- 'react/jsx-sort-props' : [ 'error' , { callbacksLast : true , shorthandFirst : true } ] ,
5951 'react/react-in-jsx-scope' : 'off' ,
6052
61- 'no-undef' : 'off' ,
6253 'prefer-template' : 'error' ,
6354 'no-nested-ternary' : 'error' ,
6455 'no-unneeded-ternary' : 'error' ,
56+ 'spaced-comment' : 'error' ,
57+ 'no-console' : 'error' ,
6558
6659 '@typescript-eslint/ban-ts-comment' : [ 'error' , { 'ts-expect-error' : 'allow-with-description' } ] ,
6760 '@typescript-eslint/consistent-type-definitions' : [ 'error' , 'type' ] ,
@@ -70,18 +63,14 @@ export default tseslint.config(
7063 '@typescript-eslint/no-unnecessary-condition' : 'error' ,
7164 '@typescript-eslint/no-confusing-void-expression' : [ 'error' , { ignoreArrowShorthand : true } ] ,
7265 '@typescript-eslint/restrict-plus-operands' : 'off' ,
66+ '@typescript-eslint/restrict-template-expressions' : 'off' ,
67+ '@typescript-eslint/consistent-type-imports' : 'error' ,
7368 '@typescript-eslint/naming-convention' : [
7469 'error' ,
7570 {
7671 selector : 'typeAlias' ,
7772 format : [ 'PascalCase' ] ,
7873 } ,
79- {
80- selector : 'variable' ,
81- types : [ 'boolean' ] ,
82- format : [ 'PascalCase' ] ,
83- prefix : [ 'is' , 'should' , 'has' , 'can' , 'did' , 'will' ] ,
84- } ,
8574 {
8675 // Generic type parameter must start with letter T, followed by any uppercase letter.
8776 selector : 'typeParameter' ,
@@ -90,8 +79,8 @@ export default tseslint.config(
9079 } ,
9180 ] ,
9281
93- 'import/no-default-export' : 'error' ,
94- 'import/order' : [
82+ 'import-x /no-default-export' : 'error' ,
83+ 'import-x /order' : [
9584 'error' ,
9685 {
9786 groups : [ 'builtin' , 'external' , 'internal' , 'parent' , 'sibling' ] ,
@@ -107,7 +96,7 @@ export default tseslint.config(
10796 {
10897 files : [ 'stories/**/*' ] ,
10998 rules : {
110- 'import/no-default-export' : 'off' ,
99+ 'import-x /no-default-export' : 'off' ,
111100 } ,
112101 } ,
113102) ;
0 commit comments