@nx/eslint 17.2.0-beta.4 → 17.2.0-beta.5

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": "17.2.0-beta.4",
3
+ "version": "17.2.0-beta.5",
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,10 +35,10 @@
35
35
  },
36
36
  "dependencies": {
37
37
  "tslib": "^2.3.0",
38
- "@nx/devkit": "17.2.0-beta.4",
39
- "@nx/js": "17.2.0-beta.4",
38
+ "@nx/devkit": "17.2.0-beta.5",
39
+ "@nx/js": "17.2.0-beta.5",
40
40
  "typescript": "~5.2.2",
41
- "@nx/linter": "17.2.0-beta.4"
41
+ "@nx/linter": "17.2.0-beta.5"
42
42
  },
43
43
  "peerDependenciesMeta": {
44
44
  "eslint": {
@@ -58,7 +58,7 @@ async function lintProjectGenerator(tree, options) {
58
58
  // additionally, the companion e2e app would have `rootProject: true`
59
59
  // so we need to check for the root path as well
60
60
  if (!options.rootProject || projectConfig.root !== '.') {
61
- createEsLintConfiguration(tree, projectConfig, options.setParserOptionsProject);
61
+ createEsLintConfiguration(tree, projectConfig, options.setParserOptionsProject, options.rootProject);
62
62
  }
63
63
  // Buildable libs need source analysis enabled for linting `package.json`.
64
64
  if (isBuildableLibraryProject(projectConfig) &&
@@ -77,10 +77,11 @@ async function lintProjectGenerator(tree, options) {
77
77
  return installTask;
78
78
  }
79
79
  exports.lintProjectGenerator = lintProjectGenerator;
80
- function createEsLintConfiguration(tree, projectConfig, setParserOptionsProject) {
81
- const eslintConfig = (0, eslint_file_1.findEslintFile)(tree);
82
- const pathToRootConfig = eslintConfig
83
- ? `${(0, devkit_1.offsetFromRoot)(projectConfig.root)}${eslintConfig}`
80
+ function createEsLintConfiguration(tree, projectConfig, setParserOptionsProject, rootProject) {
81
+ // we are only extending root for non-standalone projects or their complementary e2e apps
82
+ const extendedRootConfig = rootProject ? undefined : (0, eslint_file_1.findEslintFile)(tree);
83
+ const pathToRootConfig = extendedRootConfig
84
+ ? `${(0, devkit_1.offsetFromRoot)(projectConfig.root)}${extendedRootConfig}`
84
85
  : undefined;
85
86
  const addDependencyChecks = isBuildableLibraryProject(projectConfig);
86
87
  const overrides = [
@@ -132,7 +133,7 @@ function createEsLintConfiguration(tree, projectConfig, setParserOptionsProject)
132
133
  const isCompatNeeded = addDependencyChecks;
133
134
  const nodes = [];
134
135
  const importMap = new Map();
135
- if (eslintConfig) {
136
+ if (extendedRootConfig) {
136
137
  importMap.set(pathToRootConfig, 'baseConfig');
137
138
  nodes.push((0, ast_utils_1.generateSpreadElement)('baseConfig'));
138
139
  }
@@ -145,7 +146,7 @@ function createEsLintConfiguration(tree, projectConfig, setParserOptionsProject)
145
146
  }
146
147
  else {
147
148
  (0, devkit_1.writeJson)(tree, (0, path_1.join)(projectConfig.root, `.eslintrc.json`), {
148
- extends: eslintConfig ? [pathToRootConfig] : undefined,
149
+ extends: extendedRootConfig ? [pathToRootConfig] : undefined,
149
150
  // Include project files to be linted since the global one excludes all files.
150
151
  ignorePatterns: ['!**/*'],
151
152
  overrides,