5
5
createNodesFromFiles ,
6
6
CreateNodesResult ,
7
7
CreateNodesV2 ,
8
+ detectPackageManager ,
8
9
getPackageManagerCommand ,
9
10
logger ,
10
11
readJsonFile ,
@@ -15,17 +16,18 @@ import {
15
16
calculateHashesForCreateNodes ,
16
17
calculateHashForCreateNodes ,
17
18
} from '@nx/devkit/src/utils/calculate-hash-for-create-nodes' ;
19
+ import { getLockFileName } from '@nx/js' ;
20
+ import type { ESLint as ESLintType } from 'eslint' ;
18
21
import { existsSync } from 'node:fs' ;
19
22
import { basename , dirname , join , normalize , sep } from 'node:path/posix' ;
20
23
import { hashObject } from 'nx/src/hasher/file-hasher' ;
21
24
import { workspaceDataDirectory } from 'nx/src/utils/cache-directory' ;
22
25
import { combineGlobPatterns } from 'nx/src/utils/globs' ;
23
26
import { globWithWorkspaceContext } from 'nx/src/utils/workspace-context' ;
24
27
import { gte } from 'semver' ;
25
- import type { ESLint as ESLintType } from 'eslint' ;
26
28
import {
27
- baseEsLintConfigFile ,
28
29
BASE_ESLINT_CONFIG_FILENAMES ,
30
+ baseEsLintConfigFile ,
29
31
ESLINT_CONFIG_FILENAMES ,
30
32
isFlatConfig ,
31
33
} from '../utils/config-file' ;
@@ -135,14 +137,13 @@ const internalCreateNodes = async (
135
137
) ;
136
138
const hash = await calculateHashForCreateNodes (
137
139
childProjectRoot ,
138
- {
139
- ...options ,
140
- // change this to bust the cache when making changes that would yield
141
- // different results for the same hash
142
- bust : 1 ,
143
- } ,
140
+ options ,
144
141
context ,
145
- [ ...parentConfigs , join ( childProjectRoot , '.eslintignore' ) ]
142
+ [
143
+ ...parentConfigs ,
144
+ join ( childProjectRoot , '.eslintignore' ) ,
145
+ getLockFileName ( detectPackageManager ( context . workspaceRoot ) ) ,
146
+ ]
146
147
) ;
147
148
148
149
if ( projectsCache [ hash ] ) {
@@ -280,20 +281,18 @@ export const createNodesV2: CreateNodesV2<EslintPluginOptions> = [
280
281
options ,
281
282
context
282
283
) ;
284
+ const lockFilePattern = getLockFileName (
285
+ detectPackageManager ( context . workspaceRoot )
286
+ ) ;
283
287
const hashes = await calculateHashesForCreateNodes (
284
288
projectRoots ,
285
- {
286
- ...options ,
287
- // change this to bust the cache when making changes that would yield
288
- // different results for the same hash
289
- bust : 1 ,
290
- } ,
289
+ options ,
291
290
context ,
292
291
projectRoots . map ( ( root ) => {
293
292
const parentConfigs = eslintConfigFiles . filter ( ( eslintConfig ) =>
294
293
isSubDir ( root , dirname ( eslintConfig ) )
295
294
) ;
296
- return [ ...parentConfigs , join ( root , '.eslintignore' ) ] ;
295
+ return [ ...parentConfigs , join ( root , '.eslintignore' ) , lockFilePattern ] ;
297
296
} )
298
297
) ;
299
298
const hashByRoot = new Map < string , string > (
0 commit comments