@nx/eslint 0.0.0-pr-30715-a5f5e3b → 0.0.0-pr-31222-862e973

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 (55) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +1 -1
  3. package/migrations.json +98 -119
  4. package/package.json +7 -6
  5. package/src/executors/lint/utility/eslint-utils.js +0 -6
  6. package/src/generators/convert-to-flat-config/converters/json-converter.d.ts +1 -1
  7. package/src/generators/convert-to-flat-config/converters/json-converter.js +18 -10
  8. package/src/generators/convert-to-flat-config/generator.js +17 -18
  9. package/src/generators/convert-to-flat-config/schema.d.ts +0 -2
  10. package/src/generators/convert-to-inferred/convert-to-inferred.js +1 -2
  11. package/src/generators/init/global-eslint-config.d.ts +1 -1
  12. package/src/generators/init/global-eslint-config.js +6 -17
  13. package/src/generators/init/init-migration.d.ts +1 -1
  14. package/src/generators/init/init-migration.js +13 -18
  15. package/src/generators/init/init.d.ts +0 -1
  16. package/src/generators/init/init.js +6 -31
  17. package/src/generators/lint-project/lint-project.d.ts +0 -1
  18. package/src/generators/lint-project/lint-project.js +15 -37
  19. package/src/generators/lint-project/setup-root-eslint.d.ts +0 -1
  20. package/src/generators/lint-project/setup-root-eslint.js +1 -2
  21. package/src/generators/utils/eslint-file.d.ts +2 -3
  22. package/src/generators/utils/eslint-file.js +28 -160
  23. package/src/generators/utils/flat-config/ast-utils.d.ts +4 -12
  24. package/src/generators/utils/flat-config/ast-utils.js +63 -412
  25. package/src/generators/utils/linter.d.ts +0 -3
  26. package/src/generators/utils/linter.js +2 -2
  27. package/src/generators/workspace-rule/files/__name__.spec.ts__tmpl__ +2 -11
  28. package/src/generators/workspace-rule/workspace-rule.d.ts +2 -2
  29. package/src/generators/workspace-rule/workspace-rule.js +3 -11
  30. package/src/generators/workspace-rules-project/workspace-rules-project.js +1 -4
  31. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +2 -0
  32. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +9 -0
  33. package/src/migrations/update-16-8-0-add-ignored-files/update-16-8-0-add-ignored-files.d.ts +2 -0
  34. package/src/migrations/update-16-8-0-add-ignored-files/update-16-8-0-add-ignored-files.js +44 -0
  35. package/src/migrations/update-17-0-0-rename-to-eslint/update-17-0-0-rename-to-eslint.d.ts +2 -0
  36. package/src/migrations/update-17-0-0-rename-to-eslint/update-17-0-0-rename-to-eslint.js +47 -0
  37. package/src/migrations/update-17-1-0/update-typescript-eslint.d.ts +2 -0
  38. package/src/migrations/update-17-1-0/update-typescript-eslint.js +74 -0
  39. package/src/migrations/update-17-2-0/simplify-eslint-patterns.d.ts +2 -0
  40. package/src/migrations/update-17-2-0/simplify-eslint-patterns.js +46 -0
  41. package/src/migrations/update-17-2-9/move-options-to-target-defaults.d.ts +2 -0
  42. package/src/migrations/update-17-2-9/move-options-to-target-defaults.js +107 -0
  43. package/src/plugins/plugin.js +10 -21
  44. package/src/utils/config-file.d.ts +1 -3
  45. package/src/utils/config-file.js +2 -5
  46. package/src/utils/flat-config.d.ts +0 -1
  47. package/src/utils/flat-config.js +3 -9
  48. package/src/utils/version-utils.d.ts +0 -1
  49. package/src/utils/version-utils.js +9 -13
  50. package/src/utils/versions.d.ts +2 -3
  51. package/src/utils/versions.js +3 -4
  52. package/src/migrations/update-20-2-0/update-typescript-eslint-v8-13-0.d.ts +0 -2
  53. package/src/migrations/update-20-2-0/update-typescript-eslint-v8-13-0.js +0 -23
  54. package/src/migrations/update-20-3-0/add-file-extensions-to-overrides.d.ts +0 -2
  55. package/src/migrations/update-20-3-0/add-file-extensions-to-overrides.js +0 -49
