11import nx from '@nx/devkit' ;
22import 'dotenv/config' ;
3- import type { Linter } from 'eslint' ;
4- import { stat , writeFile } from 'node:fs/promises' ;
3+ import type { ESLint } from 'eslint' ;
4+ import { stat } from 'node:fs/promises' ;
55import { z } from 'zod' ;
66import eslintPlugin from './dist/packages/plugin-eslint' ;
77import type { CoreConfig } from './packages/models/src' ;
@@ -17,15 +17,8 @@ const projects = Object.values(
1717 nx . readProjectsConfigurationFromProjectGraph ( graph ) . projects ,
1818) . filter ( project => 'lint' in ( project . targets ?? { } ) ) ;
1919
20- // determine plugin parameters
21- const eslintrc = 'tmp-eslintrc.json' ;
22- const patterns = projects . flatMap ( project => [
23- ...( project . targets ?. lint . options . lintFilePatterns ?? [ ] ) ,
24- `${ project . sourceRoot } /*.test.ts` , // add test file glob to load vitest rules
25- ] ) ;
26-
2720// create single ESLint config with project-specific overrides
28- const eslintConfig : Linter . Config = {
21+ const eslintConfig : ESLint . ConfigData = {
2922 root : true ,
3023 overrides : await Promise . all (
3124 projects . map ( async project => ( {
@@ -36,7 +29,11 @@ const eslintConfig: Linter.Config = {
3629 } ) ) ,
3730 ) ,
3831} ;
39- await writeFile ( eslintrc , JSON . stringify ( eslintConfig , null , 2 ) ) ;
32+ // include patterns from each project
33+ const patterns = projects . flatMap ( project => [
34+ ...( project . targets ?. lint . options . lintFilePatterns ?? [ ] ) ,
35+ `${ project . sourceRoot } /*.test.ts` , // hack: add test file glob to load vitest rules
36+ ] ) ;
4037
4138// load upload configuration from environment
4239const envSchema = z . object ( {
@@ -61,7 +58,7 @@ const config: CoreConfig = {
6158 project : env . CP_PROJECT ,
6259 } ,
6360
64- plugins : [ await eslintPlugin ( { eslintrc, patterns } ) ] ,
61+ plugins : [ await eslintPlugin ( { eslintrc : eslintConfig , patterns } ) ] ,
6562
6663 categories : [
6764 {
0 commit comments