@nx/eslint 0.0.0-pr-26898-0693e21 → 0.0.0-pr-26956-dfcbe5b

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.
Files changed (34) hide show
  1. package/README.md +1 -1
  2. package/migrations.json +14 -0
  3. package/package.json +4 -4
  4. package/src/executors/lint/hasher.d.ts +0 -1
  5. package/src/executors/lint/hasher.js +1 -1
  6. package/src/executors/lint/lint.impl.js +1 -1
  7. package/src/executors/lint/utility/eslint-utils.js +1 -2
  8. package/src/generators/convert-to-flat-config/converters/json-converter.js +1 -2
  9. package/src/generators/convert-to-flat-config/generator.js +1 -2
  10. package/src/generators/convert-to-inferred/convert-to-inferred.js +1 -2
  11. package/src/generators/init/init-migration.js +2 -3
  12. package/src/generators/init/init.js +2 -3
  13. package/src/generators/lint-project/lint-project.js +2 -3
  14. package/src/generators/lint-project/setup-root-eslint.js +1 -2
  15. package/src/generators/utils/eslint-file.js +11 -12
  16. package/src/generators/utils/eslint-targets.js +1 -2
  17. package/src/generators/utils/flat-config/ast-utils.js +17 -18
  18. package/src/generators/utils/flat-config/path-utils.js +2 -3
  19. package/src/generators/utils/plugin.js +1 -2
  20. package/src/generators/workspace-rule/workspace-rule.js +1 -2
  21. package/src/generators/workspace-rules-project/workspace-rules-project.js +2 -2
  22. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +1 -1
  23. package/src/migrations/update-16-8-0-add-ignored-files/update-16-8-0-add-ignored-files.js +1 -1
  24. package/src/migrations/update-17-0-0-rename-to-eslint/update-17-0-0-rename-to-eslint.js +1 -1
  25. package/src/migrations/update-17-1-0/update-typescript-eslint.js +1 -1
  26. package/src/migrations/update-17-2-0/simplify-eslint-patterns.js +1 -1
  27. package/src/migrations/update-17-2-9/move-options-to-target-defaults.js +1 -1
  28. package/src/plugins/plugin.js +32 -32
  29. package/src/utils/config-file.js +4 -4
  30. package/src/utils/flat-config.js +3 -3
  31. package/src/utils/resolve-eslint-class.js +1 -2
  32. package/src/utils/rules-requiring-type-checking.js +2 -3
  33. package/src/utils/versions.d.ts +1 -1
  34. package/src/utils/versions.js +1 -1
package/README.md CHANGED
@@ -59,7 +59,7 @@ npx nx@latest init
59
59
  - [Nx.Dev: Documentation, Guides, Tutorials](https://nx.dev)
60
60
  - [Intro to Nx](https://nx.dev/getting-started/intro)
61
61
  - [Official Nx YouTube Channel](https://www.youtube.com/@NxDevtools)
62
- - [Blog Posts About Nx](https://blog.nrwl.io/nx/home)
62
+ - [Blog Posts About Nx](https://nx.dev/blog)
63
63
 
64
64
  <p style="text-align: center;"><a href="https://nx.dev/#learning-materials" target="_blank" rel="noreferrer"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-courses-and-videos.svg"
65
65
  width="100%" alt="Nx - Smart Monorepos · Fast CI"></a></p>
package/migrations.json CHANGED
@@ -138,6 +138,20 @@
138
138
  "version": "~8.57.0"
139
139
  }
140
140
  }
141
+ },
142
+ "19.5.0": {
143
+ "version": "19.5.0-beta.1",
144
+ "packages": {
145
+ "@typescript-eslint/parser": {
146
+ "version": "^7.16.0"
147
+ },
148
+ "@typescript-eslint/eslint-plugin": {
149
+ "version": "^7.16.0"
150
+ },
151
+ "@typescript-eslint/utils": {
152
+ "version": "^7.16.0"
153
+ }
154
+ }
141
155
  }
142
156
  }
143
157
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/eslint",
3
- "version": "0.0.0-pr-26898-0693e21",
3
+ "version": "0.0.0-pr-26956-dfcbe5b",
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": "0.0.0-pr-26898-0693e21",
39
- "@nx/js": "0.0.0-pr-26898-0693e21",
38
+ "@nx/devkit": "0.0.0-pr-26956-dfcbe5b",
39
+ "@nx/js": "0.0.0-pr-26956-dfcbe5b",
40
40
  "semver": "^7.5.3",
41
41
  "tslib": "^2.3.0",
42
42
  "typescript": "~5.4.2",
43
- "@nx/linter": "0.0.0-pr-26898-0693e21"
43
+ "@nx/linter": "0.0.0-pr-26956-dfcbe5b"
44
44
  },