@@ -11,19 +11,9 @@ const versions_1 = require("../../utils/versions");
11
11
  const ast_utils_1 = require("../utils/flat-config/ast-utils");
12
12
  const plugin_1 = require("../utils/plugin");
13
13
  const config_file_1 = require("../../utils/config-file");
14
- function migrateConfigToMonorepoStyle(projects, tree, unitTestRunner, eslintConfigFormat, keepExistingVersions) {
14
+ function migrateConfigToMonorepoStyle(projects, tree, unitTestRunner, keepExistingVersions) {
15
15
  const rootEslintConfig = (0, eslint_file_1.findEslintFile)(tree);
16
16
  let skipCleanup = false;
17
- if (rootEslintConfig) {
18
- // We do not want to mix the formats
19
- const fileExtension = (0, path_1.extname)(rootEslintConfig);
20
- if (fileExtension === '.mjs' || fileExtension === '.cjs') {
21
- eslintConfigFormat = fileExtension.slice(1);
22
- }
23
- else {
24
- eslintConfigFormat = (0, eslint_file_1.determineEslintConfigFormat)(tree.read(rootEslintConfig, 'utf-8'));
25
- }
26
- }
27
17
  if (rootEslintConfig?.match(/\.base\./) &&
28
18
  !projects.some((p) => p.root === '.')) {
29
19
  // if the migration has been run already, we need to rename the base config
@@ -37,9 +27,9 @@ function migrateConfigToMonorepoStyle(projects, tree, unitTestRunner, eslintConf
37
27
  (0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
38
28
  '@eslint/js': versions_1.eslintVersion,
39
29
  }, undefined, keepExistingVersions);
40
- tree.write(tree.exists(`eslint.config.${eslintConfigFormat}`)
41
- ? `eslint.base.config.${eslintConfigFormat}`
42
- : `eslint.config.${eslintConfigFormat}`, (0, global_eslint_config_1.getGlobalFlatEslintConfiguration)(eslintConfigFormat));
30
+ tree.write(tree.exists('eslint.config.js')
31
+ ? 'eslint.base.config.js'
32
+ : 'eslint.config.js', (0, global_eslint_config_1.getGlobalFlatEslintConfiguration)());
43
33
  }
44
34
  else {
45
35
  const eslintFile = (0, eslint_file_1.findEslintFile)(tree, '.');
@@ -81,7 +71,8 @@ function migrateConfigToMonorepoStyle(projects, tree, unitTestRunner, eslintConf
81
71
  }
82
72
  function findLintTarget(project) {
83
73
  return Object.values(project.targets ?? {}).find((target) => target.executor === '@nx/eslint:lint' ||
84
- target.executor === '@nx/linter:eslint');
74
+ target.executor === '@nx/linter:eslint' ||
75
+ target.executor === '@nrwl/linter:eslint');
85
76
  }
86
77
  function migrateEslintFile(projectEslintPath, tree) {
87
78
  const baseFile = (0, eslint_file_1.findEslintFile)(tree);
@@ -90,13 +81,15 @@ function migrateEslintFile(projectEslintPath, tree) {
90
81
  let config = tree.read(projectEslintPath, 'utf-8');
91
82
  // remove @nx plugin
92
83
  config = (0, ast_utils_1.removePlugin)(config, '@nx', '@nx/eslint-plugin-nx');
93
- // if base config is cjs, we will need to import it using async import
84
+ // extend eslint.base.config.js
94
85
  config = (0, ast_utils_1.addImportToFlatConfig)(config, 'baseConfig', `${(0, devkit_1.offsetFromRoot)((0, path_1.dirname)(projectEslintPath))}${baseFile}`);
95
86
  config = (0, ast_utils_1.addBlockToFlatConfigExport)(config, (0, ast_utils_1.generateSpreadElement)('baseConfig'), { insertAtTheEnd: false });
96
87
  // cleanup file extends
97
88
  config = (0, ast_utils_1.removeCompatExtends)(config, [
98
89
  'plugin:@nx/typescript',
99
90
  'plugin:@nx/javascript',
91
+ 'plugin:@nrwl/typescript',
92
+ 'plugin:@nrwl/javascript',
100
93
  ]);
101
94
  config = (0, ast_utils_1.removePredefinedConfigs)(config, '@nx/eslint-plugin', 'nx', [
102
95
  'flat/base',
@@ -111,7 +104,7 @@ function migrateEslintFile(projectEslintPath, tree) {
111
104
  delete json.root;
112
105
  // remove nrwl/nx plugins
113
106
  if (json.plugins) {
114
- json.plugins = json.plugins.filter((p) => p !== '@nx');
107
+ json.plugins = json.plugins.filter((p) => p !== '@nx' && p !== '@nrwl/nx');
115
108
  if (json.plugins.length === 0) {
116
109
  delete json.plugins;
117
110
  }
@@ -131,7 +124,9 @@ function migrateEslintFile(projectEslintPath, tree) {
131
124
  json.overrides.forEach((override) => {
132
125
  if (override.extends) {
133
126
  override.extends = override.extends.filter((ext) => ext !== 'plugin:@nx/typescript' &&
134
- ext !== 'plugin:@nx/javascript');
127
+ ext !== 'plugin:@nrwl/nx/typescript' &&
128
+ ext !== 'plugin:@nx/javascript' &&
129
+ ext !== 'plugin:@nrwl/nx/javascript');
135
130
  if (override.extends.length === 0) {
136
131
  delete override.extends;
137
132
  }
@@ -4,7 +4,6 @@ export interface LinterInitOptions {
4
4
  keepExistingVersions?: boolean;
5
5
  updatePackageScripts?: boolean;
6
6
  addPlugin?: boolean;
7
- eslintConfigFormat?: 'mjs' | 'cjs';
8
7
  }
9
8
  export declare function initEsLint(tree: Tree, options: LinterInitOptions): Promise<GeneratorCallback>;
10
9
  export declare function lintInitGenerator(tree: Tree, options: LinterInitOptions): Promise<GeneratorCallback>;
@@ -8,19 +8,18 @@ const versions_1 = require("../../utils/versions");
8
8
  const eslint_file_1 = require("../utils/eslint-file");
9
9
  const plugin_1 = require("../../plugins/plugin");
10
10
  const plugin_2 = require("../utils/plugin");
11
- const path_1 = require("path");
12
- function updateProductionFileset(tree, format = 'mjs') {
11
+ function updateProductionFileset(tree) {
13
12
  const nxJson = (0, devkit_1.readNxJson)(tree);
14
13
  const productionFileSet = nxJson.namedInputs?.production;
15
14
  if (productionFileSet) {
16
15
  productionFileSet.push('!{projectRoot}/.eslintrc.json');
17
- productionFileSet.push(`!{projectRoot}/eslint.config.${format}`);
16
+ productionFileSet.push('!{projectRoot}/eslint.config.js');
18
17
  // Dedupe and set
19
18
  nxJson.namedInputs.production = Array.from(new Set(productionFileSet));
20
19
  }
21
20
  (0, devkit_1.updateNxJson)(tree, nxJson);
22
21
  }
23
- function addTargetDefaults(tree, format) {
22
+ function addTargetDefaults(tree) {
24
23
  const nxJson = (0, devkit_1.readNxJson)(tree);
25
24
  nxJson.targetDefaults ??= {};
26
25
  nxJson.targetDefaults['@nx/eslint:lint'] ??= {};
@@ -29,40 +28,17 @@ function addTargetDefaults(tree, format) {
29
28
  'default',
30
29
  `{workspaceRoot}/.eslintrc.json`,
31
30
  `{workspaceRoot}/.eslintignore`,
32
- `{workspaceRoot}/eslint.config.${format}`,
31
+ `{workspaceRoot}/eslint.config.js`,
33
32
  ];
34
33
  (0, devkit_1.updateNxJson)(tree, nxJson);
35
34
  }
36
- function updateVsCodeRecommendedExtensions(host) {
37
- if (!host.exists('.vscode/extensions.json')) {
38
- return;
39
- }
40
- (0, devkit_1.updateJson)(host, '.vscode/extensions.json', (json) => {
41
- json.recommendations = json.recommendations || [];
42
- const extension = 'dbaeumer.vscode-eslint';
43
- if (!json.recommendations.includes(extension)) {
44
- json.recommendations.push(extension);
45
- }
46
- return json;
47
- });
48
- }
49
35
  async function initEsLint(tree, options) {
50
36
  const nxJson = (0, devkit_1.readNxJson)(tree);
51
37
  const addPluginDefault = process.env.NX_ADD_PLUGINS !== 'false' &&
52
38
  nxJson.useInferencePlugins !== false;
53
39
  options.addPlugin ??= addPluginDefault;
54
- options.eslintConfigFormat ??= 'mjs';
55
40
  const hasPlugin = (0, plugin_2.hasEslintPlugin)(tree);
56
41
  const rootEslintFile = (0, eslint_file_1.findEslintFile)(tree);
57
- if (rootEslintFile) {
58
- const fileExtension = (0, path_1.extname)(rootEslintFile);
59
- if (fileExtension === '.mjs' || fileExtension === '.cjs') {
60
- options.eslintConfigFormat = fileExtension.slice(1);
61
- }
62
- else {
63
- options.eslintConfigFormat = (0, eslint_file_1.determineEslintConfigFormat)(tree.read(rootEslintFile, 'utf-8'));
64
- }
65
- }
66
42
  const graph = await (0, devkit_1.createProjectGraphAsync)();
67
43
  const lintTargetNames = [
68
44
  'lint',
@@ -81,15 +57,14 @@ async function initEsLint(tree, options) {
81
57
  if (rootEslintFile) {
82
58
  return () => { };
83
59
  }
84
- updateProductionFileset(tree, options.eslintConfigFormat);
85
- updateVsCodeRecommendedExtensions(tree);
60
+ updateProductionFileset(tree);
86
61
  if (options.addPlugin) {
87
62
  await (0, add_plugin_1.addPlugin)(tree, graph, '@nx/eslint/plugin', plugin_1.createNodesV2, {
88
63
  targetName: lintTargetNames,
89
64
  }, options.updatePackageScripts);
90
65
  }
91
66
  else {
92
- addTargetDefaults(tree, options.eslintConfigFormat);
67
+ addTargetDefaults(tree);
93
68
  }
94
69
  const tasks = [];
95
70
  if (!options.skipPackageJson) {
@@ -12,7 +12,6 @@ interface LintProjectOptions {
12
12
  rootProject?: boolean;
13
13
  keepExistingVersions?: boolean;
14
14
  addPlugin?: boolean;
15
- eslintConfigFormat?: 'mjs' | 'cjs';
16
15
  /**
17
16
  * @internal
18
17
  */
@@ -12,15 +12,12 @@ const flat_config_1 = require("../../utils/flat-config");
12
12
  const ast_utils_1 = require("../utils/flat-config/ast-utils");
13
13
  const config_file_1 = require("../../utils/config-file");
14
14
  const plugin_1 = require("../utils/plugin");
15
- const versions_1 = require("../../utils/versions");
16
15
  const setup_root_eslint_1 = require("./setup-root-eslint");
17
- const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
18
16
  function lintProjectGenerator(tree, options) {
19
17
  return lintProjectGeneratorInternal(tree, { addPlugin: false, ...options });
20
18
  }
21
19
  async function lintProjectGeneratorInternal(tree, options) {
22
20
  const nxJson = (0, devkit_1.readNxJson)(tree);
23
- options.eslintConfigFormat ??= 'mjs';
24
21
  const addPluginDefault = process.env.NX_ADD_PLUGINS !== 'false' &&
25
22
  nxJson.useInferencePlugins !== false;
26
23
  options.addPlugin ??= addPluginDefault;
@@ -28,14 +25,12 @@ async function lintProjectGeneratorInternal(tree, options) {
28
25
  const initTask = await (0, init_1.lintInitGenerator)(tree, {
29
26
  skipPackageJson: options.skipPackageJson,
30
27
  addPlugin: options.addPlugin,
31
- eslintConfigFormat: options.eslintConfigFormat,
32
28
  });
33
29
  tasks.push(initTask);
34
30
  const rootEsLintTask = (0, setup_root_eslint_1.setupRootEsLint)(tree, {
35
31
  unitTestRunner: options.unitTestRunner,
36
32
  skipPackageJson: options.skipPackageJson,
37
33
  rootProject: options.rootProject,
38
- eslintConfigFormat: options.eslintConfigFormat,
39
34
  });
40
35
  tasks.push(rootEsLintTask);
41
36
  const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
@@ -46,7 +41,7 @@ async function lintProjectGeneratorInternal(tree, options) {
46
41
  if (lintFilePatterns &&
47
42
  lintFilePatterns.length &&
48
43
  !lintFilePatterns.includes('{projectRoot}') &&
49
- isBuildableLibraryProject(tree, projectConfig)) {
44
+ isBuildableLibraryProject(projectConfig)) {
50
45
  lintFilePatterns.push(`{projectRoot}/package.json`);
51
46
  }
52
47
  const hasPlugin = (0, plugin_1.hasEslintPlugin)(tree);
@@ -54,7 +49,6 @@ async function lintProjectGeneratorInternal(tree, options) {
54
49
  if (lintFilePatterns &&
55
50
  lintFilePatterns.length &&
56
51
  lintFilePatterns.some((p) => !['./src', '{projectRoot}', projectConfig.root].includes(p))) {
57
- projectConfig.targets ??= {};
58
52
  projectConfig.targets['lint'] = {
59
53
  command: `eslint ${lintFilePatterns
60
54
  .join(' ')
@@ -63,7 +57,6 @@ async function lintProjectGeneratorInternal(tree, options) {
63
57
  }
64
58
  }
65
59
  else {
66
- projectConfig.targets ??= {};
67
60
  projectConfig.targets['lint'] = {
68
61
  executor: '@nx/eslint:lint',
69
62
  };
@@ -89,7 +82,7 @@ async function lintProjectGeneratorInternal(tree, options) {
89
82
  filteredProjects.push(project);
90
83
  }
91
84
  });
92
- const migrateTask = (0, init_migration_1.migrateConfigToMonorepoStyle)(filteredProjects, tree, options.unitTestRunner, options.eslintConfigFormat, options.keepExistingVersions);
85
+ const migrateTask = (0, init_migration_1.migrateConfigToMonorepoStyle)(filteredProjects, tree, options.unitTestRunner, options.keepExistingVersions);
93
86
  tasks.push(migrateTask);
94
87
  }
95
88
  }
@@ -97,15 +90,10 @@ async function lintProjectGeneratorInternal(tree, options) {
97
90
  // additionally, the companion e2e app would have `rootProject: true`
98
91
  // so we need to check for the root path as well
99
92
  if (!options.rootProject || projectConfig.root !== '.') {
100
- const addDependencyChecks = options.addPackageJsonDependencyChecks ||
101
- isBuildableLibraryProject(tree, projectConfig);
102
- createEsLintConfiguration(tree, options, projectConfig, options.setParserOptionsProject, options.rootProject, addDependencyChecks);
103
- if (addDependencyChecks) {
104
- tasks.push((0, devkit_1.addDependenciesToPackageJson)(tree, {}, { 'jsonc-eslint-parser': versions_1.jsoncEslintParserVersion }, undefined, true));
105
- }
93
+ createEsLintConfiguration(tree, options, projectConfig, options.setParserOptionsProject, options.rootProject);
106
94
  }
107
95
  // Buildable libs need source analysis enabled for linting `package.json`.
108
- if (isBuildableLibraryProject(tree, projectConfig) &&
96
+ if (isBuildableLibraryProject(projectConfig) &&
109
97
  !isJsAnalyzeSourceFilesEnabled(tree)) {
110
98
  (0, devkit_1.updateJson)(tree, 'nx.json', (json) => {
111
99
  json.pluginsConfig ??= {};
@@ -120,24 +108,14 @@ async function lintProjectGeneratorInternal(tree, options) {
120
108
  }
121
109
  return (0, devkit_1.runTasksInSerial)(...tasks);
122
110
  }
123
- function createEsLintConfiguration(tree, options, projectConfig, setParserOptionsProject, rootProject, addDependencyChecks) {
111
+ function createEsLintConfiguration(tree, options, projectConfig, setParserOptionsProject, rootProject) {
124
112
  // we are only extending root for non-standalone projects or their complementary e2e apps
125
113
  const extendedRootConfig = rootProject ? undefined : (0, eslint_file_1.findEslintFile)(tree);
126
114
  const pathToRootConfig = extendedRootConfig
127
115
  ? `${(0, devkit_1.offsetFromRoot)(projectConfig.root)}${extendedRootConfig}`
128
116
  : undefined;
129
- if (extendedRootConfig) {
130
- // We do not want to mix the formats
131
- // if the base file extension is `.mjs` we should use `mjs` for the new file
132
- // or if base the file extension is `.cjs` then the format should be `cjs`
133
- const fileExtension = (0, path_1.extname)(extendedRootConfig);
134
- if (fileExtension === '.mjs' || fileExtension === '.cjs') {
135
- options.eslintConfigFormat = fileExtension.slice(1);
136
- }
137
- else {
138
- options.eslintConfigFormat = (0, eslint_file_1.determineEslintConfigFormat)(tree.read(extendedRootConfig, 'utf-8'));
139
- }
140
- }
117
+ const addDependencyChecks = options.addPackageJsonDependencyChecks ||
118
+ isBuildableLibraryProject(projectConfig);
141
119
  const overrides = (0, flat_config_1.useFlatConfig)(tree)
142
120
  ? // For flat configs, we don't need to generate different overrides for each file. Users should add their own overrides as needed.
143
121
  []
@@ -200,11 +178,11 @@ function createEsLintConfiguration(tree, options, projectConfig, setParserOption
200
178
  nodes.push((0, ast_utils_1.generateSpreadElement)('baseConfig'));
201
179
  }
202
180
  overrides.forEach((override) => {
203
- nodes.push((0, ast_utils_1.generateFlatOverride)(override, options.eslintConfigFormat));
181
+ nodes.push((0, ast_utils_1.generateFlatOverride)(override));
204
182
  });
205
- const nodeList = (0, ast_utils_1.createNodeList)(importMap, nodes, options.eslintConfigFormat);
183
+ const nodeList = (0, ast_utils_1.createNodeList)(importMap, nodes);
206
184
  const content = (0, ast_utils_1.stringifyNodeList)(nodeList);
207
- tree.write((0, path_1.join)(projectConfig.root, `eslint.config.${options.eslintConfigFormat}`), content);
185
+ tree.write((0, path_1.join)(projectConfig.root, 'eslint.config.js'), content);
208
186
  }
209
187
  else {
210
188
  (0, devkit_1.writeJson)(tree, (0, path_1.join)(projectConfig.root, `.eslintrc.json`), {
@@ -221,9 +199,8 @@ function isJsAnalyzeSourceFilesEnabled(tree) {
221
199
  return (jsPluginConfig?.analyzeSourceFiles ??
222
200
  nxJson.extends !== 'nx/presets/npm.json');
223
201
  }
224
- function isBuildableLibraryProject(tree, projectConfig) {
225
- return ((0, ts_solution_setup_1.getProjectType)(tree, projectConfig.root, projectConfig.projectType) ===
226
- 'library' &&
202
+ function isBuildableLibraryProject(projectConfig) {
203
+ return (projectConfig.projectType === 'library' &&
227
204
  projectConfig.targets?.build &&
228
205
  !!projectConfig.targets.build);
229
206
  }
@@ -233,7 +210,8 @@ function isBuildableLibraryProject(tree, projectConfig) {
233
210
  */
234
211
  function isMigrationToMonorepoNeeded(tree, graph) {
235
212
  // the base config is already created, migration has been done
236
- if ([config_file_1.baseEsLintConfigFile, ...config_file_1.BASE_ESLINT_CONFIG_FILENAMES].some((f) => tree.exists(f))) {
213
+ if (tree.exists(config_file_1.baseEsLintConfigFile) ||
214
+ tree.exists(config_file_1.baseEsLintFlatConfigFile)) {
237
215
  return false;
238
216
  }
239
217
  const nodes = Object.values(graph.nodes);
@@ -243,7 +221,7 @@ function isMigrationToMonorepoNeeded(tree, graph) {
243
221
  return false;
244
222
  }
245
223
  for (const targetConfig of Object.values(rootProject.data.targets ?? {})) {
246
- if (['@nx/eslint:lint', '@nx/linter:eslint'].includes(targetConfig.executor) ||
224
+ if (['@nx/eslint:lint', '@nrwl/linter:eslint', '@nx/linter:eslint'].includes(targetConfig.executor) ||
247
225
  (targetConfig.executor === 'nx:run-commands' &&
248
226
  targetConfig.options?.command &&
249
227
  targetConfig.options?.command.startsWith('eslint '))) {
@@ -3,6 +3,5 @@ export type SetupRootEsLintOptions = {
3
3
  unitTestRunner?: string;
4
4
  skipPackageJson?: boolean;
5
5
  rootProject?: boolean;
6
- eslintConfigFormat?: 'mjs' | 'cjs';
7
6
  };
8
7
  export declare function setupRootEsLint(tree: Tree, options: SetupRootEsLintOptions): GeneratorCallback;
@@ -11,7 +11,6 @@ function setupRootEsLint(tree, options) {
11
11
  if (rootEslintFile) {
12
12
  return () => { };
13
13
  }
14
- options.eslintConfigFormat ??= 'mjs';
15
14
  if (!(0, flat_config_1.useFlatConfig)(tree)) {
16
15
  return setUpLegacyRootEslintRc(tree, options);
17
16
  }
@@ -39,7 +38,7 @@ function setUpLegacyRootEslintRc(tree, options) {
39
38
  : () => { };
40
39
  }
41
40
  function setUpRootFlatConfig(tree, options) {
42
- tree.write(`eslint.config.${options.eslintConfigFormat}`, (0, global_eslint_config_1.getGlobalFlatEslintConfiguration)(options.eslintConfigFormat, options.rootProject));
41
+ tree.write('eslint.config.js', (0, global_eslint_config_1.getGlobalFlatEslintConfiguration)(options.rootProject));
43
42
  return !options.skipPackageJson
44
43
  ? (0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
45
44
  '@eslint/js': versions_1.eslint9__eslintVersion,
@@ -3,13 +3,12 @@ import type { Linter } from 'eslint';
3
3
  export declare function findEslintFile(tree: Tree, projectRoot?: string): string | null;
4
4
  export declare function isEslintConfigSupported(tree: Tree, projectRoot?: string): boolean;
5
5
  export declare function updateRelativePathsInConfig(tree: Tree, sourcePath: string, destinationPath: string): void;
6
- export declare function determineEslintConfigFormat(content: string): 'mjs' | 'cjs';
7
6
  export declare function addOverrideToLintConfig(tree: Tree, root: string, override: Partial<Linter.ConfigOverride<Linter.RulesRecord>>, options?: {
8
7
  insertAtTheEnd?: boolean;
9
8
  checkBaseConfig?: boolean;
10
9
  }): void;
11
- export declare function updateOverrideInLintConfig(tree: Tree, rootOrFile: string, lookup: (override: Linter.ConfigOverride<Linter.RulesRecord>) => boolean, update: (override: Linter.ConfigOverride<Linter.RulesRecord>) => Linter.ConfigOverride<Linter.RulesRecord>): void;
12
- export declare function lintConfigHasOverride(tree: Tree, rootOrFile: string, lookup: (override: Linter.ConfigOverride<Linter.RulesRecord>) => boolean, checkBaseConfig?: boolean): boolean;
10
+ export declare function updateOverrideInLintConfig(tree: Tree, root: string, lookup: (override: Linter.ConfigOverride<Linter.RulesRecord>) => boolean, update: (override: Linter.ConfigOverride<Linter.RulesRecord>) => Linter.ConfigOverride<Linter.RulesRecord>): void;
11
+ export declare function lintConfigHasOverride(tree: Tree, root: string, lookup: (override: Linter.ConfigOverride<Linter.RulesRecord>) => boolean, checkBaseConfig?: boolean): boolean;
13
12
  export declare function replaceOverridesInLintConfig(tree: Tree, root: string, overrides: Linter.ConfigOverride<Linter.RulesRecord>[]): void;
14
13
  export declare function addExtendsToLintConfig(tree: Tree, root: string, plugin: string | {
15
14
  name: string;