Skip to content

Commit ad06700

Browse files
committed
Refactor code-style
1 parent 6ff4290 commit ad06700

19 files changed

+2979
-1768
lines changed

index.d.ts

+7-8
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@
1616
import type {Node} from 'unist'
1717
import type {VFile, VFileCompatible} from 'vfile'
1818

19-
/* eslint-disable @typescript-eslint/naming-convention */
20-
21-
type VFileWithOutput<Result> = Result extends Uint8Array // Buffer.
19+
type VFileWithOutput<Result> = Result extends Uint8Array
2220
? VFile
2321
: Result extends object // Custom result type
2422
? VFile & {result: Result}
2523
: VFile
2624

2725
// Get the right most non-void thing.
28-
type Specific<Left = void, Right = void> = Right extends void ? Left : Right
26+
type Specific<Left = void, Right = void> = Right extends undefined | void
27+
? Left
28+
: Right
2929

3030
// Create a processor based on the input/output of a plugin.
3131
type UsePlugin<
@@ -71,8 +71,6 @@ type UsePlugin<
7171
// just keep it as it was.
7272
Processor<ParseTree, CurrentTree, CompileTree, CompileResult>
7373

74-
/* eslint-enable @typescript-eslint/naming-convention */
75-
7674
/**
7775
* Processor allows plugins to be chained together to transform content.
7876
* The chain of plugins defines how content flows through it.
@@ -203,7 +201,7 @@ export type Processor<
203201
* Current processor.
204202
*/
205203
use(
206-
presetOrList: Preset | PluggableList
204+
presetOrList: PluggableList | Preset
207205
): Processor<ParseTree, CurrentTree, CompileTree, CompileResult>
208206
} & FrozenProcessor<ParseTree, CurrentTree, CompileTree, CompileResult>
209207

@@ -238,6 +236,7 @@ export type FrozenProcessor<
238236
attachers: Array<[Plugin, ...unknown[]]>
239237

240238
Parser?: Parser<Specific<Node, ParseTree>> | undefined
239+
241240
Compiler?:
242241
| Compiler<Specific<Node, CompileTree>, Specific<unknown, CompileResult>>
243242
| undefined
@@ -656,7 +655,7 @@ export type Transformer<
656655
node: Input,
657656
file: VFile,
658657
next: TransformCallback<Output>
659-
) => Promise<Output | undefined | void> | Output | Error | undefined | void
658+
) => Promise<Output | undefined | void> | Error | Output | undefined | void
660659

661660
/**
662661
* Callback you must call when a transformer is done.

0 commit comments

Comments
 (0)