@nx/eslint 19.4.0-canary.20240621-472459d → 19.4.0-canary.20240622-963f753

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.20240621-472459d",
3
+ "version": "19.4.0-canary.20240622-963f753",
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.20240621-472459d",
39
- "@nx/js": "19.4.0-canary.20240621-472459d",
38
+ "@nx/devkit": "19.4.0-canary.20240622-963f753",
39
+ "@nx/js": "19.4.0-canary.20240622-963f753",
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.20240621-472459d"
43
+ "@nx/linter": "19.4.0-canary.20240622-963f753"
44
44
  },
45
45
  "peerDependenciesMeta": {
46
46
  "@zkochan/js-yaml": {
@@ -6,6 +6,7 @@ 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
12
  const migratedProjectsModern = await (0, executor_to_plugin_migrator_1.migrateExecutorToPlugin)(tree, projectGraph, '@nx/eslint:lint', '@nx/eslint/plugin', (targetName) => ({ targetName }), postTargetTransformer, plugin_1.createNodesV2, options.project);
@@ -19,7 +20,7 @@ async function convertToInferred(tree, options) {
19
20
  }
20
21
  }
21
22
  exports.convertToInferred = convertToInferred;
22
- function postTargetTransformer(target, tree, projectDetails) {
23
+ function postTargetTransformer(target, tree, projectDetails, inferredTargetConfiguration) {
23
24
  if (target.inputs) {
24
25
  const inputs = target.inputs.filter((input) => typeof input === 'string' &&
25
26
  ![
@@ -33,48 +34,75 @@ function postTargetTransformer(target, tree, projectDetails) {
33
34
  }
34
35
  }
35
36
  if (target.options) {
36
- if ('eslintConfig' in target.options) {
37
- delete target.options.eslintConfig;
38
- }
39
- if ('force' in target.options) {
40
- delete target.options.force;
41
- }
42
- if ('silent' in target.options) {
43
- delete target.options.silent;
44
- }
45
- if ('hasTypeAwareRules' in target.options) {
46
- delete target.options.hasTypeAwareRules;
37
+ handlePropertiesInOptions(target.options, projectDetails, target);
38
+ }
39
+ if (target.configurations) {
40
+ for (const configurationName in target.configurations) {
41
+ const configuration = target.configurations[configurationName];
42
+ handlePropertiesInOptions(configuration, projectDetails, target);
47
43
  }
48
- if ('errorOnUnmatchedPattern' in target.options) {
49
- if (!target.options.errorOnUnmatchedPattern) {
50
- target.options['no-error-on-unmatched-pattern'] = true;
44
+ if (Object.keys(target.configurations).length !== 0) {
45
+ for (const configuration in target.configurations) {
46
+ if (Object.keys(target.configurations[configuration]).length === 0) {
47
+ delete target.configurations[configuration];
48
+ }
49
+ }
50
+ if (Object.keys(target.configurations).length === 0) {
51
+ delete target.configurations;
51
52
  }
52
- delete target.options.errorOnUnmatchedPattern;
53
53
  }
54
- if ('outputFile' in target.options) {
55
- target.outputs ??= [];
56
- target.outputs.push(target.options.outputFile);
54
+ }
55
+ if (target.outputs) {
56
+ (0, plugin_migration_utils_1.processTargetOutputs)(target, [], inferredTargetConfiguration, {
57
+ projectName: projectDetails.projectName,
58
+ projectRoot: projectDetails.root,
59
+ });
60
+ }
61
+ return target;
62
+ }
63
+ function handlePropertiesInOptions(options, projectDetails, target) {
64
+ if ('eslintConfig' in options) {
65
+ options.config = (0, plugin_migration_utils_1.toProjectRelativePath)(options.eslintConfig, projectDetails.root);
66
+ delete options.eslintConfig;
67
+ }
68
+ if ('force' in options) {
69
+ delete options.force;
70
+ }
71
+ if ('silent' in options) {
72
+ delete options.silent;
73
+ }
74
+ if ('hasTypeAwareRules' in options) {
75
+ delete options.hasTypeAwareRules;
76
+ }
77
+ if ('errorOnUnmatchedPattern' in options) {
78
+ if (!options.errorOnUnmatchedPattern) {
79
+ options['no-error-on-unmatched-pattern'] = true;
57
80
  }
58
- for (const key in target_options_map_1.targetOptionsToCliMap) {
59
- if (target.options[key]) {
60
- target.options[target_options_map_1.targetOptionsToCliMap[key]] = target.options[key];
61
- delete target.options[key];
62
- }
81
+ delete options.errorOnUnmatchedPattern;
82
+ }
83
+ if ('outputFile' in options) {
84
+ target.outputs ??= [];
85
+ target.outputs.push(options.outputFile);
86
+ }
87
+ for (const key in target_options_map_1.targetOptionsToCliMap) {
88
+ if (options[key]) {
89
+ const prevValue = options[key];
90
+ delete options[key];
91
+ options[target_options_map_1.targetOptionsToCliMap[key]] = prevValue;
63
92
  }
64
- if ('lintFilePatterns' in target.options) {
65
- const normalizedLintFilePatterns = target.options.lintFilePatterns.map((pattern) => {
66
- return (0, utils_1.interpolate)(pattern, {
67
- workspaceRoot: '',
68
- projectRoot: projectDetails.root,
69
- projectName: projectDetails.projectName,
70
- });
93
+ }
94
+ if ('lintFilePatterns' in options) {
95
+ const normalizedLintFilePatterns = options.lintFilePatterns.map((pattern) => {
96
+ return (0, utils_1.interpolate)(pattern, {
97
+ workspaceRoot: '',
98
+ projectRoot: projectDetails.root,
99
+ projectName: projectDetails.projectName,
71
100
  });
72
- target.options.args = normalizedLintFilePatterns.map((pattern) => pattern.startsWith(projectDetails.root)
73
- ? pattern.replace(new RegExp(`^${projectDetails.root}/`), './')
74
- : pattern);
75
- delete target.options.lintFilePatterns;
76
- }
101
+ });
102
+ options.args = normalizedLintFilePatterns.map((pattern) => pattern.startsWith(projectDetails.root)
103
+ ? pattern.replace(new RegExp(`^${projectDetails.root}/`), './')
104
+ : pattern);
105
+ delete options.lintFilePatterns;
77
106
  }
78
- return target;
79
107
  }
80
108
  exports.default = convertToInferred;