Skip to content

Commit 4bf3147

Browse files
authored
chore: update type definition for config (#490)
Provide a detailed type definition for `NpmPackageJsonLintOptions['config']` instead of `object`
1 parent e59afea commit 4bf3147

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

index.d.ts

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,24 @@ interface LinterResult {
2020
warningCount: number;
2121
}
2222

23+
type Severity = 'error' | 'warning' | 'off';
24+
25+
type RuleConfig = Severity | [Severity, ...any[]];
26+
27+
type RuleSet = Record<string, RuleConfig>;
28+
29+
interface NpmPackageJsonLintConfig {
30+
extends?: string | string[];
31+
rules?: RuleSet;
32+
overrides: {
33+
patterns: string[];
34+
rules: RuleSet;
35+
}[];
36+
}
37+
2338
type NpmPackageJsonLintOptions = {
2439
cwd?: string;
25-
config?: object;
40+
config?: NpmPackageJsonLintConfig;
2641
configFile?: string;
2742
configBaseDirectory?: string;
2843
quiet?: boolean;
@@ -51,5 +66,7 @@ export {
5166
export type {
5267
FileLintResult,
5368
LinterResult,
54-
LintIssue
69+
LintIssue,
70+
Severity,
71+
NpmPackageJsonLintConfig
5572
};

0 commit comments

Comments
 (0)