@nx/eslint 23.0.0-beta.11 → 23.0.0-beta.13
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 +5 -5
- package/src/generators/convert-to-flat-config/generator.d.ts.map +1 -1
- package/src/generators/convert-to-flat-config/generator.js +33 -12
- package/src/generators/init/init.d.ts.map +1 -1
- package/src/generators/init/init.js +26 -13
- package/src/generators/lint-project/lint-project.js +2 -2
- package/src/generators/workspace-rules-project/workspace-rules-project.d.ts.map +1 -1
- package/src/generators/workspace-rules-project/workspace-rules-project.js +16 -6
- package/src/migrations/update-21-6-0/update-executor-lint-inputs.d.ts.map +1 -1
- package/src/migrations/update-21-6-0/update-executor-lint-inputs.js +9 -3
- package/src/plugins/plugin.d.ts.map +1 -1
- package/src/plugins/plugin.js +22 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/eslint",
|
|
3
|
-
"version": "23.0.0-beta.
|
|
3
|
+
"version": "23.0.0-beta.13",
|
|
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": {
|
|
@@ -32,19 +32,19 @@
|
|
|
32
32
|
"generators": "./generators.json",
|
|
33
33
|
"executors": "./executors.json",
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@nx/jest": "23.0.0-beta.
|
|
35
|
+
"@nx/jest": "23.0.0-beta.13",
|
|
36
36
|
"@zkochan/js-yaml": "0.0.7",
|
|
37
37
|
"eslint": "^8.0.0 || ^9.0.0 || ^10.0.0"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@nx/devkit": "23.0.0-beta.
|
|
41
|
-
"@nx/js": "23.0.0-beta.
|
|
40
|
+
"@nx/devkit": "23.0.0-beta.13",
|
|
41
|
+
"@nx/js": "23.0.0-beta.13",
|
|
42
42
|
"semver": "^7.6.3",
|
|
43
43
|
"tslib": "^2.3.0",
|
|
44
44
|
"typescript": "~5.9.2"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"nx": "23.0.0-beta.
|
|
47
|
+
"nx": "23.0.0-beta.13"
|
|
48
48
|
},
|
|
49
49
|
"peerDependenciesMeta": {
|
|
50
50
|
"@nx/jest": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../../../../packages/eslint/src/generators/convert-to-flat-config/generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,
|
|
1
|
+
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../../../../packages/eslint/src/generators/convert-to-flat-config/generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EAUjB,IAAI,EAGL,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,kCAAkC,EAAE,MAAM,UAAU,CAAC;AAiB9D,wBAAsB,4BAA4B,CAChD,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,kCAAkC,GAC1C,OAAO,CAAC,IAAI,GAAG,iBAAiB,CAAC,CA8CnC;AAED,eAAe,4BAA4B,CAAC"}
|
|
@@ -49,6 +49,18 @@ function isEslintTarget(target) {
|
|
|
49
49
|
return (target.executor === ESLINT_LINT_EXECUTOR ||
|
|
50
50
|
target.command?.includes('eslint'));
|
|
51
51
|
}
|
|
52
|
+
function hasMatchingEslintTargetDefault(projectConfig, targetDefaults) {
|
|
53
|
+
if (!projectConfig.targets || !targetDefaults) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
if (Array.isArray(targetDefaults)) {
|
|
57
|
+
return targetDefaults.some((entry) => entry.target !== undefined &&
|
|
58
|
+
projectConfig.targets[entry.target] !== undefined &&
|
|
59
|
+
(entry.target === ESLINT_LINT_EXECUTOR || isEslintTarget(entry)));
|
|
60
|
+
}
|
|
61
|
+
return Object.entries(targetDefaults).some(([targetName, targetConfig]) => projectConfig.targets[targetName] !== undefined &&
|
|
62
|
+
(targetName === ESLINT_LINT_EXECUTOR || isEslintTarget(targetConfig)));
|
|
63
|
+
}
|
|
52
64
|
function convertProjectToFlatConfig(tree, project, projectConfig, nxJson, eslintIgnoreFiles, format) {
|
|
53
65
|
const eslintFile = (0, eslint_file_1.findEslintFile)(tree, projectConfig.root);
|
|
54
66
|
if (!eslintFile || eslintFile.endsWith('.js')) {
|
|
@@ -71,10 +83,7 @@ function convertProjectToFlatConfig(tree, project, projectConfig, nxJson, eslint
|
|
|
71
83
|
if (eslintTargets.length > 0) {
|
|
72
84
|
(0, devkit_1.updateProjectConfiguration)(tree, project, projectConfig);
|
|
73
85
|
}
|
|
74
|
-
const hasEslintTargetDefaults = projectConfig.
|
|
75
|
-
Object.keys(nxJson.targetDefaults || {}).some((t) => (t === ESLINT_LINT_EXECUTOR ||
|
|
76
|
-
isEslintTarget(nxJson.targetDefaults[t])) &&
|
|
77
|
-
projectConfig.targets[t]);
|
|
86
|
+
const hasEslintTargetDefaults = hasMatchingEslintTargetDefault(projectConfig, nxJson.targetDefaults);
|
|
78
87
|
if (eslintTargets.length === 0 &&
|
|
79
88
|
!hasEslintTargetDefaults &&
|
|
80
89
|
!(0, plugin_1.hasEslintPlugin)(tree)) {
|
|
@@ -124,20 +133,32 @@ function ensureInputPresent(inputs, value, format) {
|
|
|
124
133
|
}
|
|
125
134
|
// Updates nx.json: rewrites stale eslintrc/eslintignore references across all targetDefaults
|
|
126
135
|
// inputs and namedInputs, and ensures lint targets include the new flat config file as an input
|
|
127
|
-
// (and `production` excludes it).
|
|
136
|
+
// (and `production` excludes it). Handles both the legacy record shape and the new array shape
|
|
137
|
+
// of `targetDefaults`.
|
|
128
138
|
function updateNxJsonConfig(tree, format) {
|
|
129
139
|
if (!tree.exists('nx.json')) {
|
|
130
140
|
return;
|
|
131
141
|
}
|
|
132
142
|
(0, devkit_1.updateJson)(tree, 'nx.json', (json) => {
|
|
143
|
+
const rewriteTargetInputs = (target, isLintTarget) => {
|
|
144
|
+
if (!target.inputs)
|
|
145
|
+
return;
|
|
146
|
+
target.inputs = isLintTarget
|
|
147
|
+
? ensureInputPresent(target.inputs, `{workspaceRoot}/eslint.config.${format}`, format)
|
|
148
|
+
: rewriteLegacyInputs(target.inputs, format);
|
|
149
|
+
};
|
|
133
150
|
if (json.targetDefaults) {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
151
|
+
if (Array.isArray(json.targetDefaults)) {
|
|
152
|
+
for (const entry of json.targetDefaults) {
|
|
153
|
+
const isLintTarget = entry.target === 'lint' || entry.target === ESLINT_LINT_EXECUTOR;
|
|
154
|
+
rewriteTargetInputs(entry, isLintTarget);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
for (const [name, target] of Object.entries(json.targetDefaults)) {
|
|
159
|
+
const isLintTarget = name === 'lint' || name === ESLINT_LINT_EXECUTOR;
|
|
160
|
+
rewriteTargetInputs(target, isLintTarget);
|
|
161
|
+
}
|
|
141
162
|
}
|
|
142
163
|
}
|
|
143
164
|
if (json.namedInputs) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../../packages/eslint/src/generators/init/init.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../../packages/eslint/src/generators/init/init.ts"],"names":[],"mappings":"AAKA,OAAO,EAGL,iBAAiB,EAKjB,IAAI,EAGL,MAAM,YAAY,CAAC;AAUpB,MAAM,WAAW,iBAAiB;IAChC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,kBAAkB,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;CACpC;AA0DD,wBAAsB,UAAU,CAC9B,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,iBAAiB,CAAC,CAwF5B;AAED,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,iBAAiB,8BAG3B"}
|
|
@@ -21,19 +21,32 @@ function updateProductionFileset(tree, format = 'mjs') {
|
|
|
21
21
|
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
22
22
|
}
|
|
23
23
|
function addTargetDefaults(tree, format) {
|
|
24
|
-
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
nxJson.targetDefaults
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
24
|
+
const nxJson = (0, devkit_1.readNxJson)(tree) ?? {};
|
|
25
|
+
// `@nx/eslint:lint` is an executor identifier — match defaults keyed on
|
|
26
|
+
// the executor, not on a target named that string.
|
|
27
|
+
const existing = (0, internal_1.findTargetDefault)(nxJson.targetDefaults, {
|
|
28
|
+
executor: '@nx/eslint:lint',
|
|
29
|
+
});
|
|
30
|
+
const patch = {};
|
|
31
|
+
if (existing?.cache === undefined)
|
|
32
|
+
patch.cache = true;
|
|
33
|
+
if (existing?.inputs === undefined) {
|
|
34
|
+
patch.inputs = [
|
|
35
|
+
'default',
|
|
36
|
+
'^default',
|
|
37
|
+
`{workspaceRoot}/.eslintrc.json`,
|
|
38
|
+
`{workspaceRoot}/.eslintignore`,
|
|
39
|
+
`{workspaceRoot}/eslint.config.${format}`,
|
|
40
|
+
'{workspaceRoot}/tools/eslint-rules/**/*',
|
|
41
|
+
];
|
|
42
|
+
}
|
|
43
|
+
if (Object.keys(patch).length > 0) {
|
|
44
|
+
(0, internal_1.upsertTargetDefault)(tree, nxJson, {
|
|
45
|
+
executor: '@nx/eslint:lint',
|
|
46
|
+
...patch,
|
|
47
|
+
});
|
|
48
|
+
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
49
|
+
}
|
|
37
50
|
}
|
|
38
51
|
function updateVsCodeRecommendedExtensions(host) {
|
|
39
52
|
if (!host.exists('.vscode/extensions.json')) {
|
|
@@ -15,7 +15,7 @@ const config_file_1 = require("../../utils/config-file");
|
|
|
15
15
|
const plugin_1 = require("../utils/plugin");
|
|
16
16
|
const versions_1 = require("../../utils/versions");
|
|
17
17
|
const setup_root_eslint_1 = require("./setup-root-eslint");
|
|
18
|
-
const
|
|
18
|
+
const internal_1 = require("@nx/js/internal");
|
|
19
19
|
function lintProjectGenerator(tree, options) {
|
|
20
20
|
return lintProjectGeneratorInternal(tree, { addPlugin: false, ...options });
|
|
21
21
|
}
|
|
@@ -237,7 +237,7 @@ function isJsAnalyzeSourceFilesEnabled(tree) {
|
|
|
237
237
|
nxJson.extends !== 'nx/presets/npm.json');
|
|
238
238
|
}
|
|
239
239
|
function isBuildableLibraryProject(tree, projectConfig) {
|
|
240
|
-
return ((0,
|
|
240
|
+
return ((0, internal_1.getProjectType)(tree, projectConfig.root, projectConfig.projectType) ===
|
|
241
241
|
'library' &&
|
|
242
242
|
projectConfig.targets?.build &&
|
|
243
243
|
!!projectConfig.targets.build);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-rules-project.d.ts","sourceRoot":"","sources":["../../../../../../packages/eslint/src/generators/workspace-rules-project/workspace-rules-project.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,iBAAiB,
|
|
1
|
+
{"version":3,"file":"workspace-rules-project.d.ts","sourceRoot":"","sources":["../../../../../../packages/eslint/src/generators/workspace-rules-project/workspace-rules-project.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,iBAAiB,EAOjB,IAAI,EAGL,MAAM,YAAY,CAAC;AAWpB,eAAO,MAAM,4BAA4B,iBAAiB,CAAC;AAE3D,eAAO,MAAM,oBAAoB,uBAAuB,CAAC;AAEzD,MAAM,WAAW,yCAAyC;IACxD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,wBAAsB,kCAAkC,CACtD,IAAI,EAAE,IAAI,EACV,OAAO,GAAE,yCAA8C,8BAqGxD"}
|
|
@@ -4,8 +4,7 @@ exports.WORKSPACE_PLUGIN_DIR = exports.WORKSPACE_RULES_PROJECT_NAME = void 0;
|
|
|
4
4
|
exports.lintWorkspaceRulesProjectGenerator = lintWorkspaceRulesProjectGenerator;
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const js_1 = require("@nx/js");
|
|
7
|
-
const
|
|
8
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
7
|
+
const internal_1 = require("@nx/js/internal");
|
|
9
8
|
const path_1 = require("path");
|
|
10
9
|
const versions_1 = require("../../utils/versions");
|
|
11
10
|
const version_utils_1 = require("../../utils/version-utils");
|
|
@@ -38,8 +37,9 @@ async function lintWorkspaceRulesProjectGenerator(tree, options = {}) {
|
|
|
38
37
|
* TODO: Explore writing a ProjectGraph plugin to make this more surgical.
|
|
39
38
|
*/
|
|
40
39
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
const lintEntry = findLintTargetDefault(nxJson.targetDefaults);
|
|
41
|
+
if (lintEntry?.inputs) {
|
|
42
|
+
lintEntry.inputs.push(`{workspaceRoot}/${exports.WORKSPACE_PLUGIN_DIR}/**/*`);
|
|
43
43
|
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
44
44
|
}
|
|
45
45
|
// Add jest to the project and return installation task
|
|
@@ -49,7 +49,7 @@ async function lintWorkspaceRulesProjectGenerator(tree, options = {}) {
|
|
|
49
49
|
supportTsx: false,
|
|
50
50
|
skipSerializers: true,
|
|
51
51
|
setupFile: 'none',
|
|
52
|
-
compiler: (0,
|
|
52
|
+
compiler: (0, internal_1.isUsingTsSolutionSetup)(tree) ? 'swc' : 'tsc',
|
|
53
53
|
skipFormat: true,
|
|
54
54
|
testEnvironment: 'node',
|
|
55
55
|
}));
|
|
@@ -75,7 +75,7 @@ async function lintWorkspaceRulesProjectGenerator(tree, options = {}) {
|
|
|
75
75
|
return json;
|
|
76
76
|
});
|
|
77
77
|
// Add swc dependencies
|
|
78
|
-
tasks.push((0,
|
|
78
|
+
tasks.push((0, internal_1.addSwcRegisterDependencies)(tree));
|
|
79
79
|
const typescriptEslintVersion = (0, version_utils_1.getTypeScriptEslintVersionToInstall)(tree);
|
|
80
80
|
tasks.push((0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
|
|
81
81
|
'@typescript-eslint/utils': typescriptEslintVersion,
|
|
@@ -85,3 +85,13 @@ async function lintWorkspaceRulesProjectGenerator(tree, options = {}) {
|
|
|
85
85
|
}
|
|
86
86
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
87
87
|
}
|
|
88
|
+
function findLintTargetDefault(td) {
|
|
89
|
+
if (!td)
|
|
90
|
+
return undefined;
|
|
91
|
+
if (Array.isArray(td)) {
|
|
92
|
+
return td.find((e) => e.target === 'lint' &&
|
|
93
|
+
e.projects === undefined &&
|
|
94
|
+
e.plugin === undefined);
|
|
95
|
+
}
|
|
96
|
+
return td['lint'];
|
|
97
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-executor-lint-inputs.d.ts","sourceRoot":"","sources":["../../../../../../packages/eslint/src/migrations/update-21-6-0/update-executor-lint-inputs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAyC,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"update-executor-lint-inputs.d.ts","sourceRoot":"","sources":["../../../../../../packages/eslint/src/migrations/update-21-6-0/update-executor-lint-inputs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAyC,MAAM,YAAY,CAAC;AAM9E,yBAA+B,IAAI,EAAE,IAAI,iBAmCxC"}
|
|
@@ -2,13 +2,18 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = default_1;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
5
6
|
async function default_1(tree) {
|
|
6
|
-
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
7
|
+
const nxJson = (0, devkit_1.readNxJson)(tree) ?? {};
|
|
7
8
|
const executor = '@nx/eslint:lint';
|
|
8
|
-
|
|
9
|
+
const existing = (0, internal_1.normalizeTargetDefaults)(nxJson.targetDefaults).find((e) => e.executor === executor &&
|
|
10
|
+
e.target === undefined &&
|
|
11
|
+
e.projects === undefined &&
|
|
12
|
+
e.plugin === undefined);
|
|
13
|
+
if (!existing?.inputs) {
|
|
9
14
|
return;
|
|
10
15
|
}
|
|
11
|
-
const inputs =
|
|
16
|
+
const inputs = [...existing.inputs];
|
|
12
17
|
if (!inputs.includes('^default')) {
|
|
13
18
|
// Add after 'default' if present, otherwise at the beginning
|
|
14
19
|
const defaultIndex = inputs.indexOf('default');
|
|
@@ -22,6 +27,7 @@ async function default_1(tree) {
|
|
|
22
27
|
if (!inputs.includes('{workspaceRoot}/tools/eslint-rules/**/*')) {
|
|
23
28
|
inputs.push('{workspaceRoot}/tools/eslint-rules/**/*');
|
|
24
29
|
}
|
|
30
|
+
(0, internal_1.upsertTargetDefault)(tree, nxJson, { executor, inputs });
|
|
25
31
|
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
26
32
|
await (0, devkit_1.formatFiles)(tree);
|
|
27
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/eslint/src/plugins/plugin.ts"],"names":[],"mappings":"AAIA,OAAO,EAIL,aAAa,EAId,MAAM,YAAY,CAAC;AAuBpB,MAAM,WAAW,mBAAmB;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/eslint/src/plugins/plugin.ts"],"names":[],"mappings":"AAIA,OAAO,EAIL,aAAa,EAId,MAAM,YAAY,CAAC;AAuBpB,MAAM,WAAW,mBAAmB;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAuHD,eAAO,MAAM,WAAW,EAAE,aAAa,CAAC,mBAAmB,CAoF1D,CAAC;AAEF,eAAO,MAAM,aAAa,oCAAc,CAAC"}
|
package/src/plugins/plugin.js
CHANGED
|
@@ -4,7 +4,7 @@ exports.createNodesV2 = exports.createNodes = void 0;
|
|
|
4
4
|
const internal_1 = require("@nx/devkit/internal");
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const js_1 = require("@nx/js");
|
|
7
|
-
const internal_2 = require("@nx/js/
|
|
7
|
+
const internal_2 = require("@nx/js/internal");
|
|
8
8
|
const node_fs_1 = require("node:fs");
|
|
9
9
|
const node_path_1 = require("node:path");
|
|
10
10
|
const posix_1 = require("node:path/posix");
|
|
@@ -45,14 +45,17 @@ const internalCreateNodesV2 = async (ESLint, configFilePath, options, context, p
|
|
|
45
45
|
});
|
|
46
46
|
return sharedEslint;
|
|
47
47
|
};
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
// Collect each project root's contribution in parallel, but write
|
|
49
|
+
// them into `projects` afterwards in input order so insertion order
|
|
50
|
+
// (and therefore downstream merge order) is deterministic. Mutating
|
|
51
|
+
// `projects` from inside `Promise.all` would order keys by which
|
|
52
|
+
// async branch resolves first.
|
|
53
|
+
const orderedProjectRoots = projectRootsByEslintRoots.get(configDir) ?? [];
|
|
54
|
+
const contributions = await Promise.all(orderedProjectRoots.map(async (projectRoot) => {
|
|
50
55
|
const hash = hashByRoot.get(projectRoot);
|
|
51
56
|
const cached = projectsCache.get(hash);
|
|
52
57
|
if (cached) {
|
|
53
|
-
|
|
54
|
-
Object.assign(projects, cached);
|
|
55
|
-
return;
|
|
58
|
+
return cached;
|
|
56
59
|
}
|
|
57
60
|
let hasNonIgnoredLintableFiles = false;
|
|
58
61
|
if (configDir !== projectRoot || projectRoot === '.') {
|
|
@@ -70,19 +73,25 @@ const internalCreateNodesV2 = async (ESLint, configFilePath, options, context, p
|
|
|
70
73
|
if (!hasNonIgnoredLintableFiles) {
|
|
71
74
|
// No lintable files in the project, store in the cache and skip further processing
|
|
72
75
|
projectsCache.set(hash, {});
|
|
73
|
-
return;
|
|
76
|
+
return null;
|
|
74
77
|
}
|
|
75
78
|
const project = getProjectUsingESLintConfig(configFilePath, projectRoot, eslintVersion, options, context, pmc, tsconfigChainsByProjectRoot.get(projectRoot) ?? []);
|
|
76
79
|
if (project) {
|
|
77
|
-
|
|
80
|
+
const entry = { [projectRoot]: project };
|
|
78
81
|
// Store project into the cache
|
|
79
|
-
projectsCache.set(hash,
|
|
80
|
-
|
|
81
|
-
else {
|
|
82
|
-
// No project found, store in the cache
|
|
83
|
-
projectsCache.set(hash, {});
|
|
82
|
+
projectsCache.set(hash, entry);
|
|
83
|
+
return entry;
|
|
84
84
|
}
|
|
85
|
+
// No project found, store in the cache
|
|
86
|
+
projectsCache.set(hash, {});
|
|
87
|
+
return null;
|
|
85
88
|
}));
|
|
89
|
+
const projects = {};
|
|
90
|
+
for (const contribution of contributions) {
|
|
91
|
+
if (contribution) {
|
|
92
|
+
Object.assign(projects, contribution);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
86
95
|
return {
|
|
87
96
|
projects,
|
|
88
97
|
};
|