@boll/core
Advanced tools
Comparing version 3.0.0 to 3.1.0
@@ -8,3 +8,7 @@ import { ConfigDefinition } from "./types"; | ||
get(name: string): ConfigDefinition; | ||
static bootstrapPlugins(config: ConfigDefinition): void; | ||
static loadExternalPlugin(fullPkgName: string): any; | ||
static loadBollPlugin(plugin: string): any; | ||
static requirePlugin(fullPkgName: string): any; | ||
} | ||
export declare const ConfigRegistryInstance: ConfigRegistry; |
"use strict"; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -17,2 +26,4 @@ exports.ConfigRegistryInstance = exports.ConfigRegistry = void 0; | ||
this.registrations[name] = config; | ||
// bootstrap all plugins when they are registered | ||
ConfigRegistry.bootstrapPlugins(config); | ||
}; | ||
@@ -25,2 +36,41 @@ ConfigRegistry.prototype.get = function (name) { | ||
}; | ||
ConfigRegistry.bootstrapPlugins = function (config) { | ||
var _this = this; | ||
if (config.extends) { | ||
if (!Array.isArray(config.extends)) { | ||
config.extends = [config.extends]; | ||
} | ||
config.extends.forEach(function (extensionName) { | ||
var plugin; | ||
var _a = extensionName.split(":"), prefix = _a[0], pkg = _a[1]; | ||
if (prefix === "boll") { | ||
plugin = _this.loadBollPlugin(pkg); | ||
} | ||
else if (prefix === "plugin") { | ||
plugin = _this.loadExternalPlugin(pkg); | ||
} | ||
plugin === null || plugin === void 0 ? void 0 : plugin.bootstrap(); | ||
}); | ||
} | ||
}; | ||
ConfigRegistry.loadExternalPlugin = function (fullPkgName) { | ||
return this.requirePlugin(fullPkgName); | ||
}; | ||
ConfigRegistry.loadBollPlugin = function (plugin) { | ||
var _a = plugin === null || plugin === void 0 ? void 0 : plugin.split("/"), base = _a[0], rest = _a.slice(1); | ||
var fullPkgName = "@boll/".concat(plugin); | ||
if (rest && rest.length >= 1) { | ||
fullPkgName = "@boll/".concat(base, "/dist/").concat(__spreadArray([], rest, true).join("/")); | ||
} | ||
return this.requirePlugin(fullPkgName); | ||
}; | ||
ConfigRegistry.requirePlugin = function (fullPkgName) { | ||
try { | ||
var pkg = require(fullPkgName); | ||
return pkg; | ||
} | ||
catch (e) { | ||
throw new Error("Could not load plugin ".concat(fullPkgName, ".")); | ||
} | ||
}; | ||
return ConfigRegistry; | ||
@@ -27,0 +77,0 @@ }()); |
@@ -1,2 +0,2 @@ | ||
import { ConfigDefinition } from "./types"; | ||
import { LoadedConfigDefinition, ConfigDefinition } from "./types"; | ||
import { ConfigRegistry } from "./config-registry"; | ||
@@ -17,9 +17,6 @@ import { Logger } from "./logger"; | ||
load(def: ConfigDefinition): void; | ||
resolvedConfiguration(): ConfigDefinition; | ||
loadExternalPlugin(fullPkgName: string): any; | ||
loadBollPlugin(plugin: string): any; | ||
requirePlugin(fullPkgName: string): any; | ||
bootstrapPackages(): void; | ||
resolveParentConfiguration(baseConfigName: string | null | undefined): ConfigDefinition; | ||
resolvedConfiguration(): LoadedConfigDefinition; | ||
resolveExtendsConfiguration(allExtends: LoadedConfigDefinition[]): LoadedConfigDefinition; | ||
resolveParentConfiguration(baseConfigName: string | string[] | undefined): LoadedConfigDefinition; | ||
private mergeConfigurations; | ||
} |
@@ -60,2 +60,3 @@ "use strict"; | ||
exports.Config = void 0; | ||
var config_registry_1 = require("./config-registry"); | ||
var rule_set_1 = require("./rule-set"); | ||
@@ -124,5 +125,5 @@ var suite_1 = require("./suite"); | ||
var rule = fn(_this.logger, options); | ||
return new rule_set_1.InstantiatedPackageRule(rule.name, check.severity || "error", rule); | ||
return new rule_set_1.InstantiatedPackageRule(rule.name, check.severity || "error", rule, check.rule); | ||
} | ||
return new rule_set_1.InstantiatedPackageRule(fn.name, check.severity || "error", fn, options); | ||
return new rule_set_1.InstantiatedPackageRule(fn.name, check.severity || "error", fn, check.rule, options); | ||
}); | ||
@@ -135,5 +136,5 @@ var metaChecks = ((ruleSetConfig.checks && ruleSetConfig.checks.meta) || []).map(function (check) { | ||
var rule = fn(_this.logger, options); | ||
return new rule_set_1.InstantiatedPackageMetaRule(rule.name, check.severity || "error", rule); | ||
return new rule_set_1.InstantiatedPackageMetaRule(rule.name, check.severity || "error", rule, check.rule); | ||
} | ||
return new rule_set_1.InstantiatedPackageMetaRule(fn.name, check.severity || "error", fn, options); | ||
return new rule_set_1.InstantiatedPackageMetaRule(fn.name, check.severity || "error", fn, check.rule, options); | ||
}); | ||
@@ -147,43 +148,20 @@ return new rule_set_1.RuleSet(glob, fileChecks, metaChecks); | ||
Config.prototype.load = function (def) { | ||
if (this.configuration.extends && !Array.isArray(this.configuration.extends)) { | ||
this.configuration.extends = [this.configuration.extends]; | ||
} | ||
this.configuration = def; | ||
}; | ||
Config.prototype.resolvedConfiguration = function () { | ||
this.bootstrapPackages(); | ||
var parentConfiguration = this.resolveParentConfiguration(this.configuration.extends); | ||
var finalResult = this.mergeConfigurations(this.configuration, parentConfiguration); | ||
return finalResult; | ||
config_registry_1.ConfigRegistry.bootstrapPlugins(this.configuration); | ||
var resolvedExtendsConfig = this.resolveParentConfiguration(this.configuration.extends); | ||
var config = this.mergeConfigurations(this.configuration, resolvedExtendsConfig); | ||
return config; | ||
}; | ||
Config.prototype.loadExternalPlugin = function (fullPkgName) { | ||
return this.requirePlugin(fullPkgName); | ||
}; | ||
Config.prototype.loadBollPlugin = function (plugin) { | ||
var _a = plugin === null || plugin === void 0 ? void 0 : plugin.split("/"), base = _a[0], rest = _a.slice(1); | ||
var fullPkgName = "@boll/".concat(plugin); | ||
if (rest && rest.length >= 1) { | ||
fullPkgName = "@boll/".concat(base, "/dist/").concat(__spreadArray([], rest, true).join("/")); | ||
Config.prototype.resolveExtendsConfiguration = function (allExtends) { | ||
var parentConfiguration = {}; | ||
for (var i = allExtends.length - 1; i >= 0; i--) { | ||
parentConfiguration = this.mergeConfigurations(parentConfiguration, allExtends[i]); | ||
} | ||
return this.requirePlugin(fullPkgName); | ||
return parentConfiguration; | ||
}; | ||
Config.prototype.requirePlugin = function (fullPkgName) { | ||
try { | ||
var pkg = require(fullPkgName); | ||
return pkg; | ||
} | ||
catch (e) { | ||
throw new Error("Could not load plugin ".concat(fullPkgName, ".")); | ||
} | ||
}; | ||
Config.prototype.bootstrapPackages = function () { | ||
if (this.configuration.extends) { | ||
var _a = this.configuration.extends.split(":"), prefix = _a[0], pkg = _a[1]; | ||
var plugin = void 0; | ||
if (prefix === "boll") { | ||
plugin = this.loadBollPlugin(pkg); | ||
} | ||
else if (prefix === "plugin") { | ||
plugin = this.loadExternalPlugin(pkg); | ||
} | ||
plugin === null || plugin === void 0 ? void 0 : plugin.bootstrap(); | ||
} | ||
}; | ||
Config.prototype.resolveParentConfiguration = function (baseConfigName) { | ||
@@ -193,5 +171,11 @@ if (!baseConfigName) { | ||
} | ||
var baseConfig = this.configRegistry.get(baseConfigName); | ||
var parentConfig = this.resolveParentConfiguration(baseConfig.extends); | ||
return this.mergeConfigurations(parentConfig, baseConfig); | ||
if (!Array.isArray(baseConfigName)) { | ||
baseConfigName = [baseConfigName]; | ||
} | ||
var allExtendsConfigs = []; | ||
for (var i = baseConfigName.length - 1; i >= 0; i--) { | ||
var baseConfig = this.configRegistry.get(baseConfigName[i]); | ||
allExtendsConfigs.push(this.mergeConfigurations(this.resolveParentConfiguration(baseConfig.extends), baseConfig)); | ||
} | ||
return this.resolveExtendsConfiguration(allExtendsConfigs); | ||
}; | ||
@@ -198,0 +182,0 @@ Config.prototype.mergeConfigurations = function (parentConfiguration, childConfiguration) { |
import { BollFile } from "./boll-file"; | ||
import { BollLineNumber } from "./boll-line-number"; | ||
import { InstantiatedRule } from "./rule-set"; | ||
import { ResultStatus } from "./types"; | ||
@@ -8,2 +9,12 @@ export interface Result { | ||
} | ||
export interface RuleResult extends Result { | ||
registryName: string; | ||
ruleName: string; | ||
} | ||
export interface GroupedResult { | ||
[group: string]: { | ||
errors: RuleResult[]; | ||
warnings: RuleResult[]; | ||
}; | ||
} | ||
export declare class Success implements Result { | ||
@@ -25,8 +36,21 @@ ruleName: string; | ||
export declare class ResultSet { | ||
errors: Result[]; | ||
warnings: Result[]; | ||
errors: RuleResult[]; | ||
warnings: RuleResult[]; | ||
get hasErrors(): boolean; | ||
get hasWarnings(): boolean; | ||
addErrors(results: Result[]): void; | ||
addWarnings(results: Result[]): void; | ||
getResultsByRegistry(): { | ||
[registerName: string]: { | ||
errors: RuleResult[]; | ||
warnings: RuleResult[]; | ||
}; | ||
}; | ||
getResultsByRule(): { | ||
[ruleName: string]: { | ||
errors: RuleResult[]; | ||
warnings: RuleResult[]; | ||
}; | ||
}; | ||
private groupResults; | ||
addErrors(results: Result[], rule: InstantiatedRule): void; | ||
addWarnings(results: Result[], rule: InstantiatedRule): void; | ||
} |
@@ -69,5 +69,29 @@ "use strict"; | ||
}); | ||
ResultSet.prototype.addErrors = function (results) { | ||
ResultSet.prototype.getResultsByRegistry = function () { | ||
return this.groupResults("registryName"); | ||
}; | ||
ResultSet.prototype.getResultsByRule = function () { | ||
return this.groupResults("ruleName"); | ||
}; | ||
ResultSet.prototype.groupResults = function (groupBy) { | ||
var _this = this; | ||
var groupedResult = {}; | ||
["errors", "warnings"].forEach(function (resultType) { | ||
_this[resultType].forEach(function (result) { | ||
if (!groupedResult[result[groupBy]]) { | ||
groupedResult[result[groupBy]] = { | ||
errors: [], | ||
warnings: [] | ||
}; | ||
} | ||
groupedResult[result[groupBy]][resultType].push(result); | ||
}); | ||
}); | ||
return groupedResult; | ||
}; | ||
ResultSet.prototype.addErrors = function (results, rule) { | ||
var _this = this; | ||
results.forEach(function (result) { | ||
result.registryName = rule.registryName; | ||
result.ruleName = rule.name; | ||
if (result.status === types_1.ResultStatus.failure) { | ||
@@ -78,5 +102,7 @@ _this.errors.push(result); | ||
}; | ||
ResultSet.prototype.addWarnings = function (results) { | ||
ResultSet.prototype.addWarnings = function (results, rule) { | ||
var _this = this; | ||
results.forEach(function (result) { | ||
result.registryName = rule.registryName; | ||
result.ruleName = rule.name; | ||
if (result.status === types_1.ResultStatus.failure) { | ||
@@ -83,0 +109,0 @@ _this.warnings.push(result); |
@@ -6,2 +6,3 @@ import { FileContext } from "./file-context"; | ||
export interface InstantiatedRule { | ||
registryName: string; | ||
name: string; | ||
@@ -18,4 +19,5 @@ severity: CheckSeverity; | ||
rule: T; | ||
registryName: string; | ||
options?: RuleOptions | undefined; | ||
constructor(name: string, severity: CheckSeverity, rule: T, options?: RuleOptions | undefined); | ||
constructor(name: string, severity: CheckSeverity, rule: T, registryName: string, options?: RuleOptions | undefined); | ||
} | ||
@@ -22,0 +24,0 @@ export declare class InstantiatedPackageRule extends BasePackageRule<PackageRule> implements InstantiatedRule { |
@@ -20,6 +20,7 @@ "use strict"; | ||
var BasePackageRule = /** @class */ (function () { | ||
function BasePackageRule(name, severity, rule, options) { | ||
function BasePackageRule(name, severity, rule, registryName, options) { | ||
this.name = name; | ||
this.severity = severity; | ||
this.rule = rule; | ||
this.registryName = registryName; | ||
this.options = options; | ||
@@ -26,0 +27,0 @@ } |
@@ -202,6 +202,6 @@ "use strict"; | ||
if (rule.severity === "error") { | ||
resultSet.addErrors(results); | ||
resultSet.addErrors(results, rule); | ||
} | ||
else if (rule.severity === "warn") { | ||
resultSet.addWarnings(results); | ||
resultSet.addWarnings(results, rule); | ||
} | ||
@@ -208,0 +208,0 @@ else { |
@@ -118,2 +118,40 @@ "use strict"; | ||
}); | ||
(0, exports.test)("should allow multi-level inheritance of configs with multiple extends", function () { | ||
var configRegistry = new config_registry_1.ConfigRegistry(); | ||
var ruleRegistry = new rule_registry_1.RuleRegistry(); | ||
var fooCalled = false; | ||
var barCalled = false; | ||
var bazCalled = false; | ||
ruleRegistry.register("foo", function () { | ||
fooCalled = true; | ||
return new FakeRule(); | ||
}); | ||
ruleRegistry.register("bar", function () { | ||
barCalled = true; | ||
return new FakeRule(); | ||
}); | ||
ruleRegistry.register("baz", function () { | ||
bazCalled = true; | ||
return new FakeRule(); | ||
}); | ||
configRegistry.register({ | ||
name: "base", | ||
ruleSets: [{ fileLocator: new FakeGlob(), checks: { file: [{ rule: "foo" }] } }] | ||
}); | ||
configRegistry.register({ | ||
name: "base2", | ||
ruleSets: [{ fileLocator: new FakeGlob(), checks: { file: [{ rule: "bar" }] } }] | ||
}); | ||
configRegistry.register({ | ||
name: "base3", | ||
ruleSets: [{ fileLocator: new FakeGlob(), checks: { file: [{ rule: "baz" }] } }] | ||
}); | ||
configRegistry.register({ name: "level1", extends: "base" }); | ||
configRegistry.register({ name: "level2", extends: ["base2", "base3"] }); | ||
configRegistry.register({ name: "level3", extends: ["level2", "level1"] }); | ||
var config = new config_1.Config(configRegistry, ruleRegistry, logger_1.NullLogger); | ||
config.load({ extends: "level3" }); | ||
config.buildSuite(); | ||
assert.ok(barCalled && fooCalled && bazCalled, "Rule factory should have been invoked when creating suite."); | ||
}); | ||
(0, exports.test)("should apply exclude/include across extended config", function () { return __awaiter(void 0, void 0, void 0, function () { | ||
@@ -137,2 +175,23 @@ var configRegistry, ruleSets, config, suite; | ||
}); }); | ||
(0, exports.test)("should apply exclude/include across extended config with multiple extends", function () { return __awaiter(void 0, void 0, void 0, function () { | ||
var configRegistry, ruleSets, confRuleSets, config, suite; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
configRegistry = new config_registry_1.ConfigRegistry(); | ||
ruleSets = [{ exclude: ["testme"], fileLocator: new FakeGlob() }]; | ||
confRuleSets = [{ exclude: ["testmetoo"], fileLocator: new FakeGlob() }]; | ||
configRegistry.register({ name: "base", ruleSets: ruleSets }); | ||
configRegistry.register({ name: "base2", ruleSets: confRuleSets }); | ||
config = new config_1.Config(configRegistry, new rule_registry_1.RuleRegistry(), logger_1.NullLogger); | ||
config.load({ extends: ["base", "base2"] }); | ||
return [4 /*yield*/, config.buildSuite()]; | ||
case 1: | ||
suite = _a.sent(); | ||
assert.deepStrictEqual(suite.ruleSets[0].fileGlob.exclude, ["testme"]); | ||
assert.deepStrictEqual(suite.ruleSets[1].fileGlob.exclude, ["testmetoo"]); | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); }); | ||
(0, exports.test)("gives options to factory function", function () { | ||
@@ -139,0 +198,0 @@ var configRegistry = new config_registry_1.ConfigRegistry(); |
@@ -97,2 +97,17 @@ "use strict"; | ||
}()); | ||
var FakeRule2 = /** @class */ (function () { | ||
function FakeRule2(options) { | ||
if (options === void 0) { options = {}; } | ||
this.options = options; | ||
this.name = "fakerule2"; | ||
} | ||
FakeRule2.prototype.check = function (file) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
return [2 /*return*/, [new result_set_1.Failure(this.name, file.filename, (0, boll_line_number_1.asBollLineNumber)(0), "Something went wrong.")]]; | ||
}); | ||
}); | ||
}; | ||
return FakeRule2; | ||
}()); | ||
(0, exports.test)("should log a failure as an error by default", function () { return __awaiter(void 0, void 0, void 0, function () { | ||
@@ -185,1 +200,171 @@ return __generator(this, function (_a) { | ||
}); }); | ||
(0, exports.test)("should group results by rule name", function () { return __awaiter(void 0, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, (0, test_internal_1.inFixtureDir)("project-a", __dirname, function () { return __awaiter(void 0, void 0, void 0, function () { | ||
var ruleRegistry, config, myConfig, suite, results, groupedByRuleNameResults; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
ruleRegistry = new rule_registry_1.RuleRegistry(); | ||
ruleRegistry.register("foo", function (l, options) { | ||
return new FakeRule(options); | ||
}); | ||
ruleRegistry.register("bar", function (l, options) { | ||
return new FakeRule2(options); | ||
}); | ||
config = new config_1.Config(new config_registry_1.ConfigRegistry(), ruleRegistry, logger_1.NullLogger); | ||
myConfig = { | ||
ruleSets: [ | ||
{ | ||
fileLocator: new glob_1.TypescriptSourceGlob(), | ||
checks: { | ||
file: [ | ||
{ severity: "warn", rule: "foo", options: { bar: "baz" } }, | ||
{ severity: "error", rule: "bar", options: { bar: "baz" } } | ||
] | ||
} | ||
} | ||
], | ||
configuration: { | ||
rules: { | ||
foo: { some: "rule" } | ||
} | ||
} | ||
}; | ||
config.load(myConfig); | ||
return [4 /*yield*/, config.buildSuite()]; | ||
case 1: | ||
suite = _a.sent(); | ||
return [4 /*yield*/, suite.run(logger_1.NullLogger)]; | ||
case 2: | ||
results = _a.sent(); | ||
groupedByRuleNameResults = results.getResultsByRule(); | ||
assert.ok(groupedByRuleNameResults["fakerule"]); | ||
assert.ok(groupedByRuleNameResults["fakerule2"]); | ||
assert.strictEqual(groupedByRuleNameResults["fakerule"].errors.length, 0); | ||
assert.strictEqual(groupedByRuleNameResults["fakerule"].warnings.length, 2); | ||
assert.strictEqual(groupedByRuleNameResults["fakerule2"].errors.length, 2); | ||
assert.strictEqual(groupedByRuleNameResults["fakerule2"].warnings.length, 0); | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); })]; | ||
case 1: | ||
_a.sent(); | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); }); | ||
(0, exports.test)("should group results by rule name and accumulate results", function () { return __awaiter(void 0, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, (0, test_internal_1.inFixtureDir)("project-a", __dirname, function () { return __awaiter(void 0, void 0, void 0, function () { | ||
var ruleRegistry, config, myConfig, suite, results, groupedByRuleNameResults; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
ruleRegistry = new rule_registry_1.RuleRegistry(); | ||
ruleRegistry.register("foo", function (l, options) { | ||
return new FakeRule(options); | ||
}); | ||
ruleRegistry.register("bar", function (l, options) { | ||
return new FakeRule(options); | ||
}); | ||
config = new config_1.Config(new config_registry_1.ConfigRegistry(), ruleRegistry, logger_1.NullLogger); | ||
myConfig = { | ||
ruleSets: [ | ||
{ | ||
fileLocator: new glob_1.TypescriptSourceGlob(), | ||
checks: { | ||
file: [ | ||
{ severity: "warn", rule: "foo", options: { bar: "baz" } }, | ||
{ severity: "warn", rule: "bar", options: { bar: "baz" } } | ||
] | ||
} | ||
} | ||
], | ||
configuration: { | ||
rules: { | ||
foo: { some: "rule" } | ||
} | ||
} | ||
}; | ||
config.load(myConfig); | ||
return [4 /*yield*/, config.buildSuite()]; | ||
case 1: | ||
suite = _a.sent(); | ||
return [4 /*yield*/, suite.run(logger_1.NullLogger)]; | ||
case 2: | ||
results = _a.sent(); | ||
groupedByRuleNameResults = results.getResultsByRule(); | ||
assert.strictEqual(groupedByRuleNameResults["fakerule"].errors.length, 0); | ||
assert.strictEqual(groupedByRuleNameResults["fakerule"].warnings.length, 4); | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); })]; | ||
case 1: | ||
_a.sent(); | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); }); | ||
(0, exports.test)("should group results by registry", function () { return __awaiter(void 0, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, (0, test_internal_1.inFixtureDir)("project-a", __dirname, function () { return __awaiter(void 0, void 0, void 0, function () { | ||
var ruleRegistry, config, myConfig, suite, results, groupedByRuleNameRegistry; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
ruleRegistry = new rule_registry_1.RuleRegistry(); | ||
ruleRegistry.register("foo", function (l, options) { | ||
return new FakeRule(options); | ||
}); | ||
ruleRegistry.register("fooz", function (l, options) { | ||
return new FakeRule2(options); | ||
}); | ||
config = new config_1.Config(new config_registry_1.ConfigRegistry(), ruleRegistry, logger_1.NullLogger); | ||
myConfig = { | ||
ruleSets: [ | ||
{ | ||
fileLocator: new glob_1.TypescriptSourceGlob(), | ||
checks: { | ||
file: [ | ||
{ severity: "error", rule: "foo", options: { bar: "baz" } }, | ||
{ severity: "warn", rule: "fooz", options: { bar: "baz" } } | ||
] | ||
} | ||
} | ||
], | ||
configuration: { | ||
rules: { | ||
foo: { some: "rule" } | ||
} | ||
} | ||
}; | ||
config.load(myConfig); | ||
return [4 /*yield*/, config.buildSuite()]; | ||
case 1: | ||
suite = _a.sent(); | ||
return [4 /*yield*/, suite.run(logger_1.NullLogger)]; | ||
case 2: | ||
results = _a.sent(); | ||
groupedByRuleNameRegistry = results.getResultsByRegistry(); | ||
assert.ok(groupedByRuleNameRegistry["foo"]); | ||
assert.ok(groupedByRuleNameRegistry["fooz"]); | ||
assert.strictEqual(groupedByRuleNameRegistry["foo"].errors.length, 2); | ||
assert.strictEqual(groupedByRuleNameRegistry["foo"].warnings.length, 0); | ||
assert.strictEqual(groupedByRuleNameRegistry["fooz"].errors.length, 0); | ||
assert.strictEqual(groupedByRuleNameRegistry["fooz"].warnings.length, 2); | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); })]; | ||
case 1: | ||
_a.sent(); | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); }); |
@@ -23,3 +23,3 @@ import { BollFile } from "./boll-file"; | ||
name?: string; | ||
extends?: string; | ||
extends?: string | string[]; | ||
exclude?: string[]; | ||
@@ -33,2 +33,5 @@ ruleSets?: RuleSetConfiguration[]; | ||
} | ||
export interface LoadedConfigDefinition extends ConfigDefinition { | ||
extends?: string[]; | ||
} | ||
export interface Rule { | ||
@@ -35,0 +38,0 @@ name: string; |
@@ -49,3 +49,3 @@ { | ||
}, | ||
"version": "3.0.0" | ||
"version": "3.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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
217577
4539
2