Skip to content

Commit

Permalink
allow optional invocation from direct constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
niclim committed Sep 20, 2023
1 parent 906e42b commit 20e68d1
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions projects/standard-rulesets/src/spectral/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,28 @@ const configSchema = {
const validateConfigSchema = ajv.compile(configSchema);

export class SpectralRulesets extends ExternalRuleBase {
constructor(
private options: {
always: string[];
added: string[];
changed: string[];
addedOrChanged: string[];
matches?: (context: RuleContext) => boolean;
}
) {
private options: {
always: string[];
added: string[];
changed: string[];
addedOrChanged: string[];
matches?: (context: RuleContext) => boolean;
};
constructor(options: {
always?: string[];
added?: string[];
changed?: string[];
addedOrChanged?: string[];
matches?: (context: RuleContext) => boolean;
}) {
super();
this.options = {
always: options.always ?? [],
added: options.added ?? [],
changed: options.changed ?? [],
addedOrChanged: options.addedOrChanged ?? [],
matches: options.matches,
};
}

async runRules(inputs: {
Expand Down

0 comments on commit 20e68d1

Please sign in to comment.