@nx/eslint 19.4.0-canary.20240621-472459d → 19.4.0-canary.20240626-3a2e8d4
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.4.0-canary.
|
3
|
+
"version": "19.4.0-canary.20240626-3a2e8d4",
|
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,12 +35,12 @@
|
|
35
35
|
"eslint": "^8.0.0 || ^9.0.0"
|
36
36
|
},
|
37
37
|
"dependencies": {
|
38
|
-
"@nx/devkit": "19.4.0-canary.
|
39
|
-
"@nx/js": "19.4.0-canary.
|
38
|
+
"@nx/devkit": "19.4.0-canary.20240626-3a2e8d4",
|
39
|
+
"@nx/js": "19.4.0-canary.20240626-3a2e8d4",
|
40
40
|
"semver": "^7.5.3",
|
41
41
|
"tslib": "^2.3.0",
|
42
42
|
"typescript": "~5.4.2",
|
43
|
-
"@nx/linter": "19.4.0-canary.
|
43
|
+
"@nx/linter": "19.4.0-canary.20240626-3a2e8d4"
|
44
44
|
},
|
45
45
|
"peerDependenciesMeta": {
|
46
46
|
"@zkochan/js-yaml": {
|
@@ -6,12 +6,17 @@ const plugin_1 = require("../../plugins/plugin");
|
|
6
6
|
const executor_to_plugin_migrator_1 = require("@nx/devkit/src/generators/plugin-migrations/executor-to-plugin-migrator");
|
7
7
|
const target_options_map_1 = require("./lib/target-options-map");
|
8
8
|
const utils_1 = require("nx/src/tasks-runner/utils");
|
9
|
+
const plugin_migration_utils_1 = require("@nx/devkit/src/generators/plugin-migrations/plugin-migration-utils");
|
9
10
|
async function convertToInferred(tree, options) {
|
10
11
|
const projectGraph = await (0, devkit_1.createProjectGraphAsync)();
|
11
|
-
const
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
const migratedProjects = await (0, executor_to_plugin_migrator_1.migrateProjectExecutorsToPlugin)(tree, projectGraph, '@nx/eslint/plugin', plugin_1.createNodesV2, { targetName: 'lint' }, [
|
13
|
+
{
|
14
|
+
executors: ['@nx/eslint:lint', '@nrwl/linter:eslint'],
|
15
|
+
postTargetTransformer,
|
16
|
+
targetPluginOptionMapper: (targetName) => ({ targetName }),
|
17
|
+
},
|
18
|
+
], options.project);
|
19
|
+
if (migratedProjects.size === 0) {
|
15
20
|
throw new Error('Could not find any targets to migrate.');
|
16
21
|
}
|
17
22
|
if (!options.skipFormat) {
|
@@ -19,7 +24,7 @@ async function convertToInferred(tree, options) {
|
|
19
24
|
}
|
20
25
|
}
|
21
26
|
exports.convertToInferred = convertToInferred;
|
22
|
-
function postTargetTransformer(target, tree, projectDetails) {
|
27
|
+
function postTargetTransformer(target, tree, projectDetails, inferredTargetConfiguration) {
|
23
28
|
if (target.inputs) {
|
24
29
|
const inputs = target.inputs.filter((input) => typeof input === 'string' &&
|
25
30
|
![
|
@@ -33,48 +38,75 @@ function postTargetTransformer(target, tree, projectDetails) {
|
|
33
38
|
}
|
34
39
|
}
|
35
40
|
if (target.options) {
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
if ('silent' in target.options) {
|
43
|
-
delete target.options.silent;
|
44
|
-
}
|
45
|
-
if ('hasTypeAwareRules' in target.options) {
|
46
|
-
delete target.options.hasTypeAwareRules;
|
41
|
+
handlePropertiesInOptions(target.options, projectDetails, target);
|
42
|
+
}
|
43
|
+
if (target.configurations) {
|
44
|
+
for (const configurationName in target.configurations) {
|
45
|
+
const configuration = target.configurations[configurationName];
|
46
|
+
handlePropertiesInOptions(configuration, projectDetails, target);
|
47
47
|
}
|
48
|
-
if (
|
49
|
-
|
50
|
-
target.
|
48
|
+
if (Object.keys(target.configurations).length !== 0) {
|
49
|
+
for (const configuration in target.configurations) {
|
50
|
+
if (Object.keys(target.configurations[configuration]).length === 0) {
|
51
|
+
delete target.configurations[configuration];
|
52
|
+
}
|
53
|
+
}
|
54
|
+
if (Object.keys(target.configurations).length === 0) {
|
55
|
+
delete target.configurations;
|
51
56
|
}
|
52
|
-
delete target.options.errorOnUnmatchedPattern;
|
53
57
|
}
|
54
|
-
|
55
|
-
|
56
|
-
|
58
|
+
}
|
59
|
+
if (target.outputs) {
|
60
|
+
(0, plugin_migration_utils_1.processTargetOutputs)(target, [], inferredTargetConfiguration, {
|
61
|
+
projectName: projectDetails.projectName,
|
62
|
+
projectRoot: projectDetails.root,
|
63
|
+
});
|
64
|
+
}
|
65
|
+
return target;
|
66
|
+
}
|
67
|
+
function handlePropertiesInOptions(options, projectDetails, target) {
|
68
|
+
if ('eslintConfig' in options) {
|
69
|
+
options.config = (0, plugin_migration_utils_1.toProjectRelativePath)(options.eslintConfig, projectDetails.root);
|
70
|
+
delete options.eslintConfig;
|
71
|
+
}
|
72
|
+
if ('force' in options) {
|
73
|
+
delete options.force;
|
74
|
+
}
|
75
|
+
if ('silent' in options) {
|
76
|
+
delete options.silent;
|
77
|
+
}
|
78
|
+
if ('hasTypeAwareRules' in options) {
|
79
|
+
delete options.hasTypeAwareRules;
|
80
|
+
}
|
81
|
+
if ('errorOnUnmatchedPattern' in options) {
|
82
|
+
if (!options.errorOnUnmatchedPattern) {
|
83
|
+
options['no-error-on-unmatched-pattern'] = true;
|
57
84
|
}
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
85
|
+
delete options.errorOnUnmatchedPattern;
|
86
|
+
}
|
87
|
+
if ('outputFile' in options) {
|
88
|
+
target.outputs ??= [];
|
89
|
+
target.outputs.push(options.outputFile);
|
90
|
+
}
|
91
|
+
for (const key in target_options_map_1.targetOptionsToCliMap) {
|
92
|
+
if (options[key]) {
|
93
|
+
const prevValue = options[key];
|
94
|
+
delete options[key];
|
95
|
+
options[target_options_map_1.targetOptionsToCliMap[key]] = prevValue;
|
63
96
|
}
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
97
|
+
}
|
98
|
+
if ('lintFilePatterns' in options) {
|
99
|
+
const normalizedLintFilePatterns = options.lintFilePatterns.map((pattern) => {
|
100
|
+
return (0, utils_1.interpolate)(pattern, {
|
101
|
+
workspaceRoot: '',
|
102
|
+
projectRoot: projectDetails.root,
|
103
|
+
projectName: projectDetails.projectName,
|
71
104
|
});
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
105
|
+
});
|
106
|
+
options.args = normalizedLintFilePatterns.map((pattern) => pattern.startsWith(projectDetails.root)
|
107
|
+
? pattern.replace(new RegExp(`^${projectDetails.root}/`), './')
|
108
|
+
: pattern);
|
109
|
+
delete options.lintFilePatterns;
|
77
110
|
}
|
78
|
-
return target;
|
79
111
|
}
|
80
112
|
exports.default = convertToInferred;
|