@nx/eslint 0.0.0-pr-3-d8b1402 → 0.0.0-pr-29935-b2840f8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/eslint",
|
|
3
|
-
"version": "0.0.0-pr-
|
|
3
|
+
"version": "0.0.0-pr-29935-b2840f8",
|
|
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,8 +35,8 @@
|
|
|
35
35
|
"eslint": "^8.0.0 || ^9.0.0"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@nx/devkit": "0.0.0-pr-
|
|
39
|
-
"@nx/js": "0.0.0-pr-
|
|
38
|
+
"@nx/devkit": "0.0.0-pr-29935-b2840f8",
|
|
39
|
+
"@nx/js": "0.0.0-pr-29935-b2840f8",
|
|
40
40
|
"semver": "^7.5.3",
|
|
41
41
|
"tslib": "^2.3.0",
|
|
42
42
|
"typescript": "~5.7.2"
|
|
@@ -357,9 +357,9 @@ function addExtendsToLintConfig(tree, root, plugin, insertAtTheEnd = false) {
|
|
|
357
357
|
}
|
|
358
358
|
tree.write(fileName, content);
|
|
359
359
|
if (shouldImportEslintCompat) {
|
|
360
|
-
return (0, devkit_1.addDependenciesToPackageJson)(tree, {}, { '@eslint/compat': versions_1.eslintCompat }, undefined, true);
|
|
360
|
+
return (0, devkit_1.addDependenciesToPackageJson)(tree, {}, { '@eslint/compat': versions_1.eslintCompat, '@eslint/eslintrc': versions_1.eslintrcVersion }, undefined, true);
|
|
361
361
|
}
|
|
362
|
-
return ()
|
|
362
|
+
return (0, devkit_1.addDependenciesToPackageJson)(tree, {}, { '@eslint/eslintrc': versions_1.eslintrcVersion }, undefined, true);
|
|
363
363
|
}
|
|
364
364
|
else {
|
|
365
365
|
const plugins = (Array.isArray(plugin) ? plugin : [plugin]).map((p) => typeof p === 'string' ? p : p.name);
|
package/src/plugins/plugin.js
CHANGED
|
@@ -107,7 +107,7 @@ const internalCreateNodes = async (configFilePath, options, context, projectsCac
|
|
|
107
107
|
projects,
|
|
108
108
|
};
|
|
109
109
|
};
|
|
110
|
-
const internalCreateNodesV2 = async (configFilePath, options, context,
|
|
110
|
+
const internalCreateNodesV2 = async (configFilePath, options, context, projectRootsByEslintRoots, lintableFilesPerProjectRoot, projectsCache, hashByRoot) => {
|
|
111
111
|
const configDir = (0, posix_1.dirname)(configFilePath);
|
|
112
112
|
const ESLint = await (0, resolve_eslint_class_1.resolveESLintClass)({
|
|
113
113
|
useFlatConfigOverrideVal: (0, config_file_1.isFlatConfig)(configFilePath),
|
|
@@ -115,12 +115,7 @@ const internalCreateNodesV2 = async (configFilePath, options, context, eslintCon
|
|
|
115
115
|
const eslintVersion = ESLint.version;
|
|
116
116
|
const projects = {};
|
|
117
117
|
await Promise.all(projectRootsByEslintRoots.get(configDir).map(async (projectRoot) => {
|
|
118
|
-
const
|
|
119
|
-
const hash = await (0, calculate_hash_for_create_nodes_1.calculateHashForCreateNodes)(projectRoot, options, {
|
|
120
|
-
configFiles: eslintConfigFiles,
|
|
121
|
-
nxJsonConfiguration: context.nxJsonConfiguration,
|
|
122
|
-
workspaceRoot: context.workspaceRoot,
|
|
123
|
-
}, [...parentConfigs, (0, posix_1.join)(projectRoot, '.eslintignore')]);
|
|
118
|
+
const hash = hashByRoot.get(projectRoot);
|
|
124
119
|
if (projectsCache[hash]) {
|
|
125
120
|
// We can reuse the projects in the cache.
|
|
126
121
|
Object.assign(projects, projectsCache[hash]);
|
|
@@ -165,8 +160,13 @@ exports.createNodesV2 = [
|
|
|
165
160
|
const targetsCache = readTargetsCache(cachePath);
|
|
166
161
|
const { eslintConfigFiles, projectRoots, projectRootsByEslintRoots } = splitConfigFiles(configFiles);
|
|
167
162
|
const lintableFilesPerProjectRoot = await collectLintableFilesByProjectRoot(projectRoots, options, context);
|
|
163
|
+
const hashes = await (0, calculate_hash_for_create_nodes_1.calculateHashesForCreateNodes)(projectRoots, options, context, projectRoots.map((root) => {
|
|
164
|
+
const parentConfigs = eslintConfigFiles.filter((eslintConfig) => isSubDir(root, (0, posix_1.dirname)(eslintConfig)));
|
|
165
|
+
return [...parentConfigs, (0, posix_1.join)(root, '.eslintignore')];
|
|
166
|
+
}));
|
|
167
|
+
const hashByRoot = new Map(projectRoots.map((r, i) => [r, hashes[i]]));
|
|
168
168
|
try {
|
|
169
|
-
return await (0, devkit_1.createNodesFromFiles)((configFile, options, context) => internalCreateNodesV2(configFile, options, context,
|
|
169
|
+
return await (0, devkit_1.createNodesFromFiles)((configFile, options, context) => internalCreateNodesV2(configFile, options, context, projectRootsByEslintRoots, lintableFilesPerProjectRoot, targetsCache, hashByRoot), eslintConfigFiles, options, context);
|
|
170
170
|
}
|
|
171
171
|
finally {
|
|
172
172
|
writeTargetsToCache(cachePath, targetsCache);
|