@nx/eslint-plugin 16.8.0-rc.0 → 16.9.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.9.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,9 +33,9 @@
|
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@nrwl/eslint-plugin-nx": "16.
|
|
37
|
-
"@nx/devkit": "16.
|
|
38
|
-
"@nx/js": "16.
|
|
36
|
+
"@nrwl/eslint-plugin-nx": "16.9.0-beta.0",
|
|
37
|
+
"@nx/devkit": "16.9.0-beta.0",
|
|
38
|
+
"@nx/js": "16.9.0-beta.0",
|
|
39
39
|
"@typescript-eslint/type-utils": "^5.60.1",
|
|
40
40
|
"@typescript-eslint/utils": "^5.60.1",
|
|
41
41
|
"chalk": "^4.1.0",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"migrations": "./migrations.json"
|
|
52
52
|
},
|
|
53
53
|
"type": "commonjs",
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "822fb12c3f0bbaeb6d4a6fbc6cb1064a291e907f"
|
|
55
55
|
}
|
|
@@ -84,8 +84,7 @@ exports.default = (0, create_eslint_rule_1.createESLintRule)({
|
|
|
84
84
|
});
|
|
85
85
|
const expectedDependencyNames = Object.keys(npmDependencies);
|
|
86
86
|
const projPackageJsonPath = (0, path_1.join)(devkit_1.workspaceRoot, sourceProject.data.root, 'package.json');
|
|
87
|
-
|
|
88
|
-
const projPackageJsonDeps = globalThis.projPackageJsonDeps;
|
|
87
|
+
const projPackageJsonDeps = (0, package_json_utils_1.getProductionDependencies)(projPackageJsonPath);
|
|
89
88
|
const rootPackageJsonDeps = (0, package_json_utils_1.getAllDependencies)(rootPackageJson);
|
|
90
89
|
function validateMissingDependencies(node) {
|
|
91
90
|
if (!checkMissingDependencies) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { PackageJson } from 'nx/src/utils/package-json';
|
|
2
2
|
export declare function getAllDependencies(packageJson: PackageJson): Record<string, string>;
|
|
3
|
-
export declare function getProductionDependencies(
|
|
3
|
+
export declare function getProductionDependencies(packageJsonPath: string): Record<string, string>;
|
|
4
4
|
export declare function getPackageJson(path: string): PackageJson;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getPackageJson = exports.getProductionDependencies = exports.getAllDependencies = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const fs_1 = require("fs");
|
|
6
|
+
const runtime_lint_utils_1 = require("./runtime-lint-utils");
|
|
6
7
|
function getAllDependencies(packageJson) {
|
|
7
8
|
return {
|
|
8
9
|
...packageJson.dependencies,
|
|
@@ -12,12 +13,16 @@ function getAllDependencies(packageJson) {
|
|
|
12
13
|
};
|
|
13
14
|
}
|
|
14
15
|
exports.getAllDependencies = getAllDependencies;
|
|
15
|
-
function getProductionDependencies(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
function getProductionDependencies(packageJsonPath) {
|
|
17
|
+
if (!globalThis.projPackageJsonDeps || !(0, runtime_lint_utils_1.isTerminalRun)()) {
|
|
18
|
+
const packageJson = getPackageJson(packageJsonPath);
|
|
19
|
+
globalThis.projPackageJsonDeps = {
|
|
20
|
+
...packageJson.dependencies,
|
|
21
|
+
...packageJson.peerDependencies,
|
|
22
|
+
...packageJson.optionalDependencies,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
return globalThis.projPackageJsonDeps;
|
|
21
26
|
}
|
|
22
27
|
exports.getProductionDependencies = getProductionDependencies;
|
|
23
28
|
function getPackageJson(path) {
|
|
@@ -13,22 +13,22 @@ function ensureGlobalProjectGraph(ruleName) {
|
|
|
13
13
|
* Only reuse graph when running from terminal
|
|
14
14
|
* Enforce every IDE change to get a fresh nxdeps.json
|
|
15
15
|
*/
|
|
16
|
-
if (!
|
|
17
|
-
!
|
|
18
|
-
!
|
|
16
|
+
if (!globalThis.projectGraph ||
|
|
17
|
+
!globalThis.projectRootMappings ||
|
|
18
|
+
!globalThis.projectFileMap ||
|
|
19
19
|
!(0, runtime_lint_utils_1.isTerminalRun)()) {
|
|
20
20
|
const nxJson = (0, configuration_1.readNxJson)();
|
|
21
|
-
|
|
21
|
+
globalThis.workspaceLayout = nxJson.workspaceLayout;
|
|
22
22
|
/**
|
|
23
23
|
* Because there are a number of ways in which the rule can be invoked (executor vs ESLint CLI vs IDE Plugin),
|
|
24
24
|
* the ProjectGraph may or may not exist by the time the lint rule is invoked for the first time.
|
|
25
25
|
*/
|
|
26
26
|
try {
|
|
27
27
|
const projectGraph = (0, devkit_1.readCachedProjectGraph)();
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
globalThis.projectGraph = projectGraph;
|
|
29
|
+
globalThis.projectRootMappings = (0, find_project_for_path_1.createProjectRootMappings)(projectGraph.nodes);
|
|
30
|
+
globalThis.projectFileMap = (0, nx_deps_cache_1.readProjectFileMapCache)().projectFileMap;
|
|
31
|
+
globalThis.targetProjectLocator = new internal_1.TargetProjectLocator(projectGraph.nodes, projectGraph.externalNodes);
|
|
32
32
|
}
|
|
33
33
|
catch {
|
|
34
34
|
const WARNING_PREFIX = `${chalk.reset.keyword('orange')('warning')}`;
|
|
@@ -44,10 +44,10 @@ exports.ensureGlobalProjectGraph = ensureGlobalProjectGraph;
|
|
|
44
44
|
function readProjectGraph(ruleName) {
|
|
45
45
|
ensureGlobalProjectGraph(ruleName);
|
|
46
46
|
return {
|
|
47
|
-
projectGraph:
|
|
48
|
-
projectFileMap:
|
|
49
|
-
projectRootMappings:
|
|
50
|
-
targetProjectLocator:
|
|
47
|
+
projectGraph: globalThis.projectGraph,
|
|
48
|
+
projectFileMap: globalThis.projectFileMap,
|
|
49
|
+
projectRootMappings: globalThis.projectRootMappings,
|
|
50
|
+
targetProjectLocator: globalThis.targetProjectLocator,
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
53
|
exports.readProjectGraph = readProjectGraph;
|