@@ -7,6 +7,7 @@ export function getDirs(nuxt: Nuxt): NuxtESLintConfigOptions['dirs'] {
77 pages : [ ] ,
88 composables : [ ] ,
99 components : [ ] ,
10+ componentsPrefixed : [ ] ,
1011 layouts : [ ] ,
1112 plugins : [ ] ,
1213 middleware : [ ] ,
@@ -17,7 +18,7 @@ export function getDirs(nuxt: Nuxt): NuxtESLintConfigOptions['dirs'] {
1718 }
1819
1920 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 ( / ^ ~ [ / \\ ] / , '' ) ) )
2122
2223 dirs . src . push ( r ( '' ) )
2324 dirs . pages . push ( r ( nuxt . options . dir . pages || 'pages' ) )
@@ -33,14 +34,17 @@ export function getDirs(nuxt: Nuxt): NuxtESLintConfigOptions['dirs'] {
3334 dirs . composables . push ( r ( dir ) )
3435 }
3536
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 ) )
4448 }
4549 }
4650 }
0 commit comments