@@ -16,12 +16,10 @@ import { defineConfig, globalIgnores } from 'eslint/config';
1616import pluginJs from '@eslint/js' ;
1717import path from 'path' ;
1818import { fileURLToPath } from 'url' ;
19- import { glob } from 'glob' ;
2019import globals from 'globals' ;
2120import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended' ;
2221import vitest from '@vitest/eslint-plugin' ;
2322
24- const allComponentPaths = glob . sync ( 'src/components/*/' ) ;
2523const filename = fileURLToPath ( import . meta. url ) ;
2624const dirname = path . dirname ( filename ) ;
2725
@@ -48,69 +46,14 @@ export default defineConfig([
4846 }
4947 } ,
5048 rules : {
51- 'no-param-reassign' : 'off' ,
52- 'prettier/prettier' : 'error' ,
53- 'func-style' : 'error' ,
54- // Turning this off allows us to import devDependencies in our build tools.
55- // We enable the rule in src/.eslintrc.js since that's the only place we
56- // want to disallow importing extraneous dependencies.
57- 'import/no-extraneous-dependencies' : 'off' ,
58- 'prefer-destructuring' : 'off' ,
59- 'import/prefer-default-export' : 'off' ,
60- 'import/no-restricted-paths' : [
61- 'error' ,
62- {
63- zones : [
64- // prevent components from importing from other components, but allow
65- // importing from themselves
66- ...allComponentPaths . map ( ( componentPath , _ , allPaths ) => ( {
67- target : componentPath ,
68- from : [
69- 'src/core' ,
70- 'src/baseCode' ,
71- ...allPaths . filter ( ( p ) => p !== componentPath )
72- ]
73- } ) ) ,
74- {
75- target : 'src/core' ,
76- from : 'src/baseCode'
77- } ,
78- {
79- target : 'src/utils' ,
80- from : [ 'src/core' , 'src/components' , 'src/baseCode' ]
81- } ,
82- {
83- target : 'src/constants' ,
84- from : [ 'src/core' , 'src/components' , 'src/utils' , 'src/baseCode' ]
85- }
86- ]
87- }
88- ]
89- }
90- } ,
91- {
92- files : [ 'src/**/*.{cjs,js}' ] ,
93- languageOptions : {
94- globals : {
95- turbine : 'readonly'
96- }
97- } ,
98- rules : {
99- 'import/no-extraneous-dependencies' : 'error'
100- }
101- } ,
102- {
103- files : [ 'test/unit/specs/**/*.{cjs,js}' ] ,
104- plugins : {
105- vitest
106- } ,
107- rules : {
108- ...vitest . configs . recommended . rules
49+ 'prettier/prettier' : 'error'
10950 }
11051 } ,
11152 {
112- files : [ 'test /**/*.{cjs,js} ' ] ,
53+ files : [ 'src /**/*.js ' ] ,
11354 rules : {
55+ 'import/no-extraneous-dependencies' : 'error' ,
56+ 'no-param-reassign' : 'off' ,
11457 'import/extensions' : [
11558 'error' ,
11659 {
@@ -120,17 +63,25 @@ export default defineConfig([
12063 }
12164 } ,
12265 {
123- files : [ 'scripts/**/*.{cjs,js} ' ] ,
66+ files : [ 'eslint.config.js ' ] ,
12467 rules : {
125- 'no-console' : 'off' ,
126- 'import/extensions' : [
68+ 'import/no-extraneous-dependencies' : [
12769 'error' ,
12870 {
129- js : 'always'
71+ devDependencies : true
13072 }
13173 ]
13274 }
13375 } ,
76+ {
77+ files : [ 'src/**/*.test.js}' ] ,
78+ plugins : {
79+ vitest
80+ } ,
81+ rules : {
82+ ...vitest . configs . recommended . rules
83+ }
84+ } ,
13485
13586 pluginJs . configs . recommended ,
13687 eslintPluginPrettierRecommended
0 commit comments