@nx/eslint 20.1.0-canary.20241029-4b70d1b → 20.1.0-canary.20241031-ce05a98

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": "20.1.0-canary.20241029-4b70d1b",
3
+ "version": "20.1.0-canary.20241031-ce05a98",
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,8 +35,8 @@
35
35
  "eslint": "^8.0.0 || ^9.0.0"
36
36
  },
37
37
  "dependencies": {
38
- "@nx/devkit": "20.1.0-canary.20241029-4b70d1b",
39
- "@nx/js": "20.1.0-canary.20241029-4b70d1b",
38
+ "@nx/devkit": "20.1.0-canary.20241031-ce05a98",
39
+ "@nx/js": "20.1.0-canary.20241031-ce05a98",
40
40
  "semver": "^7.5.3",
41
41
  "tslib": "^2.3.0",
42
42
  "typescript": "~5.4.2"
@@ -71,8 +71,7 @@ function migrateConfigToMonorepoStyle(projects, tree, unitTestRunner, keepExisti
71
71
  }
72
72
  function findLintTarget(project) {
73
73
  return Object.values(project.targets ?? {}).find((target) => target.executor === '@nx/eslint:lint' ||
74
- target.executor === '@nx/linter:eslint' ||
75
- target.executor === '@nrwl/linter:eslint');
74
+ target.executor === '@nx/linter:eslint');
76
75
  }
77
76
  function migrateEslintFile(projectEslintPath, tree) {
78
77
  const baseFile = (0, eslint_file_1.findEslintFile)(tree);
@@ -88,8 +87,6 @@ function migrateEslintFile(projectEslintPath, tree) {
88
87
  config = (0, ast_utils_1.removeCompatExtends)(config, [
89
88
  'plugin:@nx/typescript',
90
89
  'plugin:@nx/javascript',
91
- 'plugin:@nrwl/typescript',
92
- 'plugin:@nrwl/javascript',
93
90
  ]);
94
91
  config = (0, ast_utils_1.removePredefinedConfigs)(config, '@nx/eslint-plugin', 'nx', [
95
92
  'flat/base',
@@ -104,7 +101,7 @@ function migrateEslintFile(projectEslintPath, tree) {
104
101
  delete json.root;
105
102
  // remove nrwl/nx plugins
106
103
  if (json.plugins) {
107
- json.plugins = json.plugins.filter((p) => p !== '@nx' && p !== '@nrwl/nx');
104
+ json.plugins = json.plugins.filter((p) => p !== '@nx');
108
105
  if (json.plugins.length === 0) {
109
106
  delete json.plugins;
110
107
  }
@@ -124,9 +121,7 @@ function migrateEslintFile(projectEslintPath, tree) {
124
121
  json.overrides.forEach((override) => {
125
122
  if (override.extends) {
126
123
  override.extends = override.extends.filter((ext) => ext !== 'plugin:@nx/typescript' &&
127
- ext !== 'plugin:@nrwl/nx/typescript' &&
128
- ext !== 'plugin:@nx/javascript' &&
129
- ext !== 'plugin:@nrwl/nx/javascript');
124
+ ext !== 'plugin:@nx/javascript');
130
125
  if (override.extends.length === 0) {
131
126
  delete override.extends;
132
127
  }
@@ -184,7 +184,8 @@ function createEsLintConfiguration(tree, options, projectConfig, setParserOption
184
184
  });
185
185
  const nodeList = (0, ast_utils_1.createNodeList)(importMap, nodes);
186
186
  const content = (0, ast_utils_1.stringifyNodeList)(nodeList);
187
- tree.write((0, path_1.join)(projectConfig.root, 'eslint.config.js'), content);
187
+ const ext = extendedRootConfig?.endsWith('.cjs') ? '.cjs' : '.js';
188
+ tree.write((0, path_1.join)(projectConfig.root, `eslint.config${ext}`), content);
188
189
  }
189
190
  else {
190
191
  (0, devkit_1.writeJson)(tree, (0, path_1.join)(projectConfig.root, `.eslintrc.json`), {
@@ -223,7 +224,7 @@ function isMigrationToMonorepoNeeded(tree, graph) {
223
224
  return false;
224
225
  }
225
226
  for (const targetConfig of Object.values(rootProject.data.targets ?? {})) {
226
- if (['@nx/eslint:lint', '@nrwl/linter:eslint', '@nx/linter:eslint'].includes(targetConfig.executor) ||
227
+ if (['@nx/eslint:lint', '@nx/linter:eslint'].includes(targetConfig.executor) ||
227
228
  (targetConfig.executor === 'nx:run-commands' &&
228
229
  targetConfig.options?.command &&
229
230
  targetConfig.options?.command.startsWith('eslint '))) {
@@ -40,7 +40,9 @@ function isEslintConfigSupported(tree, projectRoot = '') {
40
40
  if (!eslintFile) {
41
41
  return false;
42
42
  }
43
- return eslintFile.endsWith('.json') || eslintFile.endsWith('.config.js');
43
+ return (eslintFile.endsWith('.json') ||
44
+ eslintFile.endsWith('.config.js') ||
45
+ eslintFile.endsWith('.config.cjs'));
44
46
  }
45
47
  function updateRelativePathsInConfig(tree, sourcePath, destinationPath) {
46
48
  if (sourcePath === destinationPath ||