@boll/rules-typescript
Advanced tools
Comparing version 0.0.1215 to 0.1.0
@@ -5,3 +5,18 @@ { | ||
{ | ||
"date": "Tue, 06 Oct 2020 16:15:31 GMT", | ||
"date": "Mon, 12 Oct 2020 17:53:05 GMT", | ||
"tag": "@boll/rules-typescript_v0.1.0", | ||
"version": "0.1.0", | ||
"comments": { | ||
"minor": [ | ||
{ | ||
"comment": "Allow-list for transitive dep detector", | ||
"author": "jdh@microsoft.com", | ||
"commit": "bcf3505f25ed36b2c687b02f9c8268fffb5d5412", | ||
"package": "@boll/rules-typescript" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"date": "Tue, 06 Oct 2020 16:15:51 GMT", | ||
"tag": "@boll/rules-typescript_v0.0.1215", | ||
@@ -8,0 +23,0 @@ "version": "0.0.1215", |
# Change Log - @boll/rules-typescript | ||
This log was last generated on Tue, 06 Oct 2020 16:15:31 GMT and should not be manually modified. | ||
This log was last generated on Mon, 12 Oct 2020 17:53:05 GMT and should not be manually modified. | ||
<!-- Start content --> | ||
## 0.1.0 | ||
Mon, 12 Oct 2020 17:53:05 GMT | ||
### Minor changes | ||
- Allow-list for transitive dep detector (jdh@microsoft.com) | ||
## 0.0.1215 | ||
Tue, 06 Oct 2020 16:15:31 GMT | ||
Tue, 06 Oct 2020 16:15:51 GMT | ||
@@ -11,0 +19,0 @@ ### Patches |
@@ -93,1 +93,10 @@ "use strict"; | ||
}); }); | ||
exports.test("Should allow any modules given to the constructor", function () { return __awaiter(void 0, void 0, void 0, function () { | ||
var sut; | ||
return __generator(this, function (_a) { | ||
sut = new transitive_dependency_detector_1.TransitiveDependencyDetector({ ignorePackages: ["util"] }); | ||
assert.ok(sut.isValidImport({}, "util")); | ||
assert.ok(!sut.isValidImport({}, "fs")); | ||
return [2 /*return*/]; | ||
}); | ||
}); }); |
import { DependencyMap, FileContext, ImportPathAndLineNumber, PackageRule, Result } from "@boll/core"; | ||
import { SourceFile } from "typescript"; | ||
export interface Options { | ||
ignorePackages: string[]; | ||
} | ||
/** | ||
@@ -16,2 +19,4 @@ * TransitiveDependencyDetector will detect usages of non direct dependencies | ||
export declare class TransitiveDependencyDetector implements PackageRule { | ||
private options; | ||
constructor(options?: Options); | ||
get name(): string; | ||
@@ -18,0 +23,0 @@ check(file: FileContext): Promise<Result[]>; |
@@ -43,2 +43,5 @@ "use strict"; | ||
var ruleName = "TransitiveDependencyDetector"; | ||
var defaultOptions = { | ||
ignorePackages: [] | ||
}; | ||
/** | ||
@@ -57,3 +60,5 @@ * TransitiveDependencyDetector will detect usages of non direct dependencies | ||
var TransitiveDependencyDetector = /** @class */ (function () { | ||
function TransitiveDependencyDetector() { | ||
function TransitiveDependencyDetector(options) { | ||
if (options === void 0) { options = defaultOptions; } | ||
this.options = options; | ||
} | ||
@@ -82,3 +87,3 @@ Object.defineProperty(TransitiveDependencyDetector.prototype, "name", { | ||
TransitiveDependencyDetector.prototype.isValidImport = function (packageDependencies, importPath) { | ||
var validImports = Object.keys(packageDependencies); | ||
var validImports = Object.keys(packageDependencies).concat(this.options.ignorePackages); | ||
return validImports.some(function (moduleName) { return importPath === moduleName || importPath.startsWith(moduleName + "/"); }); | ||
@@ -85,0 +90,0 @@ }; |
@@ -42,3 +42,3 @@ { | ||
}, | ||
"version": "0.0.1215" | ||
"version": "0.1.0" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
69419
1322