@nx/eslint 19.7.0-canary.20240906-a3c2db8 → 19.7.0
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +4 -4
- package/src/plugins/plugin.js +6 -10
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nx/eslint",
|
3
|
-
"version": "19.7.0
|
3
|
+
"version": "19.7.0",
|
4
4
|
"private": false,
|
5
5
|
"description": "The ESLint plugin for Nx contains executors, generators and utilities used for linting JavaScript/TypeScript projects within an Nx workspace.",
|
6
6
|
"repository": {
|
@@ -35,12 +35,12 @@
|
|
35
35
|
"eslint": "^8.0.0 || ^9.0.0"
|
36
36
|
},
|
37
37
|
"dependencies": {
|
38
|
-
"@nx/devkit": "19.7.0
|
39
|
-
"@nx/js": "19.7.0
|
38
|
+
"@nx/devkit": "19.7.0",
|
39
|
+
"@nx/js": "19.7.0",
|
40
40
|
"semver": "^7.5.3",
|
41
41
|
"tslib": "^2.3.0",
|
42
42
|
"typescript": "~5.4.2",
|
43
|
-
"@nx/linter": "19.7.0
|
43
|
+
"@nx/linter": "19.7.0"
|
44
44
|
},
|
45
45
|
"peerDependenciesMeta": {
|
46
46
|
"@zkochan/js-yaml": {
|
package/src/plugins/plugin.js
CHANGED
@@ -94,8 +94,7 @@ const internalCreateNodes = async (configFilePath, options, context, projectsCac
|
|
94
94
|
projects,
|
95
95
|
};
|
96
96
|
};
|
97
|
-
|
98
|
-
const internalCreateNodesV2 = async (configFilePath, options, context, eslintConfigFiles, allProjectRoots, projectRootsByEslintRoots, lintableFilesPerProjectRoot, projectsCache) => {
|
97
|
+
const internalCreateNodesV2 = async (configFilePath, options, context, eslintConfigFiles, projectRootsByEslintRoots, lintableFilesPerProjectRoot, projectsCache) => {
|
99
98
|
const configDir = (0, posix_1.dirname)(configFilePath);
|
100
99
|
const ESLint = await (0, resolve_eslint_class_1.resolveESLintClass)((0, config_file_1.isFlatConfig)(configFilePath));
|
101
100
|
const eslintVersion = ESLint.version;
|
@@ -112,11 +111,6 @@ const internalCreateNodesV2 = async (configFilePath, options, context, eslintCon
|
|
112
111
|
Object.assign(projects, projectsCache[hash]);
|
113
112
|
return;
|
114
113
|
}
|
115
|
-
if (!lintableFilesPerProjectRoot.size) {
|
116
|
-
collectingLintableFilesPromise ??= collectLintableFilesByProjectRoot(lintableFilesPerProjectRoot, allProjectRoots, options, context);
|
117
|
-
await collectingLintableFilesPromise;
|
118
|
-
collectingLintableFilesPromise = null;
|
119
|
-
}
|
120
114
|
const eslint = new ESLint({
|
121
115
|
cwd: (0, posix_1.join)(context.workspaceRoot, projectRoot),
|
122
116
|
});
|
@@ -155,9 +149,9 @@ exports.createNodesV2 = [
|
|
155
149
|
const cachePath = (0, posix_1.join)(cache_directory_1.workspaceDataDirectory, `eslint-${optionsHash}.hash`);
|
156
150
|
const targetsCache = readTargetsCache(cachePath);
|
157
151
|
const { eslintConfigFiles, projectRoots, projectRootsByEslintRoots } = splitConfigFiles(configFiles);
|
158
|
-
const lintableFilesPerProjectRoot =
|
152
|
+
const lintableFilesPerProjectRoot = await collectLintableFilesByProjectRoot(projectRoots, options, context);
|
159
153
|
try {
|
160
|
-
return await (0, devkit_1.createNodesFromFiles)((configFile, options, context) => internalCreateNodesV2(configFile, options, context, eslintConfigFiles,
|
154
|
+
return await (0, devkit_1.createNodesFromFiles)((configFile, options, context) => internalCreateNodesV2(configFile, options, context, eslintConfigFiles, projectRootsByEslintRoots, lintableFilesPerProjectRoot, targetsCache), eslintConfigFiles, options, context);
|
161
155
|
}
|
162
156
|
finally {
|
163
157
|
writeTargetsToCache(cachePath, targetsCache);
|
@@ -203,7 +197,8 @@ function groupProjectRootsByEslintRoots(eslintConfigFiles, projectRoots) {
|
|
203
197
|
}
|
204
198
|
return projectRootsByEslintRoots;
|
205
199
|
}
|
206
|
-
async function collectLintableFilesByProjectRoot(
|
200
|
+
async function collectLintableFilesByProjectRoot(projectRoots, options, context) {
|
201
|
+
const lintableFilesPerProjectRoot = new Map();
|
207
202
|
const lintableFiles = await (0, workspace_context_1.globWithWorkspaceContext)(context.workspaceRoot, [
|
208
203
|
`**/*.{${options.extensions.join(',')}}`,
|
209
204
|
]);
|
@@ -216,6 +211,7 @@ async function collectLintableFilesByProjectRoot(lintableFilesPerProjectRoot, pr
|
|
216
211
|
lintableFilesPerProjectRoot.get(projectRoot).push(file);
|
217
212
|
}
|
218
213
|
}
|
214
|
+
return lintableFilesPerProjectRoot;
|
219
215
|
}
|
220
216
|
function getRootForDirectory(directory, roots) {
|
221
217
|
let currentPath = (0, posix_1.normalize)(directory);
|