45
45
  "peerDependenciesMeta": {
46
46
  "@zkochan/js-yaml": {
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { Hash, ProjectGraph, ProjectsConfigurations, Task, TaskGraph, TaskHasher } from '@nx/devkit';
3
2
  export default function run(task: Task, context: {
4
3
  hasher: TaskHasher;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = run;
3
4
  const devkit_1 = require("@nx/devkit");
4
5
  async function run(task, context) {
5
6
  const res = await context.hasher.hashTask(task, context.taskGraph, context.env);
@@ -31,7 +32,6 @@ async function run(task, context) {
31
32
  },
32
33
  };
33
34
  }
34
- exports.default = run;
35
35
  function allDeps(taskId, taskGraph, projectGraph) {
36
36
  if (!taskGraph.tasks) {
37
37
  return [];
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = run;
3
4
  const devkit_1 = require("@nx/devkit");
4
5
  const fs_1 = require("fs");
5
6
  const utils_1 = require("nx/src/tasks-runner/utils");
@@ -143,7 +144,6 @@ Please see https://nx.dev/recipes/tips-n-tricks/eslint for full guidance on how
143
144
  totals.warnings <= normalizedOptions.maxWarnings)),
144
145
  };
145
146
  }
146
- exports.default = run;
147
147
  function getTotals(lintResults) {
148
148
  let errors = 0;
149
149
  let warnings = 0;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resolveAndInstantiateESLint = void 0;
3
+ exports.resolveAndInstantiateESLint = resolveAndInstantiateESLint;
4
4
  const config_file_1 = require("../../../utils/config-file");
5
5
  const resolve_eslint_class_1 = require("../../../utils/resolve-eslint-class");
6
6
  async function resolveAndInstantiateESLint(eslintConfigPath, options, useFlatConfig = false) {
@@ -61,4 +61,3 @@ async function resolveAndInstantiateESLint(eslintConfigPath, options, useFlatCon
61
61
  eslint,
62
62
  };
63
63
  }
64
- exports.resolveAndInstantiateESLint = resolveAndInstantiateESLint;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.convertEslintJsonToFlatConfig = void 0;
3
+ exports.convertEslintJsonToFlatConfig = convertEslintJsonToFlatConfig;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const ts = require("typescript");
6
6
  const ast_utils_1 = require("../../utils/flat-config/ast-utils");
@@ -103,7 +103,6 @@ function convertEslintJsonToFlatConfig(tree, root, config, ignorePaths) {
103
103
  addESLintJS: isESLintJSNeeded,
104
104
  };
105
105
  }
106
- exports.convertEslintJsonToFlatConfig = convertEslintJsonToFlatConfig;
107
106
  // add parsed extends to export blocks and add import statements
108
107
  function addExtends(importsMap, configBlocks, config) {
109
108
  let isFlatCompatNeeded = false;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.convertToFlatConfigGenerator = void 0;
3
+ exports.convertToFlatConfigGenerator = convertToFlatConfigGenerator;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const eslint_file_1 = require("../utils/eslint-file");
6
6
  const path_1 = require("path");
@@ -37,7 +37,6 @@ async function convertToFlatConfigGenerator(tree, options) {
37
37
  return () => (0, devkit_1.installPackagesTask)(tree);
38
38
  }
39
39
  }
40
- exports.convertToFlatConfigGenerator = convertToFlatConfigGenerator;
41
40
  exports.default = convertToFlatConfigGenerator;
42
41
  function convertRootToFlatConfig(tree, eslintFile) {
43
42
  if (/\.base\.(js|json|yml|yaml)$/.test(eslintFile)) {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.convertToInferred = void 0;
3
+ exports.convertToInferred = convertToInferred;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  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");
@@ -23,7 +23,6 @@ async function convertToInferred(tree, options) {
23
23
  await (0, devkit_1.formatFiles)(tree);
24
24
  }
25
25
  }
26
- exports.convertToInferred = convertToInferred;
27
26
  function postTargetTransformer(target, tree, projectDetails, inferredTargetConfiguration) {
28
27
  if (target.inputs) {
29
28
  const inputs = target.inputs.filter((input) => typeof input === 'string' &&
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.findLintTarget = exports.migrateConfigToMonorepoStyle = void 0;
3
+ exports.migrateConfigToMonorepoStyle = migrateConfigToMonorepoStyle;
4
+ exports.findLintTarget = findLintTarget;
4
5
  const devkit_1 = require("@nx/devkit");
5
6
  const path_1 = require("path");
6
7
  const eslint_file_1 = require("../utils/eslint-file");
@@ -68,13 +69,11 @@ function migrateConfigToMonorepoStyle(projects, tree, unitTestRunner, keepExisti
68
69
  '@nx/eslint-plugin': versions_1.nxVersion,
69
70
  });
70
71
  }
71
- exports.migrateConfigToMonorepoStyle = migrateConfigToMonorepoStyle;
72
72
  function findLintTarget(project) {
73
73
  return Object.values(project.targets ?? {}).find((target) => target.executor === '@nx/eslint:lint' ||
74
74
  target.executor === '@nx/linter:eslint' ||
75
75
  target.executor === '@nrwl/linter:eslint');
76
76
  }
77
- exports.findLintTarget = findLintTarget;
78
77
  function migrateEslintFile(projectEslintPath, tree) {
79
78
  const baseFile = (0, eslint_file_1.findEslintFile)(tree);
80
79
  if ((0, eslint_file_1.isEslintConfigSupported)(tree)) {
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.lintInitGenerator = exports.initEsLint = void 0;
3
+ exports.initEsLint = initEsLint;
4
+ exports.lintInitGenerator = lintInitGenerator;
4
5
  const devkit_1 = require("@nx/devkit");
5
6
  const add_plugin_1 = require("@nx/devkit/src/utils/add-plugin");
6
7
  const versions_1 = require("../../utils/versions");
@@ -75,8 +76,6 @@ async function initEsLint(tree, options) {
75
76
  }
76
77
  return (0, devkit_1.runTasksInSerial)(...tasks);
77
78
  }
78
- exports.initEsLint = initEsLint;
79
79
  async function lintInitGenerator(tree, options) {
80
80
  return await initEsLint(tree, { addPlugin: false, ...options });
81
81
  }
82
- exports.lintInitGenerator = lintInitGenerator;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.lintProjectGeneratorInternal = exports.lintProjectGenerator = void 0;
3
+ exports.lintProjectGenerator = lintProjectGenerator;
4
+ exports.lintProjectGeneratorInternal = lintProjectGeneratorInternal;
4
5
  const devkit_1 = require("@nx/devkit");
5
6
  const eslint_file_1 = require("../utils/eslint-file");
6
7
  const path_1 = require("path");
@@ -15,7 +16,6 @@ const setup_root_eslint_1 = require("./setup-root-eslint");
15
16
  function lintProjectGenerator(tree, options) {
16
17
  return lintProjectGeneratorInternal(tree, { addPlugin: false, ...options });
17
18
  }
18
- exports.lintProjectGenerator = lintProjectGenerator;
19
19
  async function lintProjectGeneratorInternal(tree, options) {
20
20
  const nxJson = (0, devkit_1.readNxJson)(tree);
21
21
  const addPluginDefault = process.env.NX_ADD_PLUGINS !== 'false' &&
@@ -108,7 +108,6 @@ async function lintProjectGeneratorInternal(tree, options) {
108
108
  }
109
109
  return (0, devkit_1.runTasksInSerial)(...tasks);
110
110
  }
111
- exports.lintProjectGeneratorInternal = lintProjectGeneratorInternal;
112
111
  function createEsLintConfiguration(tree, options, projectConfig, setParserOptionsProject, rootProject) {
113
112
  // we are only extending root for non-standalone projects or their complementary e2e apps
114
113
  const extendedRootConfig = rootProject ? undefined : (0, eslint_file_1.findEslintFile)(tree);
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setupRootEsLint = void 0;
3
+ exports.setupRootEsLint = setupRootEsLint;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const versions_1 = require("../../utils/versions");
6
6
  const global_eslint_config_1 = require("../init/global-eslint-config");
@@ -30,4 +30,3 @@ function setupRootEsLint(tree, options) {
30
30
  })
31
31
  : () => { };
32
32
  }
33
- exports.setupRootEsLint = setupRootEsLint;
@@ -1,6 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getPluginImport = exports.addIgnoresToLintConfig = exports.addPluginsToLintConfig = exports.addExtendsToLintConfig = exports.replaceOverridesInLintConfig = exports.lintConfigHasOverride = exports.updateOverrideInLintConfig = exports.addOverrideToLintConfig = exports.updateRelativePathsInConfig = exports.isEslintConfigSupported = exports.findEslintFile = void 0;
3
+ exports.findEslintFile = findEslintFile;
4
+ exports.isEslintConfigSupported = isEslintConfigSupported;
5
+ exports.updateRelativePathsInConfig = updateRelativePathsInConfig;
6
+ exports.addOverrideToLintConfig = addOverrideToLintConfig;
7
+ exports.updateOverrideInLintConfig = updateOverrideInLintConfig;
8
+ exports.lintConfigHasOverride = lintConfigHasOverride;
9
+ exports.replaceOverridesInLintConfig = replaceOverridesInLintConfig;
10
+ exports.addExtendsToLintConfig = addExtendsToLintConfig;
11
+ exports.addPluginsToLintConfig = addPluginsToLintConfig;
12
+ exports.addIgnoresToLintConfig = addIgnoresToLintConfig;
13
+ exports.getPluginImport = getPluginImport;
4
14
  const devkit_1 = require("@nx/devkit");
5
15
  const flat_config_1 = require("../../utils/flat-config");
6
16
  const ast_utils_1 = require("./flat-config/ast-utils");
@@ -21,7 +31,6 @@ function findEslintFile(tree, projectRoot) {
21
31
  }
22
32
  return null;
23
33
  }
24
- exports.findEslintFile = findEslintFile;
25
34
  function isEslintConfigSupported(tree, projectRoot = '') {
26
35
  const eslintFile = findEslintFile(tree, projectRoot);
27
36
  if (!eslintFile) {
@@ -29,7 +38,6 @@ function isEslintConfigSupported(tree, projectRoot = '') {
29
38
  }
30
39
  return eslintFile.endsWith('.json') || eslintFile.endsWith('.config.js');
31
40
  }
32
- exports.isEslintConfigSupported = isEslintConfigSupported;
33
41
  function updateRelativePathsInConfig(tree, sourcePath, destinationPath) {
34
42
  if (sourcePath === destinationPath ||
35
43
  !isEslintConfigSupported(tree, destinationPath)) {
@@ -60,7 +68,6 @@ function updateRelativePathsInConfig(tree, sourcePath, destinationPath) {
60
68
  });
61
69
  }
62
70
  }
63
- exports.updateRelativePathsInConfig = updateRelativePathsInConfig;
64
71
  function replaceFlatConfigPaths(config, sourceRoot, offset, destinationRoot, tree) {
65
72
  let match;
66
73
  let newConfig = config;
@@ -126,7 +133,6 @@ function addOverrideToLintConfig(tree, root, override, options = {
126
133
  });
127
134
  }
128
135
  }
129
- exports.addOverrideToLintConfig = addOverrideToLintConfig;
130
136
  function overrideNeedsCompat(override) {
131
137
  return (override.env || override.extends || override.plugins || override.parser);
132
138
  }
@@ -161,7 +167,6 @@ function updateOverrideInLintConfig(tree, root, lookup, update) {
161
167
  });
