@nx/eslint 0.0.0-pr-29750-cc9549c → 0.0.0-pr-29860-43e1fcb

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": "0.0.0-pr-29750-cc9549c",
3
+ "version": "0.0.0-pr-29860-43e1fcb",
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": "0.0.0-pr-29750-cc9549c",
39
- "@nx/js": "0.0.0-pr-29750-cc9549c",
38
+ "@nx/devkit": "0.0.0-pr-29860-43e1fcb",
39
+ "@nx/js": "0.0.0-pr-29860-43e1fcb",
40
40
  "semver": "^7.5.3",
41
41
  "tslib": "^2.3.0",
42
42
  "typescript": "~5.7.2"
@@ -113,6 +113,8 @@ const getGlobalFlatEslintConfiguration = (format, rootProject) => {
113
113
  files: [
114
114
  '**/*.ts',
115
115
  '**/*.tsx',
116
+ '**/*.cts',
117
+ '**/*.mts',
116
118
  '**/*.js',
117
119
  '**/*.jsx',
118
120
  '**/*.cjs',
@@ -13,6 +13,7 @@ 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
15
  const setup_root_eslint_1 = require("./setup-root-eslint");
16
+ const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
16
17
  function lintProjectGenerator(tree, options) {
17
18
  return lintProjectGeneratorInternal(tree, { addPlugin: false, ...options });
18
19
  }
@@ -44,7 +45,7 @@ async function lintProjectGeneratorInternal(tree, options) {
44
45
  if (lintFilePatterns &&
45
46
  lintFilePatterns.length &&
46
47
  !lintFilePatterns.includes('{projectRoot}') &&
47
- isBuildableLibraryProject(projectConfig)) {
48
+ isBuildableLibraryProject(tree, projectConfig)) {
48
49
  lintFilePatterns.push(`{projectRoot}/package.json`);
49
50
  }
50
51
  const hasPlugin = (0, plugin_1.hasEslintPlugin)(tree);
@@ -98,7 +99,7 @@ async function lintProjectGeneratorInternal(tree, options) {
98
99
  createEsLintConfiguration(tree, options, projectConfig, options.setParserOptionsProject, options.rootProject);
99
100
  }
100
101
  // Buildable libs need source analysis enabled for linting `package.json`.
101
- if (isBuildableLibraryProject(projectConfig) &&
102
+ if (isBuildableLibraryProject(tree, projectConfig) &&
102
103
  !isJsAnalyzeSourceFilesEnabled(tree)) {
103
104
  (0, devkit_1.updateJson)(tree, 'nx.json', (json) => {
104
105
  json.pluginsConfig ??= {};
@@ -132,7 +133,7 @@ function createEsLintConfiguration(tree, options, projectConfig, setParserOption
132
133
  }
133
134
  }
134
135
  const addDependencyChecks = options.addPackageJsonDependencyChecks ||
135
- isBuildableLibraryProject(projectConfig);
136
+ isBuildableLibraryProject(tree, projectConfig);
136
137
  const overrides = (0, flat_config_1.useFlatConfig)(tree)
137
138
  ? // For flat configs, we don't need to generate different overrides for each file. Users should add their own overrides as needed.
138
139
  []
@@ -216,8 +217,9 @@ function isJsAnalyzeSourceFilesEnabled(tree) {
216
217
  return (jsPluginConfig?.analyzeSourceFiles ??
217
218
  nxJson.extends !== 'nx/presets/npm.json');
218
219
  }
219
- function isBuildableLibraryProject(projectConfig) {
220
- return (projectConfig.projectType === 'library' &&
220
+ function isBuildableLibraryProject(tree, projectConfig) {
221
+ return ((0, ts_solution_setup_1.getProjectType)(tree, projectConfig.root, projectConfig.projectType) ===
222
+ 'library' &&
221
223
  projectConfig.targets?.build &&
222
224
  !!projectConfig.targets.build);
223
225
  }
@@ -5,6 +5,7 @@ exports.lintWorkspaceRulesProjectGenerator = lintWorkspaceRulesProjectGenerator;
5
5
  const devkit_1 = require("@nx/devkit");
6
6
  const js_1 = require("@nx/js");
7
7
  const add_swc_dependencies_1 = require("@nx/js/src/utils/swc/add-swc-dependencies");
8
+ const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
8
9
  const path_1 = require("path");
9
10
  const versions_1 = require("../../utils/versions");
10
11
  const workspace_lint_rules_1 = require("../../utils/workspace-lint-rules");
@@ -47,7 +48,7 @@ async function lintWorkspaceRulesProjectGenerator(tree, options = {}) {
47
48
  supportTsx: false,
48
49
  skipSerializers: true,
49
50
  setupFile: 'none',
50
- compiler: 'tsc',
51
+ compiler: (0, ts_solution_setup_1.isUsingTsSolutionSetup)(tree) ? 'swc' : 'tsc',
51
52
  skipFormat: true,
52
53
  }));
53
54
  (0, devkit_1.updateJson)(tree, (0, path_1.join)(workspace_lint_rules_1.workspaceLintPluginDir, 'tsconfig.spec.json'), (json) => {
@@ -13,7 +13,18 @@ const semver_1 = require("semver");
13
13
  const config_file_1 = require("../utils/config-file");
14
14
  const resolve_eslint_class_1 = require("../utils/resolve-eslint-class");
15
15
  const pmc = (0, devkit_1.getPackageManagerCommand)();
16
- const DEFAULT_EXTENSIONS = ['ts', 'tsx', 'js', 'jsx', 'html', 'vue'];
16
+ const DEFAULT_EXTENSIONS = [
17
+ 'ts',
18
+ 'cts',
19
+ 'mts',
20
+ 'tsx',
21
+ 'js',
22
+ 'cjs',
23
+ 'mjs',
24
+ 'jsx',
25
+ 'html',
26
+ 'vue',
27
+ ];
17
28
  const PROJECT_CONFIG_FILENAMES = ['project.json', 'package.json'];
18
29
  const ESLINT_CONFIG_GLOB_V1 = (0, globs_1.combineGlobPatterns)(config_file_1.ESLINT_CONFIG_FILENAMES.map((f) => `**/${f}`));
19
30
  const ESLINT_CONFIG_GLOB_V2 = (0, globs_1.combineGlobPatterns)([