@@ -7,6 +7,7 @@ export function getDirs(nuxt: Nuxt): NuxtESLintConfigOptions['dirs'] {
7
7
pages : [ ] ,
8
8
composables : [ ] ,
9
9
components : [ ] ,
10
+ componentsPrefixed : [ ] ,
10
11
layouts : [ ] ,
11
12
plugins : [ ] ,
12
13
middleware : [ ] ,
@@ -17,7 +18,7 @@ export function getDirs(nuxt: Nuxt): NuxtESLintConfigOptions['dirs'] {
17
18
}
18
19
19
20
for ( const layer of nuxt . options . _layers ) {
20
- const r = ( t : string ) => relative ( nuxt . options . rootDir , resolve ( layer . config . srcDir , t ) )
21
+ const r = ( t : string ) => relative ( nuxt . options . rootDir , resolve ( layer . config . srcDir , t . replace ( / ^ ~ [ / \\ ] / , '' ) ) )
21
22
22
23
dirs . src . push ( r ( '' ) )
23
24
dirs . pages . push ( r ( nuxt . options . dir . pages || 'pages' ) )
@@ -33,14 +34,17 @@ export function getDirs(nuxt: Nuxt): NuxtESLintConfigOptions['dirs'] {
33
34
dirs . composables . push ( r ( dir ) )
34
35
}
35
36
36
- if ( layer . config . components ) {
37
- const options = layer . config . components || { }
38
- if ( options !== true && 'dirs' in options ) {
39
- for ( const dir of options . dirs || [ ] ) {
40
- if ( typeof dir === 'string' )
41
- dirs . components . push ( r ( dir ) )
42
- else if ( dir && 'path' in dir && typeof dir . path === 'string' )
43
- dirs . components . push ( r ( dir . path ) )
37
+ if ( layer . config . components && layer . config . components !== true ) {
38
+ const options = Array . isArray ( layer . config . components )
39
+ ? { dirs : layer . config . components }
40
+ : layer . config . components
41
+ for ( const dir of options . dirs || [ ] ) {
42
+ if ( typeof dir === 'string' )
43
+ dirs . components . push ( r ( dir ) )
44
+ else if ( dir && 'path' in dir && typeof dir . path === 'string' ) {
45
+ dirs . components . push ( r ( dir . path ) )
46
+ if ( dir . prefix )
47
+ dirs . componentsPrefixed . push ( r ( dir . path ) )
44
48
}
45
49
}
46
50
}
0 commit comments