162
168
  }
163
169
  }
164
- exports.updateOverrideInLintConfig = updateOverrideInLintConfig;
165
170
  function lintConfigHasOverride(tree, root, lookup, checkBaseConfig = false) {
166
171
  if (!isEslintConfigSupported(tree, root)) {
167
172
  return false;
@@ -177,7 +182,6 @@ function lintConfigHasOverride(tree, root, lookup, checkBaseConfig = false) {
177
182
  return (0, devkit_1.readJson)(tree, fileName).overrides?.some(lookup) || false;
178
183
  }
179
184
  }
180
- exports.lintConfigHasOverride = lintConfigHasOverride;
181
185
  function replaceOverridesInLintConfig(tree, root, overrides) {
182
186
  if ((0, flat_config_1.useFlatConfig)(tree)) {
183
187
  const fileName = (0, devkit_1.joinPathFragments)(root, (0, flat_config_1.flatConfigEslintFilename)(tree));
@@ -201,7 +205,6 @@ function replaceOverridesInLintConfig(tree, root, overrides) {
201
205
  });
202
206
  }
203
207
  }
204
- exports.replaceOverridesInLintConfig = replaceOverridesInLintConfig;
205
208
  function addExtendsToLintConfig(tree, root, plugin) {
206
209
  const plugins = Array.isArray(plugin) ? plugin : [plugin];
207
210
  if ((0, flat_config_1.useFlatConfig)(tree)) {
@@ -225,7 +228,6 @@ function addExtendsToLintConfig(tree, root, plugin) {
225
228
  });
226
229
  }
227
230
  }
228
- exports.addExtendsToLintConfig = addExtendsToLintConfig;
229
231
  function addPluginsToLintConfig(tree, root, plugin) {
230
232
  const plugins = Array.isArray(plugin) ? plugin : [plugin];
231
233
  if ((0, flat_config_1.useFlatConfig)(tree)) {
@@ -251,7 +253,6 @@ function addPluginsToLintConfig(tree, root, plugin) {
251
253
  });
252
254
  }
253
255
  }
254
- exports.addPluginsToLintConfig = addPluginsToLintConfig;
255
256
  function addIgnoresToLintConfig(tree, root, ignorePatterns) {
256
257
  if ((0, flat_config_1.useFlatConfig)(tree)) {
257
258
  const fileName = (0, devkit_1.joinPathFragments)(root, (0, flat_config_1.flatConfigEslintFilename)(tree));
@@ -272,7 +273,6 @@ function addIgnoresToLintConfig(tree, root, ignorePatterns) {
272
273
  });
273
274
  }
274
275
  }
275
- exports.addIgnoresToLintConfig = addIgnoresToLintConfig;
276
276
  function getPluginImport(pluginName) {
277
277
  if (pluginName.includes('eslint-plugin-')) {
278
278
  return pluginName;
@@ -286,4 +286,3 @@ function getPluginImport(pluginName) {
286
286
  const [scope, name] = pluginName.split('/');
287
287
  return `${scope}/eslint-plugin-${name}`;
288
288
  }
289
- exports.getPluginImport = getPluginImport;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getEslintTargets = void 0;
3
+ exports.getEslintTargets = getEslintTargets;
4
4
  const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
5
5
  function getEslintTargets(tree) {
6
6
  const eslintTargetNames = new Set();
@@ -15,4 +15,3 @@ function getEslintTargets(tree) {
15
15
  });
16
16
  return eslintTargetNames;
17
17
  }
18
- exports.getEslintTargets = getEslintTargets;
@@ -1,6 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generateAst = exports.mapFilePaths = exports.generateFlatOverride = exports.generateRequire = exports.stringifyNodeList = exports.generatePluginExtendsElement = exports.generateSpreadElement = exports.createNodeList = exports.addCompatToFlatConfig = exports.addPluginsToExportsBlock = exports.removeCompatExtends = exports.removePlugin = exports.addBlockToFlatConfigExport = exports.addImportToFlatConfig = exports.replaceOverride = exports.hasOverride = exports.removeOverridesFromLintConfig = void 0;
3
+ exports.removeOverridesFromLintConfig = removeOverridesFromLintConfig;
4
+ exports.hasOverride = hasOverride;
5
+ exports.replaceOverride = replaceOverride;
6
+ exports.addImportToFlatConfig = addImportToFlatConfig;
7
+ exports.addBlockToFlatConfigExport = addBlockToFlatConfigExport;
8
+ exports.removePlugin = removePlugin;
9
+ exports.removeCompatExtends = removeCompatExtends;
10
+ exports.addPluginsToExportsBlock = addPluginsToExportsBlock;
11
+ exports.addCompatToFlatConfig = addCompatToFlatConfig;
12
+ exports.createNodeList = createNodeList;
13
+ exports.generateSpreadElement = generateSpreadElement;
14
+ exports.generatePluginExtendsElement = generatePluginExtendsElement;
15
+ exports.stringifyNodeList = stringifyNodeList;
16
+ exports.generateRequire = generateRequire;
17
+ exports.generateFlatOverride = generateFlatOverride;
18
+ exports.mapFilePaths = mapFilePaths;
19
+ exports.generateAst = generateAst;
4
20
  const devkit_1 = require("@nx/devkit");
5
21
  const ts = require("typescript");
6
22
  const path_utils_1 = require("./path-utils");
@@ -31,7 +47,6 @@ function removeOverridesFromLintConfig(content) {
31
47
  });
