@boll/rules-typescript
Advanced tools
Comparing version 0.2.6 to 1.0.0
@@ -5,2 +5,17 @@ { | ||
{ | ||
"date": "Tue, 16 Feb 2021 20:17:21 GMT", | ||
"tag": "@boll/rules-typescript_v1.0.0", | ||
"version": "1.0.0", | ||
"comments": { | ||
"major": [ | ||
{ | ||
"comment": "Unused dep detector", | ||
"author": "email not defined", | ||
"commit": "f63555b024b0e7f44d359805bc1af296f68b19f9", | ||
"package": "@boll/rules-typescript" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"date": "Tue, 17 Nov 2020 20:16:43 GMT", | ||
@@ -7,0 +22,0 @@ "tag": "@boll/rules-typescript_v0.2.3", |
# Change Log - @boll/rules-typescript | ||
This log was last generated on Thu, 22 Oct 2020 18:26:52 GMT and should not be manually modified. | ||
This log was last generated on Tue, 16 Feb 2021 20:17:21 GMT and should not be manually modified. | ||
<!-- Start content --> | ||
## 1.0.0 | ||
Tue, 16 Feb 2021 20:17:21 GMT | ||
### Major changes | ||
- Unused dep detector (email not defined) | ||
## 0.2.0 | ||
@@ -8,0 +16,0 @@ |
@@ -94,7 +94,10 @@ "use strict"; | ||
var importPaths = []; | ||
var lineNumber = 1; | ||
sourceFile.forEachChild(function (n) { | ||
var totalLines = n.getFullText().split(/\r?\n/).length; | ||
lineNumber = lineNumber + totalLines - 1; | ||
if (typescript_1.isImportDeclaration(n)) { | ||
var path_1 = _this.getPathFromNode(n); | ||
if (path_1.startsWith(".")) { | ||
importPaths.push({ path: path_1, lineNumber: sourceFile.getLineAndCharacterOfPosition(n.pos).line }); | ||
importPaths.push({ path: path_1, lineNumber: lineNumber }); | ||
} | ||
@@ -101,0 +104,0 @@ } |
@@ -81,4 +81,6 @@ "use strict"; | ||
var parsedSourceLines = []; | ||
var lineNumber = 1; | ||
sourceFile.forEachChild(function (n) { | ||
var lineNumber = sourceFile.getLineAndCharacterOfPosition(n.pos).line; | ||
var totalLines = n.getFullText().split(/\r?\n/).length; | ||
lineNumber = lineNumber + totalLines - 1; | ||
var trimmedNodeText = n.getFullText().trim(); | ||
@@ -89,3 +91,3 @@ var multiLineCommentsRemovedText = trimmedNodeText | ||
.filter(function (n) { return n; }) | ||
.join(""); | ||
.join("\r\n"); | ||
var singleLineCommentsRemovedText = multiLineCommentsRemovedText | ||
@@ -95,3 +97,3 @@ .split(SINGLE_LINE_COMMENT_REGEXP) | ||
.filter(function (n) { return n; }) | ||
.join(""); | ||
.join("\r\n"); | ||
parsedSourceLines.push({ line: singleLineCommentsRemovedText, lineNumber: lineNumber }); | ||
@@ -98,0 +100,0 @@ }); |
@@ -82,7 +82,10 @@ "use strict"; | ||
var importPaths = []; | ||
var lineNumber = 1; | ||
sourceFile.forEachChild(function (n) { | ||
var totalLines = n.getFullText().split(/\r?\n/).length; | ||
lineNumber = lineNumber + totalLines - 1; | ||
if (typescript_1.isImportDeclaration(n)) { | ||
importPaths.push({ | ||
path: n.moduleSpecifier.getText(), | ||
lineNumber: sourceFile.getLineAndCharacterOfPosition(n.pos).line | ||
lineNumber: lineNumber | ||
}); | ||
@@ -89,0 +92,0 @@ } |
@@ -82,7 +82,10 @@ "use strict"; | ||
var importPaths = []; | ||
var lineNumber = 1; | ||
sourceFile.forEachChild(function (n) { | ||
var totalLines = n.getFullText().split(/\r?\n/).length; | ||
lineNumber = lineNumber + totalLines - 1; | ||
if (typescript_1.isImportDeclaration(n)) { | ||
importPaths.push({ | ||
path: n.moduleSpecifier.getText(), | ||
lineNumber: sourceFile.getLineAndCharacterOfPosition(n.pos).line | ||
lineNumber: lineNumber | ||
}); | ||
@@ -89,0 +92,0 @@ } |
@@ -9,2 +9,3 @@ "use strict"; | ||
var transitive_dependency_detector_test_1 = require("./transitive-dependency-detector.test"); | ||
test_internal_1.suite(cross_package_dep_detector_test_1.test, node_modules_reference_detector_test_1.test, redundant_imports_detector_test_1.test, src_detector_test_1.test, transitive_dependency_detector_test_1.test); | ||
var unused_dependency_detector_test_1 = require("./unused-dependency-detector.test"); | ||
test_internal_1.suite(cross_package_dep_detector_test_1.test, node_modules_reference_detector_test_1.test, redundant_imports_detector_test_1.test, src_detector_test_1.test, transitive_dependency_detector_test_1.test, unused_dependency_detector_test_1.test); |
@@ -66,2 +66,3 @@ "use strict"; | ||
var core_1 = require("@boll/core"); | ||
var test_internal_1 = require("@boll/test-internal"); | ||
exports.test = baretest_1.default("Cross package dependency detector"); | ||
@@ -97,1 +98,35 @@ exports.test("Should pass if no cross-package dependencies detected", function () { return __awaiter(void 0, void 0, void 0, function () { | ||
}); }); | ||
exports.test("Should fail for missing imports if few imports are declared in devDependencies and devDeps mode is enabled", function () { return __awaiter(void 0, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, test_internal_1.inFixtureDir("cross-package-dep-detector", __dirname, function () { return __awaiter(void 0, void 0, void 0, function () { | ||
var sut, result, _a, _b, failure, failure1, failure2; | ||
return __generator(this, function (_c) { | ||
switch (_c.label) { | ||
case 0: | ||
sut = new cross_package_dependency_detector_1.CrossPackageDependencyDetector(); | ||
_b = (_a = sut).check; | ||
return [4 /*yield*/, core_1.getSourceFile(core_1.asBollDirectory("."), "cross-package-dep-detector.ts", new core_1.Package({}, {}))]; | ||
case 1: return [4 /*yield*/, _b.apply(_a, [_c.sent()])]; | ||
case 2: | ||
result = _c.sent(); | ||
failure = result[0]; | ||
failure1 = result[1]; | ||
failure2 = result[2]; | ||
assert.strictEqual(3, result.length); | ||
assert.strictEqual(core_1.ResultStatus.failure, failure.status); | ||
assert.strictEqual(4, failure.line); | ||
assert.strictEqual(core_1.ResultStatus.failure, failure1.status); | ||
assert.strictEqual(8, failure1.line); | ||
assert.strictEqual(core_1.ResultStatus.failure, failure2.status); | ||
assert.strictEqual(9, failure2.line); | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); })]; | ||
case 1: | ||
_a.sent(); | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); }); |
@@ -93,3 +93,3 @@ "use strict"; | ||
test_internal_1.inFixtureDir("node-modules-references", __dirname, function () { return __awaiter(void 0, void 0, void 0, function () { | ||
var sut, result, _a, _b; | ||
var sut, result, _a, _b, failure, failure1; | ||
return __generator(this, function (_c) { | ||
@@ -104,5 +104,9 @@ switch (_c.label) { | ||
result = _c.sent(); | ||
failure = result[0]; | ||
failure1 = result[1]; | ||
assert.strictEqual(2, result.length); | ||
assert.strictEqual(core_1.ResultStatus.failure, result[0].status); | ||
assert.strictEqual(core_1.ResultStatus.failure, result[1].status); | ||
assert.strictEqual(1, failure.line); | ||
assert.strictEqual(5, failure1.line); | ||
return [2 /*return*/]; | ||
@@ -109,0 +113,0 @@ } |
@@ -66,2 +66,3 @@ "use strict"; | ||
var core_1 = require("@boll/core"); | ||
var test_internal_1 = require("@boll/test-internal"); | ||
exports.test = baretest_1.default("Redunant imports detector"); | ||
@@ -96,1 +97,32 @@ exports.test("Should pass if no redundant import paths", function () { return __awaiter(void 0, void 0, void 0, function () { | ||
}); }); | ||
exports.test("Should fail for missing imports if few imports are declared in devDependencies and devDeps mode is enabled", function () { return __awaiter(void 0, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, test_internal_1.inFixtureDir("redundant-imports-detector", __dirname, function () { return __awaiter(void 0, void 0, void 0, function () { | ||
var sut, result, _a, _b, failure, failure1; | ||
return __generator(this, function (_c) { | ||
switch (_c.label) { | ||
case 0: | ||
sut = new redundant_imports_detector_1.RedundantImportsDetector(); | ||
_b = (_a = sut).check; | ||
return [4 /*yield*/, core_1.getSourceFile(core_1.asBollDirectory("."), "redundant-imports-detector.ts", new core_1.Package({}, {}))]; | ||
case 1: return [4 /*yield*/, _b.apply(_a, [_c.sent()])]; | ||
case 2: | ||
result = _c.sent(); | ||
failure = result[0]; | ||
failure1 = result[1]; | ||
assert.strictEqual(2, result.length); | ||
assert.strictEqual(core_1.ResultStatus.failure, failure.status); | ||
assert.strictEqual(8, failure.line); | ||
assert.strictEqual(core_1.ResultStatus.failure, failure1.status); | ||
assert.strictEqual(15, failure1.line); | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); })]; | ||
case 1: | ||
_a.sent(); | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); }); |
@@ -66,2 +66,3 @@ "use strict"; | ||
var src_detector_1 = require("../src-detector"); | ||
var test_internal_1 = require("@boll/test-internal"); | ||
exports.test = baretest_1.default("Source detector"); | ||
@@ -94,1 +95,28 @@ exports.test("Should pass if no `src` detected in imports", function () { return __awaiter(void 0, void 0, void 0, function () { | ||
}); }); | ||
exports.test("Should fail if references to `src` detected in imports", function () { return __awaiter(void 0, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
test_internal_1.inFixtureDir("src-detector", __dirname, function () { return __awaiter(void 0, void 0, void 0, function () { | ||
var sut, result, _a, _b, failure, failure1; | ||
return __generator(this, function (_c) { | ||
switch (_c.label) { | ||
case 0: | ||
sut = new src_detector_1.SrcDetector(); | ||
_b = (_a = sut).check; | ||
return [4 /*yield*/, core_1.getSourceFile(core_1.asBollDirectory("."), "src-detector.ts", new core_1.Package({}, {}))]; | ||
case 1: return [4 /*yield*/, _b.apply(_a, [_c.sent()])]; | ||
case 2: | ||
result = _c.sent(); | ||
failure = result[0]; | ||
failure1 = result[1]; | ||
assert.strictEqual(2, result.length); | ||
assert.strictEqual(core_1.ResultStatus.failure, result[0].status); | ||
assert.strictEqual(core_1.ResultStatus.failure, result[1].status); | ||
assert.strictEqual(1, failure.line); | ||
assert.strictEqual(8, failure1.line); | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); }); | ||
return [2 /*return*/]; | ||
}); | ||
}); }); |
@@ -160,3 +160,3 @@ "use strict"; | ||
case 0: return [4 /*yield*/, test_internal_1.inFixtureDir("transitive-reference", __dirname, function () { return __awaiter(void 0, void 0, void 0, function () { | ||
var sut, result, _a, _b; | ||
var sut, result, _a, _b, failure; | ||
return __generator(this, function (_c) { | ||
@@ -172,2 +172,5 @@ switch (_c.label) { | ||
assert.strictEqual(1, result.length); | ||
failure = result[0]; | ||
assert.strictEqual(core_1.ResultStatus.failure, failure.status); | ||
assert.strictEqual(1, failure.line); | ||
return [2 /*return*/]; | ||
@@ -183,1 +186,35 @@ } | ||
}); }); | ||
exports.test("Should fail for missing imports if few imports are declared in devDependencies and devDeps mode is enabled", function () { return __awaiter(void 0, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, test_internal_1.inFixtureDir("transitive-reference", __dirname, function () { return __awaiter(void 0, void 0, void 0, function () { | ||
var sut, result, _a, _b, failure, failure1, failure2; | ||
return __generator(this, function (_c) { | ||
switch (_c.label) { | ||
case 0: | ||
sut = new transitive_dependency_detector_1.TransitiveDependencyDetector({ allowDevDependencies: true }); | ||
_b = (_a = sut).check; | ||
return [4 /*yield*/, core_1.getSourceFile(core_1.asBollDirectory("."), "transitive-reference.ts", new core_1.Package({}, { "@some/other-package": "0" }))]; | ||
case 1: return [4 /*yield*/, _b.apply(_a, [_c.sent()])]; | ||
case 2: | ||
result = _c.sent(); | ||
failure = result[0]; | ||
failure1 = result[1]; | ||
failure2 = result[2]; | ||
assert.strictEqual(3, result.length); | ||
assert.strictEqual(core_1.ResultStatus.failure, failure.status); | ||
assert.strictEqual(1, failure.line); | ||
assert.strictEqual(core_1.ResultStatus.failure, failure1.status); | ||
assert.strictEqual(8, failure1.line); | ||
assert.strictEqual(core_1.ResultStatus.failure, failure2.status); | ||
assert.strictEqual(9, failure2.line); | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); })]; | ||
case 1: | ||
_a.sent(); | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); }); |
@@ -113,7 +113,10 @@ "use strict"; | ||
var importPaths = []; | ||
var lineNumber = 1; | ||
sourceFile.forEachChild(function (n) { | ||
var totalLines = n.getFullText().split(/\r?\n/).length; | ||
lineNumber = lineNumber + totalLines - 1; | ||
if (typescript_1.isImportDeclaration(n)) { | ||
var path = _this.getPathFromNode(n); | ||
if (!path.startsWith(".")) { | ||
importPaths.push({ path: path, lineNumber: sourceFile.getLineAndCharacterOfPosition(n.pos).line }); | ||
importPaths.push({ path: path, lineNumber: lineNumber }); | ||
} | ||
@@ -120,0 +123,0 @@ } |
@@ -7,3 +7,3 @@ { | ||
"dependencies": { | ||
"@boll/core": "1.6.0", | ||
"@boll/core": "2.0.0", | ||
"typescript": "^3.9.7" | ||
@@ -43,3 +43,3 @@ }, | ||
}, | ||
"version": "0.2.6" | ||
"version": "1.0.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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
110688
32
2091
0
1
+ Added@boll/core@2.0.0(transitive)
- Removed@boll/core@1.6.0(transitive)
Updated@boll/core@2.0.0