@nx/eslint-plugin 21.0.0-beta.1 → 21.0.0-beta.2

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-plugin",
3
- "version": "21.0.0-beta.1",
3
+ "version": "21.0.0-beta.2",
4
4
  "private": false,
5
5
  "description": "The eslint-plugin package is an ESLint plugin that contains a collection of recommended ESLint rule configurations which you can extend from in your own ESLint configs, as well as an Nx-specific lint rule called enforce-module-boundaries.",
6
6
  "repository": {
@@ -26,7 +26,7 @@
26
26
  "homepage": "https://nx.dev",
27
27
  "peerDependencies": {
28
28
  "@typescript-eslint/parser": "^6.13.2 || ^7.0.0 || ^8.0.0",
29
- "eslint-config-prettier": "^9.0.0"
29
+ "eslint-config-prettier": "^10.0.0"
30
30
  },
31
31
  "peerDependenciesMeta": {
32
32
  "eslint-config-prettier": {
@@ -34,8 +34,8 @@
34
34
  }
35
35
  },
36
36
  "dependencies": {
37
- "@nx/devkit": "21.0.0-beta.1",
38
- "@nx/js": "21.0.0-beta.1",
37
+ "@nx/devkit": "21.0.0-beta.2",
38
+ "@nx/js": "21.0.0-beta.2",
39
39
  "@typescript-eslint/type-utils": "^8.0.0",
40
40
  "@typescript-eslint/utils": "^8.0.0",
41
41
  "chalk": "^4.1.0",
@@ -9,6 +9,7 @@ export type Options = [
9
9
  ignoredFiles?: string[];
10
10
  includeTransitiveDependencies?: boolean;
11
11
  useLocalPathsForWorkspaceDependencies?: boolean;
12
+ runtimeHelpers?: string[];
12
13
  }
13
14
  ];
14
15
  export type MessageIds = 'missingDependency' | 'obsoleteDependency' | 'versionMismatch' | 'missingDependencySection';
@@ -30,6 +30,7 @@ exports.default = utils_1.ESLintUtils.RuleCreator(() => `https://github.com/nrwl
30
30
  checkVersionMismatches: { type: 'boolean' },
31
31
  includeTransitiveDependencies: { type: 'boolean' },
32
32
  useLocalPathsForWorkspaceDependencies: { type: 'boolean' },
33
+ runtimeHelpers: { type: 'array', items: { type: 'string' } },
33
34
  },
34
35
  additionalProperties: false,
35
36
  },
@@ -51,9 +52,10 @@ exports.default = utils_1.ESLintUtils.RuleCreator(() => `https://github.com/nrwl
51
52
  ignoredFiles: [],
52
53
  includeTransitiveDependencies: false,
53
54
  useLocalPathsForWorkspaceDependencies: false,
55
+ runtimeHelpers: [],
54
56
  },
55
57
  ],
56
- create(context, [{ buildTargets, ignoredDependencies, ignoredFiles, checkMissingDependencies, checkObsoleteDependencies, checkVersionMismatches, includeTransitiveDependencies, useLocalPathsForWorkspaceDependencies, },]) {
58
+ create(context, [{ buildTargets, ignoredDependencies, ignoredFiles, checkMissingDependencies, checkObsoleteDependencies, checkVersionMismatches, includeTransitiveDependencies, useLocalPathsForWorkspaceDependencies, runtimeHelpers, },]) {
57
59
  if (!(0, runtime_lint_utils_1.getParserServices)(context).isJSON) {
58
60
  return {};
59
61
  }
@@ -83,6 +85,7 @@ exports.default = utils_1.ESLintUtils.RuleCreator(() => `https://github.com/nrwl
83
85
  includeTransitiveDependencies,
84
86
  ignoredFiles,
85
87
  useLocalPathsForWorkspaceDependencies,
88
+ runtimeHelpers,
86
89
  });
87
90
  const expectedDependencyNames = Object.keys(npmDependencies);
88
91
  const packageJson = JSON.parse(context.sourceCode.getText());
@@ -129,7 +132,13 @@ exports.default = utils_1.ESLintUtils.RuleCreator(() => `https://github.com/nrwl
129
132
  packageRange.startsWith('file:') ||
130
133
  npmDependencies[packageName] === '*' ||
131
134
  packageRange === '*' ||
132
- packageRange === 'workspace:*' ||
135
+ packageRange.startsWith('workspace:') ||
136
+ /**
137
+ * Catalogs can be named, or left unnamed
138
+ * So just checking up until the : will catch both cases
139
+ * e.g. catalog:some-catalog or catalog:
140
+ */
141
+ packageRange.startsWith('catalog:') ||
133
142
  (0, semver_1.satisfies)(npmDependencies[packageName], packageRange, {
134
143
  includePrerelease: true,
135
144
  })) {
@@ -10,6 +10,7 @@ const ast_utils_1 = require("../utils/ast-utils");
10
10
  const graph_utils_1 = require("../utils/graph-utils");
11
11
  const project_graph_utils_1 = require("../utils/project-graph-utils");
12
12
  const runtime_lint_utils_1 = require("../utils/runtime-lint-utils");
13
+ const project_graph_1 = require("nx/src/config/project-graph");
13
14
  exports.RULE_NAME = 'enforce-module-boundaries';
14
15
  exports.default = utils_1.ESLintUtils.RuleCreator(() => `https://github.com/nrwl/nx/blob/${devkit_1.NX_VERSION}/docs/generated/packages/eslint-plugin/documents/enforce-module-boundaries.md`)({
15
16
  name: exports.RULE_NAME,
@@ -328,6 +329,10 @@ exports.default = utils_1.ESLintUtils.RuleCreator(() => `https://github.com/nrwl
328
329
  }
329
330
  return;
330
331
  }
332
+ if (!(0, project_graph_1.isProjectGraphProjectNode)(targetProject)) {
333
+ return;
334
+ }
335
+ targetProject = targetProject;
331
336
  // check constraints between libs and apps
332
337
  // check for circular dependency
333
338
  const circularPath = (0, graph_utils_1.checkCircularPath)(projectGraph, sourceProject, targetProject);