32
48
  return (0, devkit_1.applyChangesToString)(content, changes);
33
49
  }
34
- exports.removeOverridesFromLintConfig = removeOverridesFromLintConfig;
35
50
  function findAllBlocks(source) {
36
51
  return ts.forEachChild(source, function analyze(node) {
37
52
  if (ts.isExpressionStatement(node) &&
@@ -82,7 +97,6 @@ function hasOverride(content, lookup) {
82
97
  }
83
98
  return false;
84
99
  }
85
- exports.hasOverride = hasOverride;
86
100
  function parseTextToJson(text) {
87
101
  return (0, devkit_1.parseJson)(text
88
102
  // ensure property names have double quotes so that JSON.parse works
@@ -138,7 +152,6 @@ function replaceOverride(content, root, lookup, update) {
138
152
  });
139
153
  return (0, devkit_1.applyChangesToString)(content, changes);
140
154
  }
141
- exports.replaceOverride = replaceOverride;
142
155
  /**
143
156
  * Adding require statement to the top of the file
144
157
  */
@@ -213,7 +226,6 @@ function addImportToFlatConfig(content, variable, imp) {
213
226
  },
214
227
  ]);
215
228
  }
216
- exports.addImportToFlatConfig = addImportToFlatConfig;
217
229
  /**
218
230
  * Injects new ts.expression to the end of the module.exports array.
219
231
  */
@@ -254,7 +266,6 @@ function addBlockToFlatConfigExport(content, config, options = {
254
266
  ]);
255
267
  }
256
268
  }
257
- exports.addBlockToFlatConfigExport = addBlockToFlatConfigExport;
258
269
  function removePlugin(content, pluginName, pluginImport) {
259
270
  const source = ts.createSourceFile('', content, ts.ScriptTarget.Latest, true, ts.ScriptKind.JS);
260
271
  const changes = [];
@@ -365,7 +376,6 @@ function removePlugin(content, pluginName, pluginImport) {
365
376
  });
366
377
  return (0, devkit_1.applyChangesToString)(content, changes);
367
378
  }
368
- exports.removePlugin = removePlugin;
369
379
  function removeCompatExtends(content, compatExtends) {
370
380
  const source = ts.createSourceFile('', content, ts.ScriptTarget.Latest, true, ts.ScriptKind.JS);
371
381
  const changes = [];
@@ -401,7 +411,6 @@ function removeCompatExtends(content, compatExtends) {
401
411
  });
402
412
  return (0, devkit_1.applyChangesToString)(content, changes);
403
413
  }
404
- exports.removeCompatExtends = removeCompatExtends;
405
414
  /**
406
415
  * Add plugins block to the top of the export blocks
407
416
  */
@@ -415,7 +424,6 @@ function addPluginsToExportsBlock(content, plugins) {
415
424
  insertAtTheEnd: false,
416
425
  });
417
426
  }
418
- exports.addPluginsToExportsBlock = addPluginsToExportsBlock;
419
427
  /**
420
428
  * Adds compat if missing to flat config
421
429
  */
@@ -435,7 +443,6 @@ function addCompatToFlatConfig(content) {
435
443
  },
436
444
  ]);
437
445
  }
438
- exports.addCompatToFlatConfig = addCompatToFlatConfig;
439
446
  const DEFAULT_FLAT_CONFIG = `
440
447
  const compat = new FlatCompat({
441
448
  baseDirectory: __dirname,
@@ -467,15 +474,12 @@ function createNodeList(importsMap, exportElements, isFlatCompatNeeded) {
467
474
  ts.factory.createExpressionStatement(ts.factory.createBinaryExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier('module'), ts.factory.createIdentifier('exports')), ts.factory.createToken(ts.SyntaxKind.EqualsToken), ts.factory.createArrayLiteralExpression(exportElements, true))),
468
475
  ]);
469
476
  }
470
- exports.createNodeList = createNodeList;
471
477
  function generateSpreadElement(name) {
472
478
  return ts.factory.createSpreadElement(ts.factory.createIdentifier(name));
473
479
  }
474
- exports.generateSpreadElement = generateSpreadElement;
475
480
  function generatePluginExtendsElement(plugins) {
476
481
  return ts.factory.createSpreadElement(ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier('compat'), ts.factory.createIdentifier('extends')), undefined, plugins.map((plugin) => ts.factory.createStringLiteral(plugin))));
477
482
  }
478
- exports.generatePluginExtendsElement = generatePluginExtendsElement;
479
483
  /**
480
484
  * Stringifies TS nodes to file content string
481
485
  */
@@ -489,7 +493,6 @@ function stringifyNodeList(nodes) {
489
493
  // add new line before module.exports = ...
490
494
  .replace(/module\.exports/, '\nmodule.exports'));
491
495
  }
492
- exports.stringifyNodeList = stringifyNodeList;
493
496
  /**
494
497
  * generates AST require statement
495
498
  */
@@ -498,7 +501,6 @@ function generateRequire(variableName, imp) {
498
501
  ts.factory.createVariableDeclaration(variableName, undefined, undefined, ts.factory.createCallExpression(ts.factory.createIdentifier('require'), undefined, [ts.factory.createStringLiteral(imp)])),
499
502
  ], ts.NodeFlags.Const));
500
503
  }
501
- exports.generateRequire = generateRequire;
502
504
  /**
503
505
  * Generates AST object or spread element based on JSON override object
504
506
  */
@@ -541,7 +543,6 @@ function generateFlatOverride(override) {
541
543
  ], undefined, ts.factory.createToken(ts.SyntaxKind.EqualsGreaterThanToken), ts.factory.createParenthesizedExpression(ts.factory.createObjectLiteralExpression(objectLiteralElements, true))),
542
544
  ]));
543
545
  }
544
- exports.generateFlatOverride = generateFlatOverride;
545
546
  function mapFilePaths(override) {
546
547
  if (override.files) {
547
548
  override.files = Array.isArray(override.files)
@@ -556,7 +557,6 @@ function mapFilePaths(override) {
556
557
  override.excludedFiles = override.excludedFiles.map((file) => (0, path_utils_1.mapFilePath)(file));
557
558
  }
558
559
  }
559
- exports.mapFilePaths = mapFilePaths;
560
560
  function addTSObjectProperty(elements, key, value) {
561
561
  if (value) {
562
562
  elements.push(ts.factory.createPropertyAssignment(key, generateAst(value)));
@@ -591,7 +591,6 @@ function generateAst(input) {
591
591
  // since we are parsing JSON, this should never happen
592
592
  throw new Error(`Unknown type: ${typeof input} `);
593
593
  }
594
- exports.generateAst = generateAst;
595
594
  function isValidKey(key) {
596
595
  return /^[a-zA-Z0-9_]+$/.test(key);
597
596
  }
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mapFilePath = exports.updateFiles = void 0;
3
+ exports.updateFiles = updateFiles;
4
+ exports.mapFilePath = mapFilePath;
4
5
  const devkit_1 = require("@nx/devkit");
5
6
  function updateFiles(override) {
6
7
  if (override.files) {
@@ -11,7 +12,6 @@ function updateFiles(override) {
11
12
  }
12
13
  return override;
13
14
  }
14
- exports.updateFiles = updateFiles;
15
15
  function mapFilePath(filePath) {
16
16
  if (filePath.startsWith('!')) {
17
17
  const fileWithoutBang = filePath.slice(1);
@@ -25,4 +25,3 @@ function mapFilePath(filePath) {
25
25
  }
26
26
  return filePath;
27
27
  }
28
- exports.mapFilePath = mapFilePath;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.hasEslintPlugin = void 0;
3
+ exports.hasEslintPlugin = hasEslintPlugin;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  function hasEslintPlugin(tree) {
6
6
  const nxJson = (0, devkit_1.readNxJson)(tree);
@@ -8,4 +8,3 @@ function hasEslintPlugin(tree) {
8
8
  ? p === '@nx/eslint/plugin'
9
9
  : p.plugin === '@nx/eslint/plugin');
10
10
  }
11
- exports.hasEslintPlugin = hasEslintPlugin;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.lintWorkspaceRuleGenerator = void 0;
3
+ exports.lintWorkspaceRuleGenerator = lintWorkspaceRuleGenerator;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const string_utils_1 = require("@nx/devkit/src/utils/string-utils");
6
6
  const path_1 = require("path");
@@ -75,4 +75,3 @@ async function lintWorkspaceRuleGenerator(tree, options) {
75
75
  `);
