Skip to content

Commit 223caaf

Browse files
authored
Add type definitions. (#469)
1 parent b7da4b6 commit 223caaf

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

index.d.ts

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
interface LintIssue {
2+
lintId: string;
3+
severity: 'error' | 'warning';
4+
node: 'string';
5+
lintMessage: 'string';
6+
}
7+
8+
interface FileLintResult {
9+
filePath: string;
10+
issues: LintIssue[];
11+
ignored: boolean;
12+
errorCount: number;
13+
warningCount: number;
14+
}
15+
16+
interface LinterResult {
17+
results: FileLintResult[];
18+
ignoreCount: number;
19+
errorCount: number;
20+
warningCount: number;
21+
}
22+
23+
type NpmPackageJsonLintOptions = {
24+
cwd?: string;
25+
config?: object;
26+
configFile: string;
27+
configBaseDirectory?: string;
28+
quiet?: boolean;
29+
ignorePath?: string;
30+
fix?: boolean;
31+
} & (
32+
{
33+
packageJsonObject: object,
34+
packageJsonFilePath?: string;
35+
} |
36+
{
37+
patterns: string[]
38+
}
39+
);
40+
41+
declare class NpmPackageJsonLint {
42+
constructor (options: NpmPackageJsonLintOptions);
43+
44+
lint(): LinterResult;
45+
}
46+
47+
export {
48+
FileLintResult,
49+
LinterResult,
50+
LintIssue,
51+
NpmPackageJsonLint
52+
};

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"CONTRIBUTING.md"
2828
],
2929
"main": "src/api.js",
30+
"types": "index.d.ts",
3031
"scripts": {
3132
"eslint": "eslint . --format=node_modules/eslint-formatter-pretty",
3233
"npmpackagejsonlint": "node src/cli.js ./package.json",

0 commit comments

Comments
 (0)