@nx/eslint-plugin 16.9.0 → 16.10.0-beta.0
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/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
[]()
|
|
9
9
|
[](http://commitizen.github.io/cz-cli/)
|
|
10
10
|
[](https://gitter.im/nrwl-nx/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
|
11
|
-
[](https://go.nx.dev/community)
|
|
12
12
|
|
|
13
13
|
</div>
|
|
14
14
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/eslint-plugin",
|
|
3
|
-
"version": "16.
|
|
3
|
+
"version": "16.10.0-beta.0",
|
|
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": {
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@nx/devkit": "16.
|
|
37
|
-
"@nx/js": "16.
|
|
36
|
+
"@nx/devkit": "16.10.0-beta.0",
|
|
37
|
+
"@nx/js": "16.10.0-beta.0",
|
|
38
38
|
"@typescript-eslint/type-utils": "^5.60.1",
|
|
39
39
|
"@typescript-eslint/utils": "^5.60.1",
|
|
40
40
|
"chalk": "^4.1.0",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"jsonc-eslint-parser": "^2.1.0",
|
|
43
43
|
"semver": "7.5.3",
|
|
44
44
|
"tslib": "^2.3.0",
|
|
45
|
-
"@nrwl/eslint-plugin-nx": "
|
|
45
|
+
"@nrwl/eslint-plugin-nx": "16.10.0-beta.0"
|
|
46
46
|
},
|
|
47
47
|
"publishConfig": {
|
|
48
48
|
"access": "public"
|
|
@@ -23,9 +23,9 @@ exports.default = (0, create_eslint_rule_1.createESLintRule)({
|
|
|
23
23
|
{
|
|
24
24
|
type: 'object',
|
|
25
25
|
properties: {
|
|
26
|
-
buildTargets:
|
|
27
|
-
ignoredDependencies:
|
|
28
|
-
ignoredFiles:
|
|
26
|
+
buildTargets: { type: 'array', items: { type: 'string' } },
|
|
27
|
+
ignoredDependencies: { type: 'array', items: { type: 'string' } },
|
|
28
|
+
ignoredFiles: { type: 'array', items: { type: 'string' } },
|
|
29
29
|
checkMissingDependencies: { type: 'boolean' },
|
|
30
30
|
checkObsoleteDependencies: { type: 'boolean' },
|
|
31
31
|
checkVersionMismatches: { type: 'boolean' },
|
|
@@ -26,33 +26,71 @@ exports.default = (0, create_eslint_rule_1.createESLintRule)({
|
|
|
26
26
|
properties: {
|
|
27
27
|
enforceBuildableLibDependency: { type: 'boolean' },
|
|
28
28
|
allowCircularSelfDependency: { type: 'boolean' },
|
|
29
|
-
checkDynamicDependenciesExceptions:
|
|
29
|
+
checkDynamicDependenciesExceptions: {
|
|
30
|
+
type: 'array',
|
|
31
|
+
items: { type: 'string' },
|
|
32
|
+
},
|
|
30
33
|
banTransitiveDependencies: { type: 'boolean' },
|
|
31
34
|
checkNestedExternalImports: { type: 'boolean' },
|
|
32
|
-
allow:
|
|
33
|
-
buildTargets:
|
|
34
|
-
depConstraints:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
{
|
|
35
|
+
allow: { type: 'array', items: { type: 'string' } },
|
|
36
|
+
buildTargets: { type: 'array', items: { type: 'string' } },
|
|
37
|
+
depConstraints: {
|
|
38
|
+
type: 'array',
|
|
39
|
+
items: {
|
|
40
|
+
oneOf: [
|
|
41
|
+
{
|
|
42
|
+
type: 'object',
|
|
43
|
+
properties: {
|
|
44
|
+
sourceTag: { type: 'string' },
|
|
45
|
+
onlyDependOnLibsWithTags: {
|
|
46
|
+
type: 'array',
|
|
47
|
+
items: { type: 'string' },
|
|
48
|
+
},
|
|
49
|
+
allowedExternalImports: {
|
|
50
|
+
type: 'array',
|
|
51
|
+
items: { type: 'string' },
|
|
52
|
+
},
|
|
53
|
+
bannedExternalImports: {
|
|
54
|
+
type: 'array',
|
|
55
|
+
items: { type: 'string' },
|
|
56
|
+
},
|
|
57
|
+
notDependOnLibsWithTags: {
|
|
58
|
+
type: 'array',
|
|
59
|
+
items: { type: 'string' },
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
additionalProperties: false,
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
type: 'object',
|
|
66
|
+
properties: {
|
|
41
67
|
allSourceTags: {
|
|
42
68
|
type: 'array',
|
|
43
69
|
items: { type: 'string' },
|
|
44
70
|
minItems: 2,
|
|
45
71
|
},
|
|
72
|
+
onlyDependOnLibsWithTags: {
|
|
73
|
+
type: 'array',
|
|
74
|
+
items: { type: 'string' },
|
|
75
|
+
},
|
|
76
|
+
allowedExternalImports: {
|
|
77
|
+
type: 'array',
|
|
78
|
+
items: { type: 'string' },
|
|
79
|
+
},
|
|
80
|
+
bannedExternalImports: {
|
|
81
|
+
type: 'array',
|
|
82
|
+
items: { type: 'string' },
|
|
83
|
+
},
|
|
84
|
+
notDependOnLibsWithTags: {
|
|
85
|
+
type: 'array',
|
|
86
|
+
items: { type: 'string' },
|
|
87
|
+
},
|
|
46
88
|
},
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
bannedExternalImports: [{ type: 'string' }],
|
|
51
|
-
notDependOnLibsWithTags: [{ type: 'string' }],
|
|
52
|
-
},
|
|
53
|
-
additionalProperties: false,
|
|
89
|
+
additionalProperties: false,
|
|
90
|
+
},
|
|
91
|
+
],
|
|
54
92
|
},
|
|
55
|
-
|
|
93
|
+
},
|
|
56
94
|
},
|
|
57
95
|
additionalProperties: false,
|
|
58
96
|
},
|
|
@@ -284,7 +322,7 @@ exports.default = (0, create_eslint_rule_1.createESLintRule)({
|
|
|
284
322
|
return;
|
|
285
323
|
}
|
|
286
324
|
// cannot import apps
|
|
287
|
-
if (targetProject.type === 'app') {
|
|
325
|
+
if (targetProject.type === 'app' && !(0, runtime_lint_utils_1.appIsMFERemote)(targetProject)) {
|
|
288
326
|
context.report({
|
|
289
327
|
node,
|
|
290
328
|
messageId: 'noImportsOfApps',
|
|
@@ -24,7 +24,7 @@ exports.default = (0, create_eslint_rule_1.createESLintRule)({
|
|
|
24
24
|
description: 'Checks common nx-plugin configuration files for validity',
|
|
25
25
|
recommended: 'error',
|
|
26
26
|
},
|
|
27
|
-
schema:
|
|
27
|
+
schema: [],
|
|
28
28
|
type: 'problem',
|
|
29
29
|
messages: {
|
|
30
30
|
invalidSchemaPath: 'Schema path should point to a valid file',
|
|
@@ -83,4 +83,8 @@ export declare function groupImports(importsToRemap: {
|
|
|
83
83
|
* @returns
|
|
84
84
|
*/
|
|
85
85
|
export declare function isAngularSecondaryEntrypoint(importExpr: string, filePath: string, projectRoot: string): boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Returns true if the given project contains MFE config with "exposes:" section
|
|
88
|
+
*/
|
|
89
|
+
export declare function appIsMFERemote(project: ProjectGraphProjectNode): boolean;
|
|
86
90
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isAngularSecondaryEntrypoint = exports.groupImports = exports.isTerminalRun = exports.hasBuildExecutor = exports.isDirectDependency = exports.hasBannedDependencies = exports.findTransitiveExternalDependencies = exports.hasBannedImport = exports.getSourceFilePath = exports.onlyLoadChildren = exports.findConstraintsFor = exports.findProjectUsingImport = exports.isAbsoluteImportIntoAnotherProject = exports.findProject = exports.getTargetProjectBasedOnRelativeImport = exports.isRelative = exports.matchImportWithWildcard = exports.findDependenciesWithTags = exports.isComboDepConstraint = exports.hasNoneOfTheseTags = exports.stringifyTags = void 0;
|
|
3
|
+
exports.appIsMFERemote = exports.isAngularSecondaryEntrypoint = exports.groupImports = exports.isTerminalRun = exports.hasBuildExecutor = exports.isDirectDependency = exports.hasBannedDependencies = exports.findTransitiveExternalDependencies = exports.hasBannedImport = exports.getSourceFilePath = exports.onlyLoadChildren = exports.findConstraintsFor = exports.findProjectUsingImport = exports.isAbsoluteImportIntoAnotherProject = exports.findProject = exports.getTargetProjectBasedOnRelativeImport = exports.isRelative = exports.matchImportWithWildcard = exports.findDependenciesWithTags = exports.isComboDepConstraint = exports.hasNoneOfTheseTags = exports.stringifyTags = void 0;
|
|
4
4
|
const path = require("path");
|
|
5
5
|
const path_1 = require("path");
|
|
6
6
|
const devkit_1 = require("@nx/devkit");
|
|
@@ -335,3 +335,15 @@ function fileIsSecondaryEntryPoint(file, projectRoot) {
|
|
|
335
335
|
}
|
|
336
336
|
return false;
|
|
337
337
|
}
|
|
338
|
+
/**
|
|
339
|
+
* Returns true if the given project contains MFE config with "exposes:" section
|
|
340
|
+
*/
|
|
341
|
+
function appIsMFERemote(project) {
|
|
342
|
+
const mfeConfig = (0, fileutils_1.readFileIfExisting)((0, devkit_1.joinPathFragments)(devkit_1.workspaceRoot, project.data.root, 'module-federation.config.js')) ||
|
|
343
|
+
(0, fileutils_1.readFileIfExisting)((0, devkit_1.joinPathFragments)(devkit_1.workspaceRoot, project.data.root, 'module-federation.config.ts'));
|
|
344
|
+
if (mfeConfig) {
|
|
345
|
+
return !!mfeConfig.match(/('|")?exposes('|")?:/);
|
|
346
|
+
}
|
|
347
|
+
return false;
|
|
348
|
+
}
|
|
349
|
+
exports.appIsMFERemote = appIsMFERemote;
|