@monorepolint/rules 0.5.0-alpha.68 → 0.5.0-alpha.69
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.
|
@@ -81,15 +81,22 @@ function checkTransitives(context,
|
|
|
81
81
|
bannedDependencies) {
|
|
82
82
|
const graphService = new packageDependencyGraphService_1.PackageDependencyGraphService();
|
|
83
83
|
const root = graphService.buildDependencyGraph(path_1.default.resolve(context.getPackageJsonPath()));
|
|
84
|
-
for (const { dependencies } of graphService.traverse(root)) {
|
|
85
|
-
for (const [dependency
|
|
84
|
+
for (const { dependencies, importPath } of graphService.traverse(root)) {
|
|
85
|
+
for (const [dependency] of dependencies) {
|
|
86
86
|
if (bannedDependencies.includes(dependency)) {
|
|
87
|
+
// Remove the starting package since it's obvious in CLI output.
|
|
88
|
+
const [, ...importPathWithoutRoot] = importPath;
|
|
89
|
+
const pathing = [...importPathWithoutRoot.map(nameOrPackageJsonPath), dependency].join(" -> ");
|
|
87
90
|
context.addError({
|
|
88
|
-
file:
|
|
89
|
-
message: `Banned transitive dependencies in repo: ${
|
|
91
|
+
file: root.paths.packageJsonPath,
|
|
92
|
+
message: `Banned transitive dependencies in repo: ${pathing}`,
|
|
90
93
|
});
|
|
91
94
|
}
|
|
92
95
|
}
|
|
93
96
|
}
|
|
94
97
|
}
|
|
98
|
+
function nameOrPackageJsonPath(node) {
|
|
99
|
+
var _a;
|
|
100
|
+
return (_a = node.packageJson.name) !== null && _a !== void 0 ? _a : node.paths.packageJsonPath;
|
|
101
|
+
}
|
|
95
102
|
//# sourceMappingURL=bannedDependencies.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bannedDependencies.js","sourceRoot":"","sources":["../src/bannedDependencies.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;AAGH,+CAAgD;AAChD,kEAA6B;AAC7B,kEAAkC;AAClC,wDAAwB;AACxB,oDAA8B;AAC9B,
|
|
1
|
+
{"version":3,"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WAAW,EAAE,cAAc,CAAC,CAAC;YACzC,CAAC;SACF,CAAC,CAAC;KACJ;AACH,CAAC;AAED,SAAS,gBAAgB,CACvB,OAAgB;AAChB,iDAAiD;AACjD,kBAAyC;IAEzC,MAAM,YAAY,GAAG,IAAI,6DAA6B,EAAE,CAAC;IACzD,MAAM,IAAI,GAAG,YAAY,CAAC,oBAAoB,CAAC,cAAI,CAAC,OAAO,CAAC,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAC;IAC3F,KAAK,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,IAAI,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;QACtE,KAAK,MAAM,CAAC,UAAU,CAAC,IAAI,YAAY,EAAE;YACvC,IAAI,kBAAkB,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE;gBAC3C,gEAAgE;gBAChE,MAAM,CAAC,EAAE,GAAG,qBAAqB,CAAC,GAAG,UAAU,CAAC;gBAChD,MAAM,OAAO,GAAG,CAAC,GAAG,qBAAqB,CAAC,GAAG,CAAC,qBAAqB,CAAC,EAAE,UAAU,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;gBAE/F,OAAO,CAAC,QAAQ,CAAC;oBACf,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,eAAe;oBAChC,OAAO,EAAE,2CAA2C,OAAO,EAAE;iBAC9D,CAAC,CAAC;aACJ;SACF;KACF;AACH,CAAC;AAED,SAAS,qBAAqB,CAAC,IAAiC;;IAC9D,aAAO,IAAI,CAAC,WAAW,CAAC,IAAI,mCAAI,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC;AAC7D,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monorepolint/rules",
|
|
3
|
-
"version": "0.5.0-alpha.
|
|
3
|
+
"version": "0.5.0-alpha.69+d381011",
|
|
4
4
|
"author": "Eric L Anderson (https://github.com/ericanderson)",
|
|
5
5
|
"contributors": [
|
|
6
6
|
"Mac Lockard (https://github.com/maclockard)"
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"test:watch": "../../node_modules/.bin/jest --colors --passWithNoTests --watch"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@monorepolint/core": "^0.5.0-alpha.
|
|
23
|
-
"@monorepolint/utils": "^0.5.0-alpha.
|
|
22
|
+
"@monorepolint/core": "^0.5.0-alpha.69+d381011",
|
|
23
|
+
"@monorepolint/utils": "^0.5.0-alpha.69+d381011",
|
|
24
24
|
"globby": "^11.0.1",
|
|
25
25
|
"jest-diff": "^26.0.1",
|
|
26
26
|
"minimatch": "^3.0.4",
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"publishConfig": {
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "d38101185500e45e3cec4f5c5355d6f1b0493c1d"
|
|
42
42
|
}
|
|
@@ -11,7 +11,7 @@ import diff from "jest-diff";
|
|
|
11
11
|
import minimatch from "minimatch";
|
|
12
12
|
import path from "path";
|
|
13
13
|
import * as r from "runtypes";
|
|
14
|
-
import { PackageDependencyGraphService } from "./util/packageDependencyGraphService";
|
|
14
|
+
import { IPackageDependencyGraphNode, PackageDependencyGraphService } from "./util/packageDependencyGraphService";
|
|
15
15
|
|
|
16
16
|
const Options = r.Union(
|
|
17
17
|
r
|
|
@@ -106,14 +106,22 @@ function checkTransitives(
|
|
|
106
106
|
) {
|
|
107
107
|
const graphService = new PackageDependencyGraphService();
|
|
108
108
|
const root = graphService.buildDependencyGraph(path.resolve(context.getPackageJsonPath()));
|
|
109
|
-
for (const { dependencies } of graphService.traverse(root)) {
|
|
110
|
-
for (const [dependency
|
|
109
|
+
for (const { dependencies, importPath } of graphService.traverse(root)) {
|
|
110
|
+
for (const [dependency] of dependencies) {
|
|
111
111
|
if (bannedDependencies.includes(dependency)) {
|
|
112
|
+
// Remove the starting package since it's obvious in CLI output.
|
|
113
|
+
const [, ...importPathWithoutRoot] = importPath;
|
|
114
|
+
const pathing = [...importPathWithoutRoot.map(nameOrPackageJsonPath), dependency].join(" -> ");
|
|
115
|
+
|
|
112
116
|
context.addError({
|
|
113
|
-
file:
|
|
114
|
-
message: `Banned transitive dependencies in repo: ${
|
|
117
|
+
file: root.paths.packageJsonPath,
|
|
118
|
+
message: `Banned transitive dependencies in repo: ${pathing}`,
|
|
115
119
|
});
|
|
116
120
|
}
|
|
117
121
|
}
|
|
118
122
|
}
|
|
119
123
|
}
|
|
124
|
+
|
|
125
|
+
function nameOrPackageJsonPath(node: IPackageDependencyGraphNode): string {
|
|
126
|
+
return node.packageJson.name ?? node.paths.packageJsonPath;
|
|
127
|
+
}
|
package/tsconfig.tsbuildinfo
CHANGED
|
@@ -425,7 +425,7 @@
|
|
|
425
425
|
"affectsGlobalScope": false
|
|
426
426
|
},
|
|
427
427
|
"./src/bannedDependencies.ts": {
|
|
428
|
-
"version": "
|
|
428
|
+
"version": "2d87e1012d24a2cb029630e49ec33fd75c4eafc66adf27f5aa83498ca0dc4ee6",
|
|
429
429
|
"signature": "95a9767bd6498e6fff1a07abd14a94c7f333b37ed391fe8837f03e098b028b0d",
|
|
430
430
|
"affectsGlobalScope": false
|
|
431
431
|
},
|