@nx/eslint-plugin 19.2.0-beta.1 → 19.2.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": "19.2.0-beta.
|
|
3
|
+
"version": "19.2.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": {
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@nx/devkit": "19.2.0-beta.
|
|
38
|
-
"@nx/js": "19.2.0-beta.
|
|
37
|
+
"@nx/devkit": "19.2.0-beta.2",
|
|
38
|
+
"@nx/js": "19.2.0-beta.2",
|
|
39
39
|
"@typescript-eslint/type-utils": "^7.3.0",
|
|
40
40
|
"@typescript-eslint/utils": "^7.3.0",
|
|
41
41
|
"chalk": "^4.1.0",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"jsonc-eslint-parser": "^2.1.0",
|
|
44
44
|
"semver": "^7.5.3",
|
|
45
45
|
"tslib": "^2.3.0",
|
|
46
|
-
"@nrwl/eslint-plugin-nx": "19.2.0-beta.
|
|
46
|
+
"@nrwl/eslint-plugin-nx": "19.2.0-beta.2"
|
|
47
47
|
},
|
|
48
48
|
"publishConfig": {
|
|
49
49
|
"access": "public"
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RULE_NAME = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const fileutils_1 = require("nx/src/utils/fileutils");
|
|
6
|
-
const graph_utils_1 = require("../utils/graph-utils");
|
|
7
|
-
const runtime_lint_utils_1 = require("../utils/runtime-lint-utils");
|
|
8
5
|
const utils_1 = require("@typescript-eslint/utils");
|
|
6
|
+
const internal_1 = require("@nx/js/src/internal");
|
|
7
|
+
const fileutils_1 = require("nx/src/utils/fileutils");
|
|
9
8
|
const path_1 = require("path");
|
|
10
9
|
const ast_utils_1 = require("../utils/ast-utils");
|
|
10
|
+
const graph_utils_1 = require("../utils/graph-utils");
|
|
11
11
|
const project_graph_utils_1 = require("../utils/project-graph-utils");
|
|
12
|
-
const
|
|
12
|
+
const runtime_lint_utils_1 = require("../utils/runtime-lint-utils");
|
|
13
13
|
exports.RULE_NAME = 'enforce-module-boundaries';
|
|
14
|
-
exports.default =
|
|
14
|
+
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
15
|
name: exports.RULE_NAME,
|
|
16
16
|
meta: {
|
|
17
17
|
type: 'suggestion',
|
|
@@ -107,7 +107,7 @@ exports.default = utils_2.ESLintUtils.RuleCreator(() => `https://github.com/nrwl
|
|
|
107
107
|
projectWithoutTagsCannotHaveDependencies: `A project without tags matching at least one constraint cannot depend on any libraries`,
|
|
108
108
|
bannedExternalImportsViolation: `A project tagged with "{{sourceTag}}" is not allowed to import "{{imp}}"`,
|
|
109
109
|
nestedBannedExternalImportsViolation: `A project tagged with "{{sourceTag}}" is not allowed to import "{{imp}}". Nested import found at {{childProjectName}}`,
|
|
110
|
-
noTransitiveDependencies: `
|
|
110
|
+
noTransitiveDependencies: `Only packages defined in the "package.json" can be imported. Transitive or unresolvable dependencies are not allowed.`,
|
|
111
111
|
onlyTagsConstraintViolation: `A project tagged with "{{sourceTag}}" can only depend on libs tagged with {{tags}}`,
|
|
112
112
|
emptyOnlyTagsConstraintViolation: 'A project tagged with "{{sourceTag}}" cannot depend on any libs with tags',
|
|
113
113
|
notTagsConstraintViolation: `A project tagged with "{{sourceTag}}" can not depend on libs tagged with {{tags}}\n\nViolation detected in:\n{{projects}}`,
|
|
@@ -217,6 +217,20 @@ exports.default = utils_2.ESLintUtils.RuleCreator(() => `https://github.com/nrwl
|
|
|
217
217
|
messageId: 'noRelativeOrAbsoluteExternals',
|
|
218
218
|
});
|
|
219
219
|
}
|
|
220
|
+
else if (banTransitiveDependencies && !(0, internal_1.isBuiltinModuleImport)(imp)) {
|
|
221
|
+
/**
|
|
222
|
+
* At this point, the target project could not be found in the project graph, and it is not a relative or absolute import.
|
|
223
|
+
* Therefore it could be an external/npm package dependency (but not a node built in module) which has not yet been installed
|
|
224
|
+
* in the workspace.
|
|
225
|
+
*
|
|
226
|
+
* If the banTransitiveDependencies option is enabled, we should flag this case as an error because the user is trying to
|
|
227
|
+
* depend on something which is not explicitly defined/resolvable on disk for their project.
|
|
228
|
+
*/
|
|
229
|
+
context.report({
|
|
230
|
+
node,
|
|
231
|
+
messageId: 'noTransitiveDependencies',
|
|
232
|
+
});
|
|
233
|
+
}
|
|
220
234
|
// If target is not found (including node internals) we bail early
|
|
221
235
|
return;
|
|
222
236
|
}
|
|
@@ -109,7 +109,7 @@ function isAbsoluteImportIntoAnotherProject(imp, workspaceLayout = { libsDir: 'l
|
|
|
109
109
|
}
|
|
110
110
|
exports.isAbsoluteImportIntoAnotherProject = isAbsoluteImportIntoAnotherProject;
|
|
111
111
|
function findProjectUsingImport(projectGraph, targetProjectLocator, filePath, imp) {
|
|
112
|
-
const target = targetProjectLocator.
|
|
112
|
+
const target = targetProjectLocator.findProjectFromImport(imp, filePath);
|
|
113
113
|
return projectGraph.nodes[target] || projectGraph.externalNodes?.[target];
|
|
114
114
|
}
|
|
115
115
|
exports.findProjectUsingImport = findProjectUsingImport;
|