@nx/eslint 22.0.0-canary.20251006-738b06b → 22.0.0-canary.20251008-05ab516
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": "22.0.0-canary.
|
3
|
+
"version": "22.0.0-canary.20251008-05ab516",
|
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,14 +35,14 @@
|
|
35
35
|
"eslint": "^8.0.0 || ^9.0.0"
|
36
36
|
},
|
37
37
|
"dependencies": {
|
38
|
-
"@nx/devkit": "22.0.0-canary.
|
39
|
-
"@nx/js": "22.0.0-canary.
|
38
|
+
"@nx/devkit": "22.0.0-canary.20251008-05ab516",
|
39
|
+
"@nx/js": "22.0.0-canary.20251008-05ab516",
|
40
40
|
"semver": "^7.5.3",
|
41
41
|
"tslib": "^2.3.0",
|
42
42
|
"typescript": "~5.9.2"
|
43
43
|
},
|
44
44
|
"devDependencies": {
|
45
|
-
"nx": "22.0.0-canary.
|
45
|
+
"nx": "22.0.0-canary.20251008-05ab516"
|
46
46
|
},
|
47
47
|
"peerDependenciesMeta": {
|
48
48
|
"@zkochan/js-yaml": {
|
package/src/plugins/plugin.d.ts
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
import {
|
1
|
+
import { CreateNodesV2 } from '@nx/devkit';
|
2
2
|
export interface EslintPluginOptions {
|
3
3
|
targetName?: string;
|
4
4
|
extensions?: string[];
|
5
5
|
}
|
6
|
+
export declare const createNodes: CreateNodesV2<EslintPluginOptions>;
|
6
7
|
export declare const createNodesV2: CreateNodesV2<EslintPluginOptions>;
|
7
|
-
export declare const createNodes: CreateNodes<EslintPluginOptions>;
|
8
8
|
//# sourceMappingURL=plugin.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/eslint/src/plugins/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/eslint/src/plugins/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,aAAa,EAMd,MAAM,YAAY,CAAC;AAqBpB,MAAM,WAAW,mBAAmB;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AA0GD,eAAO,MAAM,WAAW,EAAE,aAAa,CAAC,mBAAmB,CA8D1D,CAAC;AAEF,eAAO,MAAM,aAAa,oCAAc,CAAC"}
|
package/src/plugins/plugin.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.createNodesV2 = exports.createNodes = void 0;
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
5
5
|
const calculate_hash_for_create_nodes_1 = require("@nx/devkit/src/utils/calculate-hash-for-create-nodes");
|
6
6
|
const js_1 = require("@nx/js");
|
@@ -27,7 +27,6 @@ const DEFAULT_EXTENSIONS = [
|
|
27
27
|
'vue',
|
28
28
|
];
|
29
29
|
const PROJECT_CONFIG_FILENAMES = ['project.json', 'package.json'];
|
30
|
-
const ESLINT_CONFIG_GLOB_V1 = (0, globs_1.combineGlobPatterns)(config_file_1.ESLINT_CONFIG_FILENAMES.map((f) => `**/${f}`));
|
31
30
|
const ESLINT_CONFIG_GLOB_V2 = (0, globs_1.combineGlobPatterns)([
|
32
31
|
...config_file_1.ESLINT_CONFIG_FILENAMES.map((f) => `**/${f}`),
|
33
32
|
...PROJECT_CONFIG_FILENAMES.map((f) => `**/${f}`),
|
@@ -40,78 +39,6 @@ function readTargetsCache(cachePath) {
|
|
40
39
|
function writeTargetsToCache(cachePath, results) {
|
41
40
|
(0, devkit_1.writeJsonFile)(cachePath, results);
|
42
41
|
}
|
43
|
-
const internalCreateNodes = async (configFilePath, options, context, projectsCache) => {
|
44
|
-
options = normalizeOptions(options);
|
45
|
-
const configDir = (0, posix_1.dirname)(configFilePath);
|
46
|
-
// Ensure that configFiles are set, e2e-run fails due to them being undefined in CI (does not occur locally)
|
47
|
-
// TODO(JamesHenry): Further troubleshoot this in CI
|
48
|
-
context.configFiles = context.configFiles ?? [];
|
49
|
-
// Create a Set of all the directories containing eslint configs, and a
|
50
|
-
// list of globs to exclude from child projects
|
51
|
-
const nestedEslintRootPatterns = [];
|
52
|
-
for (const configFile of context.configFiles) {
|
53
|
-
const eslintRootDir = (0, posix_1.dirname)(configFile);
|
54
|
-
if (eslintRootDir !== configDir && isSubDir(configDir, eslintRootDir)) {
|
55
|
-
nestedEslintRootPatterns.push(`${eslintRootDir}/**/*`);
|
56
|
-
}
|
57
|
-
}
|
58
|
-
const projectFiles = await (0, workspace_context_1.globWithWorkspaceContext)(context.workspaceRoot, ['project.json', 'package.json', '**/project.json', '**/package.json'].map((f) => (0, posix_1.join)(configDir, f)), nestedEslintRootPatterns.length ? nestedEslintRootPatterns : undefined);
|
59
|
-
// dedupe and sort project roots by depth for more efficient traversal
|
60
|
-
const dedupedProjectRoots = Array.from(new Set(projectFiles.map((f) => (0, posix_1.dirname)(f)))).sort((a, b) => (a !== b && isSubDir(a, b) ? -1 : 1));
|
61
|
-
const excludePatterns = dedupedProjectRoots.map((root) => `${root}/**/*`);
|
62
|
-
const ESLint = await (0, resolve_eslint_class_1.resolveESLintClass)({
|
63
|
-
useFlatConfigOverrideVal: (0, config_file_1.isFlatConfig)(configFilePath),
|
64
|
-
});
|
65
|
-
const eslintVersion = ESLint.version;
|
66
|
-
const projects = {};
|
67
|
-
await Promise.all(dedupedProjectRoots.map(async (childProjectRoot, index) => {
|
68
|
-
// anything after is either a nested project or a sibling project, can be excluded
|
69
|
-
const nestedProjectRootPatterns = excludePatterns.slice(index + 1);
|
70
|
-
// Ignore project roots where the project does not contain any lintable files
|
71
|
-
const lintableFiles = await (0, workspace_context_1.globWithWorkspaceContext)(context.workspaceRoot, [(0, posix_1.join)(childProjectRoot, `**/*.{${options.extensions.join(',')}}`)],
|
72
|
-
// exclude nested eslint roots and nested project roots
|
73
|
-
[...nestedEslintRootPatterns, ...nestedProjectRootPatterns]);
|
74
|
-
const parentConfigs = context.configFiles.filter((eslintConfig) => isSubDir(childProjectRoot, (0, posix_1.dirname)(eslintConfig)));
|
75
|
-
const hash = await (0, calculate_hash_for_create_nodes_1.calculateHashForCreateNodes)(childProjectRoot, options, context, [
|
76
|
-
...parentConfigs,
|
77
|
-
(0, posix_1.join)(childProjectRoot, '.eslintignore'),
|
78
|
-
(0, js_1.getLockFileName)((0, devkit_1.detectPackageManager)(context.workspaceRoot)),
|
79
|
-
]);
|
80
|
-
if (projectsCache[hash]) {
|
81
|
-
// We can reuse the projects in the cache.
|
82
|
-
Object.assign(projects, projectsCache[hash]);
|
83
|
-
return;
|
84
|
-
}
|
85
|
-
const eslint = new ESLint({
|
86
|
-
cwd: (0, posix_1.join)(context.workspaceRoot, childProjectRoot),
|
87
|
-
});
|
88
|
-
let hasNonIgnoredLintableFiles = false;
|
89
|
-
for (const file of lintableFiles) {
|
90
|
-
if (!(await eslint.isPathIgnored((0, posix_1.join)(context.workspaceRoot, file)))) {
|
91
|
-
hasNonIgnoredLintableFiles = true;
|
92
|
-
break;
|
93
|
-
}
|
94
|
-
}
|
95
|
-
if (!hasNonIgnoredLintableFiles) {
|
96
|
-
// No lintable files in the project, store in the cache and skip further processing
|
97
|
-
projectsCache[hash] = {};
|
98
|
-
return;
|
99
|
-
}
|
100
|
-
const project = getProjectUsingESLintConfig(configFilePath, childProjectRoot, eslintVersion, options, context);
|
101
|
-
if (project) {
|
102
|
-
projects[childProjectRoot] = project;
|
103
|
-
// Store project into the cache
|
104
|
-
projectsCache[hash] = { [childProjectRoot]: project };
|
105
|
-
}
|
106
|
-
else {
|
107
|
-
// No project found, store in the cache
|
108
|
-
projectsCache[hash] = {};
|
109
|
-
}
|
110
|
-
}));
|
111
|
-
return {
|
112
|
-
projects,
|
113
|
-
};
|
114
|
-
};
|
115
42
|
const internalCreateNodesV2 = async (ESLint, configFilePath, options, context, projectRootsByEslintRoots, lintableFilesPerProjectRoot, projectsCache, hashByRoot) => {
|
116
43
|
const configDir = (0, posix_1.dirname)(configFilePath);
|
117
44
|
const eslintVersion = ESLint.version;
|
@@ -158,7 +85,7 @@ const internalCreateNodesV2 = async (ESLint, configFilePath, options, context, p
|
|
158
85
|
projects,
|
159
86
|
};
|
160
87
|
};
|
161
|
-
exports.
|
88
|
+
exports.createNodes = [
|
162
89
|
ESLINT_CONFIG_GLOB_V2,
|
163
90
|
async (configFiles, options, context) => {
|
164
91
|
options = normalizeOptions(options);
|
@@ -187,13 +114,7 @@ exports.createNodesV2 = [
|
|
187
114
|
}
|
188
115
|
},
|
189
116
|
];
|
190
|
-
exports.
|
191
|
-
ESLINT_CONFIG_GLOB_V1,
|
192
|
-
(configFilePath, options, context) => {
|
193
|
-
devkit_1.logger.warn('`createNodes` is deprecated. Update your plugin to utilize createNodesV2 instead. In Nx 20, this will change to the createNodesV2 API.');
|
194
|
-
return internalCreateNodes(configFilePath, options, context, {});
|
195
|
-
},
|
196
|
-
];
|
117
|
+
exports.createNodesV2 = exports.createNodes;
|
197
118
|
function splitConfigFiles(configFiles) {
|
198
119
|
const eslintConfigFiles = [];
|
199
120
|
const projectRoots = new Set();
|