Skip to content

Commit 871ff09

Browse files
committed
feat(types): add TypeScript definitions
1 parent 2a4e598 commit 871ff09

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

lib/utils/parser-config-resolver/parse-by-parser.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import type { ParseResult } from '.'
66

77
export function parseByParser(
88
filePath: string,
9-
parserDefine: Linter.ParserModule | string | undefined,
9+
parserDefine: Linter.Parser | string | undefined,
1010
parserOptions: unknown
1111
): ParseResult {
1212
const parser = getParser(parserDefine, filePath)
@@ -24,9 +24,9 @@ export function parseByParser(
2424
}
2525

2626
function getParser(
27-
parser: Linter.ParserModule | string | undefined,
27+
parser: Linter.Parser | string | undefined,
2828
filePath: string
29-
): Linter.ParserModule {
29+
): Linter.Parser {
3030
if (parser) {
3131
if (typeof parser === 'string') {
3232
try {
@@ -39,7 +39,7 @@ function getParser(
3939
}
4040
}
4141
if (filePath.endsWith('.vue')) {
42-
return { parseForESLint } as Linter.ParserModule
42+
return { parseForESLint } as Linter.Parser
4343
}
4444
return require('espree')
4545
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"dist"
3636
],
3737
"main": "dist/index.js",
38+
"types": "dist/index.d.ts",
3839
"scripts": {
3940
"build": "tsc --project ./tsconfig.build.json",
4041
"clean": "git clean -fx .nyc_output coverage dist docs/.vitepress/dist",
@@ -83,7 +84,6 @@
8384
"@changesets/changelog-github": "^0.5.0",
8485
"@changesets/cli": "^2.26.2",
8586
"@types/debug": "^4.1.8",
86-
"@types/eslint": "^8.44.1",
8787
"@types/eslint-scope": "^3.7.4",
8888
"@types/glob": "^8.1.0",
8989
"@types/js-yaml": "^4.0.5",

tsconfig.build.json

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"extends": "./tsconfig.json",
33
"exclude": ["tests/lib/**/*", "scripts/**/*", "typings/**/*"],
44
"compilerOptions": {
5+
"declaration": true,
56
"removeComments": true /* Do not emit comments to output. */
67
}
78
}

0 commit comments

Comments
 (0)