@nx/eslint 19.1.0-canary.20240511-f7dcf43 → 19.1.0-canary.20240515-a2a7d7e
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.1.0-canary.
|
3
|
+
"version": "19.1.0-canary.20240515-a2a7d7e",
|
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.1.0-canary.
|
37
|
-
"@nx/js": "19.1.0-canary.
|
36
|
+
"@nx/devkit": "19.1.0-canary.20240515-a2a7d7e",
|
37
|
+
"@nx/js": "19.1.0-canary.20240515-a2a7d7e",
|
38
38
|
"eslint": "^8.0.0",
|
39
39
|
"tslib": "^2.3.0",
|
40
40
|
"typescript": "~5.4.2",
|
41
|
-
"@nx/linter": "19.1.0-canary.
|
41
|
+
"@nx/linter": "19.1.0-canary.20240515-a2a7d7e"
|
42
42
|
},
|
43
43
|
"peerDependenciesMeta": {
|
44
44
|
"js-yaml": {
|
@@ -73,7 +73,8 @@ async function lintProjectGeneratorInternal(tree, options) {
|
|
73
73
|
if (!options.rootProject) {
|
74
74
|
const projects = {};
|
75
75
|
(0, project_configuration_1.getProjects)(tree).forEach((v, k) => (projects[k] = v));
|
76
|
-
|
76
|
+
const graph = await (0, devkit_1.createProjectGraphAsync)();
|
77
|
+
if (isMigrationToMonorepoNeeded(tree, graph)) {
|
77
78
|
// we only migrate project configurations that have been created
|
78
79
|
const filteredProjects = [];
|
79
80
|
Object.entries(projects).forEach(([name, project]) => {
|
@@ -198,30 +199,24 @@ function isBuildableLibraryProject(projectConfig) {
|
|
198
199
|
* Detect based on the state of lint target configuration of the root project
|
199
200
|
* if we should migrate eslint configs to monorepo style
|
200
201
|
*/
|
201
|
-
function isMigrationToMonorepoNeeded(
|
202
|
+
function isMigrationToMonorepoNeeded(tree, graph) {
|
202
203
|
// the base config is already created, migration has been done
|
203
204
|
if (tree.exists(config_file_1.baseEsLintConfigFile) ||
|
204
205
|
tree.exists(config_file_1.baseEsLintFlatConfigFile)) {
|
205
206
|
return false;
|
206
207
|
}
|
207
|
-
const
|
208
|
-
if (configs.length === 1) {
|
209
|
-
return false;
|
210
|
-
}
|
208
|
+
const nodes = Object.values(graph.nodes);
|
211
209
|
// get root project
|
212
|
-
const rootProject =
|
213
|
-
if (!rootProject || !rootProject.targets) {
|
210
|
+
const rootProject = nodes.find((p) => p.data.root === '.');
|
211
|
+
if (!rootProject || !rootProject.data.targets) {
|
214
212
|
return false;
|
215
213
|
}
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
}
|
214
|
+
for (const targetConfig of Object.values(rootProject.data.targets ?? {})) {
|
215
|
+
if (['@nx/eslint:lint', '@nrwl/linter:eslint', '@nx/linter:eslint'].includes(targetConfig.executor) ||
|
216
|
+
(targetConfig.executor === 'nx:run-commands' &&
|
217
|
+
targetConfig.options?.command.startsWith('eslint '))) {
|
218
|
+
return true;
|
222
219
|
}
|
223
220
|
}
|
224
|
-
|
225
|
-
const lintTarget = (0, init_migration_1.findLintTarget)(rootProject);
|
226
|
-
return !!lintTarget;
|
221
|
+
return false;
|
227
222
|
}
|
@@ -510,7 +510,7 @@ function generateFlatOverride(override) {
|
|
510
510
|
!override.parser) {
|
511
511
|
if (override.parserOptions) {
|
512
512
|
const { parserOptions, ...rest } = override;
|
513
|
-
return generateAst({ ...rest,
|
513
|
+
return generateAst({ ...rest, languageOptions: { parserOptions } });
|
514
514
|
}
|
515
515
|
return generateAst(override);
|
516
516
|
}
|
@@ -531,7 +531,7 @@ function generateFlatOverride(override) {
|
|
531
531
|
];
|
532
532
|
objectLiteralElements.push(ts.factory.createPropertyAssignment('rules', ts.factory.createObjectLiteralExpression(updatedRulesProperties, true)));
|
533
533
|
if (parserOptions) {
|
534
|
-
addTSObjectProperty(objectLiteralElements, '
|
534
|
+
addTSObjectProperty(objectLiteralElements, 'languageOptions', {
|
535
535
|
parserOptions,
|
536
536
|
});
|
537
537
|
}
|