76
76
  return projectGeneratorCallback;
77
77
  }
78
- exports.lintWorkspaceRuleGenerator = lintWorkspaceRuleGenerator;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.lintWorkspaceRulesProjectGenerator = exports.WORKSPACE_PLUGIN_DIR = exports.WORKSPACE_RULES_PROJECT_NAME = void 0;
3
+ exports.WORKSPACE_PLUGIN_DIR = exports.WORKSPACE_RULES_PROJECT_NAME = void 0;
4
+ exports.lintWorkspaceRulesProjectGenerator = lintWorkspaceRulesProjectGenerator;
4
5
  const devkit_1 = require("@nx/devkit");
5
6
  const js_1 = require("@nx/js");
6
7
  const add_swc_dependencies_1 = require("@nx/js/src/utils/swc/add-swc-dependencies");
@@ -79,4 +80,3 @@ async function lintWorkspaceRulesProjectGenerator(tree, options = {}) {
79
80
  }
80
81
  return (0, devkit_1.runTasksInSerial)(...tasks);
81
82
  }
82
- exports.lintWorkspaceRulesProjectGenerator = lintWorkspaceRulesProjectGenerator;
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = replacePackage;
3
4
  const devkit_1 = require("@nx/devkit");
4
5
  const replace_package_1 = require("@nx/devkit/src/utils/replace-package");
5
6
  async function replacePackage(tree) {
6
7
  await (0, replace_package_1.replaceNrwlPackageWithNxPackage)(tree, '@nrwl/linter', '@nx/linter');
7
8
  await (0, devkit_1.formatFiles)(tree);
8
9
  }
9
- exports.default = replacePackage;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = update;
3
4
  const devkit_1 = require("@nx/devkit");
4
5
  const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
5
6
  const eslint_file_1 = require("../../generators/utils/eslint-file");
