@@ -2,6 +2,7 @@ import js from '@eslint/js';
22import { defineConfig , globalIgnores } from 'eslint/config' ;
33import tseslint from 'typescript-eslint' ;
44import cypress from 'eslint-plugin-cypress' ;
5+ import importPlugin from 'eslint-plugin-import' ;
56import jsxA11y from 'eslint-plugin-jsx-a11y' ;
67import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended' ;
78import react from 'eslint-plugin-react' ;
@@ -28,6 +29,22 @@ export default defineConfig([
2829 ...conf ,
2930 files : [ '**/*.ts' , '**/*.tsx' ] ,
3031 } ) ) ,
32+ {
33+ name : 'eslint-plugin-import' ,
34+ plugins : { import : importPlugin } ,
35+ rules : {
36+ ...importPlugin . configs . recommended . rules ,
37+ ...importPlugin . configs . typescript . rules ,
38+ } ,
39+ settings : {
40+ 'import/resolver' : {
41+ // You will also need to install and configure the TypeScript resolver
42+ // See also https://github.com/import-js/eslint-import-resolver-typescript#configuration
43+ typescript : true ,
44+ node : true ,
45+ } ,
46+ } ,
47+ } ,
3148 {
3249 ...jsxA11y . flatConfigs . recommended ,
3350 ignores : [ '**/*.spec.*' , '**/*.stories.*' ] ,
@@ -116,6 +133,9 @@ export default defineConfig([
116133 'no-prototype-builtins' : 'off' ,
117134 'prefer-spread' : 'off' ,
118135 'jsx-a11y/no-autofocus' : 'off' ,
136+ 'import/no-anonymous-default-export' : 'off' ,
137+ 'import/no-named-as-default' : 'off' ,
138+ 'import/no-extraneous-dependencies' : 'error' ,
119139 } ,
120140 settings : {
121141 react : {
@@ -133,6 +153,23 @@ export default defineConfig([
133153 } ,
134154 rules : {
135155 'react-hooks/rules-of-hooks' : 'off' ,
156+ 'import/no-unresolved' : 'off' ,
157+ 'import/no-extraneous-dependencies' : 'off' ,
158+ } ,
159+ } ,
160+ {
161+ name : 'stories-rules' ,
162+ files : [ '**/*.stories.*' ] ,
163+ rules : {
164+ 'import/no-unresolved' : 'off' ,
165+ 'import/no-extraneous-dependencies' : 'off' ,
166+ } ,
167+ } ,
168+ {
169+ name : 'examples-rules' ,
170+ files : [ '**/examples/**' ] ,
171+ rules : {
172+ 'import/no-extraneous-dependencies' : 'off' ,
136173 } ,
137174 } ,
138175 {
0 commit comments