Skip to content

Commit 76cce54

Browse files
committed
Fix types accidentally destroyed by xo
Related-to: 21f345e.
1 parent 21f345e commit 76cce54

File tree

2 files changed

+30
-6
lines changed

2 files changed

+30
-6
lines changed

lib/types.d.ts

+7-6
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,14 @@ export type OnError = (error: VFileMessage) => undefined | void
2727
/**
2828
* Options that define the severity of errors.
2929
*/
30-
export type ErrorOptions = Partial<Record<ErrorCode, ErrorSeverity | undefined>>
30+
export type ErrorOptions = Partial<
31+
Record<ErrorCode, ErrorSeverity | null | undefined>
32+
>
3133

3234
/**
3335
* Configuration.
3436
*/
35-
export type Options = {
37+
export interface Options extends ErrorOptions, FromParse5Options {
3638
/**
3739
* The `file` field from `hast-util-from-parse5` is not supported.
3840
*/
@@ -44,7 +46,7 @@ export type Options = {
4446
* In document mode, unopened `html`, `head`, and `body` elements are opened
4547
* in just the right places.
4648
*/
47-
fragment?: boolean | undefined
49+
fragment?: boolean | null | undefined
4850
/**
4951
* Call `onerror` with parse errors while parsing (optional).
5052
*
@@ -57,6 +59,5 @@ export type Options = {
5759
* that rules emit as warnings.
5860
* Rules can also be configured with `2`, to turn them into fatal errors.
5961
*/
60-
onerror?: OnError | undefined
61-
} & ErrorOptions &
62-
FromParse5Options
62+
onerror?: OnError | null | undefined
63+
}

package.json

+23
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,29 @@
8888
},
8989
"xo": {
9090
"overrides": [
91+
{
92+
"files": [
93+
"**/*.d.ts"
94+
],
95+
"rules": {
96+
"@typescript-eslint/array-type": [
97+
"error",
98+
{
99+
"default": "generic"
100+
}
101+
],
102+
"@typescript-eslint/ban-types": [
103+
"error",
104+
{
105+
"extendDefaults": true
106+
}
107+
],
108+
"@typescript-eslint/consistent-type-definitions": [
109+
"error",
110+
"interface"
111+
]
112+
}
113+
},
91114
{
92115
"files": "test/**/*.js",
93116
"rules": {

0 commit comments

Comments
 (0)