@nx/eslint 19.0.0-canary.20240425-cec57c4 → 19.0.0-canary.20240427-f74aeab

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": "19.0.0-canary.20240425-cec57c4",
3
+ "version": "19.0.0-canary.20240427-f74aeab",
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": {
@@ -33,12 +33,12 @@
33
33
  "js-yaml": "4.1.0"
34
34
  },
35
35
  "dependencies": {
36
- "@nx/devkit": "19.0.0-canary.20240425-cec57c4",
37
- "@nx/js": "19.0.0-canary.20240425-cec57c4",
36
+ "@nx/devkit": "19.0.0-canary.20240427-f74aeab",
37
+ "@nx/js": "19.0.0-canary.20240427-f74aeab",
38
38
  "eslint": "^8.0.0",
39
39
  "tslib": "^2.3.0",
40
40
  "typescript": "~5.4.2",
41
- "@nx/linter": "19.0.0-canary.20240425-cec57c4"
41
+ "@nx/linter": "19.0.0-canary.20240427-f74aeab"
42
42
  },
43
43
  "peerDependenciesMeta": {
44
44
  "js-yaml": {
@@ -30,21 +30,24 @@ exports.createNodes = [
30
30
  nestedEslintRootPatterns.push(`${eslintRootDir}/**/*`);
31
31
  }
32
32
  }
33
- const childProjectRoots = new Set();
34
- const ESLint = resolveESLintClass((0, config_file_1.isFlatConfig)(configFilePath));
35
33
  const projectFiles = (0, workspace_context_1.globWithWorkspaceContext)(context.workspaceRoot, [
36
34
  'project.json',
37
35
  'package.json',
38
36
  '**/project.json',
39
37
  '**/package.json',
40
38
  ].map((f) => (0, node_path_1.join)(configDir, f)), nestedEslintRootPatterns.length ? nestedEslintRootPatterns : undefined);
41
- for (const projectFile of projectFiles) {
42
- const childProjectRoot = (0, node_path_1.dirname)(projectFile);
43
- if (childProjectRoots.has(childProjectRoot)) {
44
- continue;
45
- }
39
+ // dedupe and sort project roots by depth for more efficient traversal
40
+ const dedupedProjectRoots = Array.from(new Set(projectFiles.map((f) => (0, node_path_1.dirname)(f)))).sort((a, b) => (a !== b && isSubDir(a, b) ? -1 : 1));
41
+ const excludePatterns = dedupedProjectRoots.map((root) => `${root}/**/*`);
42
+ const ESLint = resolveESLintClass((0, config_file_1.isFlatConfig)(configFilePath));
43
+ const childProjectRoots = new Set();
44
+ await Promise.all(dedupedProjectRoots.map(async (childProjectRoot, index) => {
45
+ // anything after is either a nested project or a sibling project, can be excluded
46
+ const nestedProjectRootPatterns = excludePatterns.slice(index + 1);
46
47
  // Ignore project roots where the project does not contain any lintable files
47
- const lintableFiles = (0, workspace_context_1.globWithWorkspaceContext)(context.workspaceRoot, [(0, node_path_1.join)(childProjectRoot, `**/*.{${options.extensions.join(',')}}`)], nestedEslintRootPatterns.length ? nestedEslintRootPatterns : undefined);
48
+ const lintableFiles = (0, workspace_context_1.globWithWorkspaceContext)(context.workspaceRoot, [(0, node_path_1.join)(childProjectRoot, `**/*.{${options.extensions.join(',')}}`)],
49
+ // exclude nested eslint roots and nested project roots
50
+ [...nestedEslintRootPatterns, ...nestedProjectRootPatterns]);
48
51
  const eslint = new ESLint({
49
52
  cwd: (0, node_path_1.join)(context.workspaceRoot, childProjectRoot),
50
53
  });
@@ -54,7 +57,7 @@ exports.createNodes = [
54
57
  break;
55
58
  }
56
59
  }
57
- }
60
+ }));
58
61
  const uniqueChildProjectRoots = Array.from(childProjectRoots);
59
62
  return {
60
63
  projects: getProjectsUsingESLintConfig(configFilePath, uniqueChildProjectRoots, options, context),