@@ -7,6 +7,10 @@ import {
77 eslintConfigFromAllNxProjects ,
88 eslintConfigFromNxProjectAndDeps ,
99} from './nx' ;
10+ import { eslintConfigFromNxProject } from './nx/find-project-without-deps' ;
11+
12+ const ALL_PROJECTS = [ 'cli' , 'core' , 'nx-plugin' , 'utils' ] as const ;
13+ type Project = ( typeof ALL_PROJECTS ) [ number ] ;
1014
1115describe ( 'Nx helpers' , ( ) => {
1216 let cwdSpy : MockInstance < [ ] , string > ;
@@ -101,9 +105,6 @@ describe('Nx helpers', () => {
101105 * utils ◄──────┘
102106 */
103107
104- const ALL_PROJECTS = [ 'cli' , 'core' , 'nx-plugin' , 'utils' ] as const ;
105- type Project = ( typeof ALL_PROJECTS ) [ number ] ;
106-
107108 it . each < [ Project , Project [ ] ] > ( [
108109 [ 'cli' , [ 'cli' , 'core' , 'utils' ] ] ,
109110 [ 'core' , [ 'core' , 'utils' ] ] ,
@@ -125,4 +126,34 @@ describe('Nx helpers', () => {
125126 } ,
126127 ) ;
127128 } ) ;
129+
130+ describe ( 'create config from target Nx project without its dependencies' , ( ) => {
131+ /*
132+ * Project graph:
133+ *
134+ * cli
135+ * │
136+ * │
137+ * ▼
138+ * core
139+ * │ nx-plugin
140+ * │ │
141+ * ▼ │
142+ * utils ◄──────┘
143+ */
144+
145+ it . each < [ Project ] > ( [ [ 'cli' ] , [ 'core' ] , [ 'utils' ] ] ) (
146+ 'project %j - expected configurations for projects %j' ,
147+ async project => {
148+ const targets = await eslintConfigFromNxProject ( project ) ;
149+
150+ expect ( targets ) . toEqual ( [
151+ {
152+ eslintrc : `./packages/${ project } /.eslintrc.json` ,
153+ patterns : expect . arrayContaining ( [ `packages/${ project } /**/*.ts` ] ) ,
154+ } ,
155+ ] ) ;
156+ } ,
157+ ) ;
158+ } ) ;
128159} ) ;
0 commit comments