@@ -41,4 +42,3 @@ function update(tree) {
41
42
  (0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nx/esbuild:esbuild', addIgnorePattern('{projectRoot}/esbuild.config.{js,ts,mjs,mts}'));
42
43
  (0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nx/rollup:rollup', addIgnorePattern('{projectRoot}/rollup.config.{js,ts,mjs,mts}'));
43
44
  }
44
- exports.default = update;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = replacePackage;
3
4
  const devkit_1 = require("@nx/devkit");
4
5
  const replace_package_1 = require("@nx/devkit/src/utils/replace-package");
5
6
  async function replacePackage(tree) {
@@ -9,7 +10,6 @@ async function replacePackage(tree) {
9
10
  updateProjectExecutor(tree);
10
11
  await (0, devkit_1.formatFiles)(tree);
11
12
  }
12
- exports.default = replacePackage;
13
13
  function updateNxJsonExecutor(tree) {
14
14
  if (!tree.exists('nx.json')) {
15
15
  return;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = update;
3
4
  const devkit_1 = require("@nx/devkit");
4
5
  const versions_1 = require("../../utils/versions");
5
6
  const path_1 = require("path");
@@ -71,4 +72,3 @@ async function update(tree) {
71
72
  updateRecommended(tree);
72
73
  await (0, devkit_1.formatFiles)(tree);
73
74
  }
74
- exports.default = update;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = update;
3
4
  const devkit_1 = require("@nx/devkit");
4
5
  async function update(tree) {
5
6
  const projects = (0, devkit_1.getProjects)(tree);
@@ -37,7 +38,6 @@ async function update(tree) {
37
38
  }
38
39
  await (0, devkit_1.formatFiles)(tree);
39
40
  }
40
- exports.default = update;
41
41
  function getLintRoot({ root, sourceRoot }) {
42
42
  if (root === '' || root === '.') {
43
43
  return sourceRoot || './src';
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = update;
3
4
  const devkit_1 = require("@nx/devkit");
4
5
  const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
5
6
  const eslint_file_1 = require("../../generators/utils/eslint-file");
@@ -92,7 +93,6 @@ async function update(tree) {
92
93
  (0, devkit_1.updateNxJson)(tree, nxJson);
93
94
  await (0, devkit_1.formatFiles)(tree);
94
95
  }
95
- exports.default = update;
96
96
  function isTargetDefaultUsed(targetDefault, targetDefaults, projects, projectMap) {
97
97
  for (const p of Object.values(projects)) {
98
98
  for (const targetName in p.data?.targets ?? {}) {
@@ -4,7 +4,7 @@ exports.createNodes = exports.createNodesV2 = 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 node_fs_1 = require("node:fs");
7
- const node_path_1 = require("node:path");
7
+ const posix_1 = require("node:path/posix");
8
8
  const file_hasher_1 = require("nx/src/hasher/file-hasher");
9
9
  const cache_directory_1 = require("nx/src/utils/cache-directory");
10
10
  const globs_1 = require("nx/src/utils/globs");
@@ -30,7 +30,7 @@ function writeTargetsToCache(cachePath, results) {
30
30
  }
31
31
  const internalCreateNodes = async (configFilePath, options, context, projectsCache) => {
32
32
  options = normalizeOptions(options);
33
- const configDir = (0, node_path_1.dirname)(configFilePath);
33
+ const configDir = (0, posix_1.dirname)(configFilePath);
34
34
  // Ensure that configFiles are set, e2e-run fails due to them being undefined in CI (does not occur locally)
35
35
  // TODO(JamesHenry): Further troubleshoot this in CI
36
36
  context.configFiles = context.configFiles ?? [];
@@ -38,14 +38,14 @@ const internalCreateNodes = async (configFilePath, options, context, projectsCac
38
38
  // list of globs to exclude from child projects
39
39
  const nestedEslintRootPatterns = [];
40
40
  for (const configFile of context.configFiles) {
41
- const eslintRootDir = (0, node_path_1.dirname)(configFile);
41
+ const eslintRootDir = (0, posix_1.dirname)(configFile);
42
42
  if (eslintRootDir !== configDir && isSubDir(configDir, eslintRootDir)) {
43
43
  nestedEslintRootPatterns.push(`${eslintRootDir}/**/*`);
44
44
  }
45
45
  }
46
- const projectFiles = await (0, workspace_context_1.globWithWorkspaceContext)(context.workspaceRoot, ['project.json', 'package.json', '**/project.json', '**/package.json'].map((f) => (0, node_path_1.join)(configDir, f)), nestedEslintRootPatterns.length ? nestedEslintRootPatterns : undefined);
46
+ 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);
47
47
  // dedupe and sort project roots by depth for more efficient traversal
48
- const dedupedProjectRoots = Array.from(new Set(projectFiles.map((f) => (0, node_path_1.dirname)(f)))).sort((a, b) => (a !== b && isSubDir(a, b) ? -1 : 1));
48
+ const dedupedProjectRoots = Array.from(new Set(projectFiles.map((f) => (0, posix_1.dirname)(f)))).sort((a, b) => (a !== b && isSubDir(a, b) ? -1 : 1));
49
49
  const excludePatterns = dedupedProjectRoots.map((root) => `${root}/**/*`);
50
50
  const ESLint = await (0, resolve_eslint_class_1.resolveESLintClass)((0, config_file_1.isFlatConfig)(configFilePath));
51
51
  const eslintVersion = ESLint.version;
@@ -54,22 +54,22 @@ const internalCreateNodes = async (configFilePath, options, context, projectsCac
54
54
  // anything after is either a nested project or a sibling project, can be excluded
55
55
  const nestedProjectRootPatterns = excludePatterns.slice(index + 1);
56
56
  // Ignore project roots where the project does not contain any lintable files
57
- const lintableFiles = await (0, workspace_context_1.globWithWorkspaceContext)(context.workspaceRoot, [(0, node_path_1.join)(childProjectRoot, `**/*.{${options.extensions.join(',')}}`)],
57
+ const lintableFiles = await (0, workspace_context_1.globWithWorkspaceContext)(context.workspaceRoot, [(0, posix_1.join)(childProjectRoot, `**/*.{${options.extensions.join(',')}}`)],
58
58
  // exclude nested eslint roots and nested project roots
59
59
  [...nestedEslintRootPatterns, ...nestedProjectRootPatterns]);
60
- const parentConfigs = context.configFiles.filter((eslintConfig) => isSubDir(childProjectRoot, (0, node_path_1.dirname)(eslintConfig)));
61
- const hash = await (0, calculate_hash_for_create_nodes_1.calculateHashForCreateNodes)(childProjectRoot, options, context, [...parentConfigs, (0, node_path_1.join)(childProjectRoot, '.eslintignore')]);
60
+ const parentConfigs = context.configFiles.filter((eslintConfig) => isSubDir(childProjectRoot, (0, posix_1.dirname)(eslintConfig)));
61
+ const hash = await (0, calculate_hash_for_create_nodes_1.calculateHashForCreateNodes)(childProjectRoot, options, context, [...parentConfigs, (0, posix_1.join)(childProjectRoot, '.eslintignore')]);
62
62
  if (projectsCache[hash]) {
63
63
  // We can reuse the projects in the cache.
64
64
  Object.assign(projects, projectsCache[hash]);
65
65
  return;
66
66
  }
67
67
  const eslint = new ESLint({
68
- cwd: (0, node_path_1.join)(context.workspaceRoot, childProjectRoot),
68
+ cwd: (0, posix_1.join)(context.workspaceRoot, childProjectRoot),
69
69
  });
70
70
  let hasNonIgnoredLintableFiles = false;
71
71
  for (const file of lintableFiles) {
72
- if (!(await eslint.isPathIgnored((0, node_path_1.join)(context.workspaceRoot, file)))) {
72
+ if (!(await eslint.isPathIgnored((0, posix_1.join)(context.workspaceRoot, file)))) {
73
73
  hasNonIgnoredLintableFiles = true;
74
74
  break;
75
75
  }
@@ -96,17 +96,17 @@ const internalCreateNodes = async (configFilePath, options, context, projectsCac
96
96
  };
97
97
  let collectingLintableFilesPromise;
98
98
  const internalCreateNodesV2 = async (configFilePath, options, context, eslintConfigFiles, allProjectRoots, projectRootsByEslintRoots, lintableFilesPerProjectRoot, projectsCache) => {
99
- const configDir = (0, node_path_1.dirname)(configFilePath);
99
+ const configDir = (0, posix_1.dirname)(configFilePath);
100
100
  const ESLint = await (0, resolve_eslint_class_1.resolveESLintClass)((0, config_file_1.isFlatConfig)(configFilePath));
101
101
  const eslintVersion = ESLint.version;
102
102
  const projects = {};
103
103
  await Promise.all(projectRootsByEslintRoots.get(configDir).map(async (projectRoot) => {
104
- const parentConfigs = eslintConfigFiles.filter((eslintConfig) => isSubDir(projectRoot, (0, node_path_1.dirname)(eslintConfig)));
104
+ const parentConfigs = eslintConfigFiles.filter((eslintConfig) => isSubDir(projectRoot, (0, posix_1.dirname)(eslintConfig)));
105
105
  const hash = await (0, calculate_hash_for_create_nodes_1.calculateHashForCreateNodes)(projectRoot, options, {
106
106
  configFiles: eslintConfigFiles,
107
107
  nxJsonConfiguration: context.nxJsonConfiguration,
108
108
  workspaceRoot: context.workspaceRoot,
109
- }, [...parentConfigs, (0, node_path_1.join)(projectRoot, '.eslintignore')]);
109
+ }, [...parentConfigs, (0, posix_1.join)(projectRoot, '.eslintignore')]);
110
110
  if (projectsCache[hash]) {
111
111
  // We can reuse the projects in the cache.
112
112
  Object.assign(projects, projectsCache[hash]);
@@ -118,11 +118,11 @@ const internalCreateNodesV2 = async (configFilePath, options, context, eslintCon
118
118
  collectingLintableFilesPromise = null;
119
119
  }
120
120
  const eslint = new ESLint({
121
- cwd: (0, node_path_1.join)(context.workspaceRoot, projectRoot),
121
+ cwd: (0, posix_1.join)(context.workspaceRoot, projectRoot),
122
122
  });
123
123
  let hasNonIgnoredLintableFiles = false;
124
124
  for (const file of lintableFilesPerProjectRoot.get(projectRoot) ?? []) {
125
- if (!(await eslint.isPathIgnored((0, node_path_1.join)(context.workspaceRoot, file)))) {
125
+ if (!(await eslint.isPathIgnored((0, posix_1.join)(context.workspaceRoot, file)))) {
126
126
  hasNonIgnoredLintableFiles = true;
127
127
  break;
128
128
  }
@@ -152,7 +152,7 @@ exports.createNodesV2 = [
152
152
  async (configFiles, options, context) => {
153
153
  options = normalizeOptions(options);
154
154
  const optionsHash = (0, file_hasher_1.hashObject)(options);
155
- const cachePath = (0, node_path_1.join)(cache_directory_1.workspaceDataDirectory, `eslint-${optionsHash}.hash`);
155
+ const cachePath = (0, posix_1.join)(cache_directory_1.workspaceDataDirectory, `eslint-${optionsHash}.hash`);
156
156
  const targetsCache = readTargetsCache(cachePath);
157
157
  const { eslintConfigFiles, projectRoots, projectRootsByEslintRoots } = splitConfigFiles(configFiles);
158
158
  const lintableFilesPerProjectRoot = new Map();
@@ -175,8 +175,8 @@ function splitConfigFiles(configFiles) {
175
175
  const eslintConfigFiles = [];
176
176
  const projectRoots = new Set();
177
177
  for (const configFile of configFiles) {
178
- if (PROJECT_CONFIG_FILENAMES.includes((0, node_path_1.basename)(configFile))) {
179
- projectRoots.add((0, node_path_1.dirname)(configFile));
178
+ if (PROJECT_CONFIG_FILENAMES.includes((0, posix_1.basename)(configFile))) {
179
+ projectRoots.add((0, posix_1.dirname)(configFile));
180
180
  }
181
181
  else {
182
182
  eslintConfigFiles.push(configFile);
@@ -193,7 +193,7 @@ function splitConfigFiles(configFiles) {
193
193
  function groupProjectRootsByEslintRoots(eslintConfigFiles, projectRoots) {
194
194
  const projectRootsByEslintRoots = new Map();
195
195
  for (const eslintConfig of eslintConfigFiles) {
196
- projectRootsByEslintRoots.set((0, node_path_1.dirname)(eslintConfig), []);
196
+ projectRootsByEslintRoots.set((0, posix_1.dirname)(eslintConfig), []);
197
197
  }
198
198
  for (const projectRoot of projectRoots) {
199
199
  const eslintRoot = getRootForDirectory(projectRoot, projectRootsByEslintRoots);
@@ -211,19 +211,19 @@ async function collectLintableFilesByProjectRoot(lintableFilesPerProjectRoot, pr
211
211
  lintableFilesPerProjectRoot.set(projectRoot, []);
212
212
  }
213
213
  for (const file of lintableFiles) {
214
- const projectRoot = getRootForDirectory((0, node_path_1.dirname)(file), lintableFilesPerProjectRoot);
214
+ const projectRoot = getRootForDirectory((0, posix_1.dirname)(file), lintableFilesPerProjectRoot);
215
215
  if (projectRoot) {
216
216
  lintableFilesPerProjectRoot.get(projectRoot).push(file);
217
217
  }
218
218
  }
219
219
  }
220
220
  function getRootForDirectory(directory, roots) {
221
- let currentPath = (0, node_path_1.normalize)(directory);
222
- while (currentPath !== (0, node_path_1.dirname)(currentPath)) {
221
+ let currentPath = (0, posix_1.normalize)(directory);
222
+ while (currentPath !== (0, posix_1.dirname)(currentPath)) {
223
223
  if (roots.has(currentPath)) {
224
224
  return currentPath;
225
225
  }
226
- currentPath = (0, node_path_1.dirname)(currentPath);
226
+ currentPath = (0, posix_1.dirname)(currentPath);
227
227
  }
228
228
  return roots.has(currentPath) ? currentPath : null;
229
229
  }
@@ -232,15 +232,15 @@ function getProjectUsingESLintConfig(configFilePath, projectRoot, eslintVersion,
232
232
  config_file_1.baseEsLintConfigFile,
233
233
  config_file_1.baseEsLintFlatConfigFile,
234
234
  ...config_file_1.ESLINT_CONFIG_FILENAMES,
235
- ].find((f) => (0, node_fs_1.existsSync)((0, node_path_1.join)(context.workspaceRoot, f)));
235
+ ].find((f) => (0, node_fs_1.existsSync)((0, posix_1.join)(context.workspaceRoot, f)));
236
236
  // Add a lint target for each child project without an eslint config, with the root level config as an input
237
237
  let standaloneSrcPath;
238
238
  if (projectRoot === '.' &&
239
- (0, node_fs_1.existsSync)((0, node_path_1.join)(context.workspaceRoot, projectRoot, 'package.json'))) {
240
- if ((0, node_fs_1.existsSync)((0, node_path_1.join)(context.workspaceRoot, projectRoot, 'src'))) {
239
+ (0, node_fs_1.existsSync)((0, posix_1.join)(context.workspaceRoot, projectRoot, 'package.json'))) {
240
+ if ((0, node_fs_1.existsSync)((0, posix_1.join)(context.workspaceRoot, projectRoot, 'src'))) {
241
241
  standaloneSrcPath = 'src';
242
242
  }
243
- else if ((0, node_fs_1.existsSync)((0, node_path_1.join)(context.workspaceRoot, projectRoot, 'lib'))) {
243
+ else if ((0, node_fs_1.existsSync)((0, posix_1.join)(context.workspaceRoot, projectRoot, 'lib'))) {
244
244
  standaloneSrcPath = 'lib';
245
245
  }
246
246
  }
@@ -269,7 +269,7 @@ function buildEslintTargets(eslintConfigs, eslintVersion, projectRoot, workspace
269
269
  // Certain lint rules can be impacted by changes to dependencies
270
270
  '^default',
271
271
  ...eslintConfigs.map((config) => `{workspaceRoot}/${config}`.replace(`{workspaceRoot}/${projectRoot}`, isRootProject ? '{projectRoot}/' : '{projectRoot}')),
272
- ...((0, node_fs_1.existsSync)((0, node_path_1.join)(workspaceRoot, projectRoot, '.eslintignore'))
272
+ ...((0, node_fs_1.existsSync)((0, posix_1.join)(workspaceRoot, projectRoot, '.eslintignore'))
273
273
  ? ['{projectRoot}/.eslintignore']
274
274
  : []),
275
275
  '{workspaceRoot}/tools/eslint-rules/**/*',
@@ -323,10 +323,10 @@ function isSubDir(parent, child) {
323
323
  if (parent === '.') {
324
324
  return true;
325
325
  }
326
- parent = (0, node_path_1.normalize)(parent);
327
- child = (0, node_path_1.normalize)(child);
328
- if (!parent.endsWith(node_path_1.sep)) {
329
- parent += node_path_1.sep;
326
+ parent = (0, posix_1.normalize)(parent);
327
+ child = (0, posix_1.normalize)(child);
328
+ if (!parent.endsWith(posix_1.sep)) {
329
+ parent += posix_1.sep;
330
330
  }
331
331
  return child.startsWith(parent);
332
332
  }
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.findOldConfigFile = exports.findFlatConfigFile = exports.isFlatConfig = exports.baseEsLintFlatConfigFile = exports.baseEsLintConfigFile = exports.ESLINT_CONFIG_FILENAMES = exports.ESLINT_OLD_CONFIG_FILENAMES = exports.ESLINT_FLAT_CONFIG_FILENAMES = void 0;
3
+ exports.baseEsLintFlatConfigFile = exports.baseEsLintConfigFile = exports.ESLINT_CONFIG_FILENAMES = exports.ESLINT_OLD_CONFIG_FILENAMES = exports.ESLINT_FLAT_CONFIG_FILENAMES = void 0;
4
+ exports.isFlatConfig = isFlatConfig;
5
+ exports.findFlatConfigFile = findFlatConfigFile;
6
+ exports.findOldConfigFile = findOldConfigFile;
4
7
  const fs_1 = require("fs");
5
8
  const path_1 = require("path");
6
9
  const flat_config_1 = require("./flat-config");
@@ -23,7 +26,6 @@ function isFlatConfig(configFilePath) {
23
26
  const configFileName = (0, path_1.basename)(configFilePath);
24
27
  return exports.ESLINT_FLAT_CONFIG_FILENAMES.includes(configFileName);
25
28
  }
26
- exports.isFlatConfig = isFlatConfig;
27
29
  // https://eslint.org/docs/latest/use/configure/configuration-files#configuration-file-resolution
28
30
  function findFlatConfigFile(directory, workspaceRoot) {
29
31
  let currentDir = (0, path_1.resolve)(workspaceRoot, directory);
@@ -40,7 +42,6 @@ function findFlatConfigFile(directory, workspaceRoot) {
40
42
  }
41
43
  return null;
42
44
  }
43
- exports.findFlatConfigFile = findFlatConfigFile;
44
45
  function findOldConfigFile(filePathOrDirectory, workspaceRoot) {
45
46
  let currentDir = (0, path_1.resolve)(workspaceRoot, filePathOrDirectory);
46
47
  if (!(0, fs_1.statSync)(currentDir).isDirectory()) {
@@ -58,7 +59,6 @@ function findOldConfigFile(filePathOrDirectory, workspaceRoot) {
58
59
  }
59
60
  return null;
60
61
  }
61
- exports.findOldConfigFile = findOldConfigFile;
62
62
  function getConfigFileInDirectory(directory, candidateFileNames) {
63
63
  for (const filename of candidateFileNames) {
64
64
  const filePath = (0, path_1.join)(directory, filename);
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useFlatConfig = exports.flatConfigEslintFilename = exports.eslintFlatConfigFilenames = void 0;
3
+ exports.eslintFlatConfigFilenames = void 0;
4
+ exports.flatConfigEslintFilename = flatConfigEslintFilename;
5
+ exports.useFlatConfig = useFlatConfig;
4
6
  // todo: add support for eslint.config.mjs,
5
7
  exports.eslintFlatConfigFilenames = [
6
8
  'eslint.config.js',
@@ -14,7 +16,6 @@ function flatConfigEslintFilename(tree) {
14
16
  }
15
17
  throw new Error('Could not find flat config file');
16
18
  }
17
- exports.flatConfigEslintFilename = flatConfigEslintFilename;
18
19
  function useFlatConfig(tree) {
19
20
  try {
20
21
  return !!flatConfigEslintFilename(tree);
@@ -23,4 +24,3 @@ function useFlatConfig(tree) {
23
24
  return false;
24
25
  }
25
26
  }
26
- exports.useFlatConfig = useFlatConfig;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resolveESLintClass = void 0;
3
+ exports.resolveESLintClass = resolveESLintClass;
4
4
  async function resolveESLintClass(useFlatConfig = false) {
5
5
  try {
6
6
  // In eslint 8.57.0 (the final v8 version), a dedicated API was added for resolving the correct ESLint class.
@@ -20,4 +20,3 @@ async function resolveESLintClass(useFlatConfig = false) {
20
20
  throw new Error('Unable to find ESLint. Ensure ESLint is installed.');
21
21
  }
22
22
  }
23
- exports.resolveESLintClass = resolveESLintClass;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.removeParserOptionsProjectIfNotRequired = exports.hasRulesRequiringTypeChecking = void 0;
3
+ exports.hasRulesRequiringTypeChecking = hasRulesRequiringTypeChecking;
4
+ exports.removeParserOptionsProjectIfNotRequired = removeParserOptionsProjectIfNotRequired;
4
5
  // Cache the resolved rules from node_modules
5
6
  let knownRulesRequiringTypeChecking = null;
6
7
  function resolveKnownRulesRequiringTypeChecking() {
@@ -37,7 +38,6 @@ function hasRulesRequiringTypeChecking(eslintConfig) {
37
38
  const allRulesInConfig = getAllRulesInConfig(eslintConfig);
38
39
  return allRulesInConfig.some((rule) => knownRulesRequiringTypeChecking.includes(rule));
39
40
  }
40
- exports.hasRulesRequiringTypeChecking = hasRulesRequiringTypeChecking;
41
41
  function removeParserOptionsProjectIfNotRequired(json) {
42
42
  // At least one rule requiring type-checking is in use, do not migrate the config
43
43
  if (hasRulesRequiringTypeChecking(json)) {
@@ -46,7 +46,6 @@ function removeParserOptionsProjectIfNotRequired(json) {
46
46
  removeProjectParserOptionFromConfig(json);
47
47
  return json;
48
48
  }
49
- exports.removeParserOptionsProjectIfNotRequired = removeParserOptionsProjectIfNotRequired;
50
49
  function determineEnabledRules(rules) {
51
50
  return Object.entries(rules)
52
51
  .filter(([key, value]) => {
@@ -2,4 +2,4 @@ export declare const nxVersion: any;
2
2
  export declare const eslintVersion = "~8.57.0";
3
3
  export declare const eslintrcVersion = "^2.1.1";
4
4
  export declare const eslintConfigPrettierVersion = "^9.0.0";
5
- export declare const typescriptESLintVersion = "^7.3.0";
5
+ export declare const typescriptESLintVersion = "^7.16.0";
@@ -5,4 +5,4 @@ exports.nxVersion = require('../../package.json').version;
5
5
  exports.eslintVersion = '~8.57.0';
6
6
  exports.eslintrcVersion = '^2.1.1';
7
7
  exports.eslintConfigPrettierVersion = '^9.0.0';
8
- exports.typescriptESLintVersion = '^7.3.0';
8
+ exports.typescriptESLintVersion = '^7.16.0';