Skip to content

Commit 3a30c56

Browse files
authored
style: prettier (#65)
1 parent d5fd26f commit 3a30c56

File tree

3 files changed

+46
-22
lines changed

3 files changed

+46
-22
lines changed

index.d.ts

Lines changed: 36 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export declare namespace Base {
2-
interface Options { }
2+
interface Options {}
33
}
44

55
declare type ApiExtension = {
@@ -23,33 +23,43 @@ declare type UnionToIntersection<Union> = (
2323
declare type AnyFunction = (...args: any) => any;
2424
declare type ReturnTypeOf<T extends AnyFunction | AnyFunction[]> =
2525
T extends AnyFunction
26-
? ReturnType<T>
27-
: T extends AnyFunction[]
28-
? UnionToIntersection<Exclude<ReturnType<T[number]>, void>>
29-
: never;
26+
? ReturnType<T>
27+
: T extends AnyFunction[]
28+
? UnionToIntersection<Exclude<ReturnType<T[number]>, void>>
29+
: never;
3030

3131
type ClassWithPlugins = Constructor<any> & {
3232
plugins: Plugin[];
3333
};
3434

3535
type RemainingRequirements<PredefinedOptions> =
3636
keyof PredefinedOptions extends never
37-
? Base.Options
38-
: Omit<Base.Options, keyof PredefinedOptions>
37+
? Base.Options
38+
: Omit<Base.Options, keyof PredefinedOptions>;
3939

4040
type NonOptionalKeys<Obj> = {
4141
[K in keyof Obj]: {} extends Pick<Obj, K> ? undefined : K;
4242
}[keyof Obj];
4343

44-
type RequiredIfRemaining<PredefinedOptions, NowProvided> =
45-
NonOptionalKeys<RemainingRequirements<PredefinedOptions>> extends undefined
44+
type RequiredIfRemaining<PredefinedOptions, NowProvided> = NonOptionalKeys<
45+
RemainingRequirements<PredefinedOptions>
46+
> extends undefined
4647
? [(Partial<Base.Options> & NowProvided)?]
47-
: [Partial<Base.Options> & RemainingRequirements<PredefinedOptions> & NowProvided];
48+
: [
49+
Partial<Base.Options> &
50+
RemainingRequirements<PredefinedOptions> &
51+
NowProvided
52+
];
4853

49-
type ConstructorRequiringVersion<Class extends ClassWithPlugins, PredefinedOptions> = {
54+
type ConstructorRequiringVersion<
55+
Class extends ClassWithPlugins,
56+
PredefinedOptions
57+
> = {
5058
defaultOptions: PredefinedOptions;
5159
} & {
52-
new <NowProvided>(...options: RequiredIfRemaining<PredefinedOptions, NowProvided>): Class & {
60+
new <NowProvided>(
61+
...options: RequiredIfRemaining<PredefinedOptions, NowProvided>
62+
): Class & {
5363
options: NowProvided & PredefinedOptions;
5464
};
5565
};
@@ -78,12 +88,12 @@ export declare class Base<TOptions extends Base.Options = Base.Options> {
7888
*/
7989
static plugin<
8090
Class extends ClassWithPlugins,
81-
Plugins extends [Plugin, ...Plugin[]],
82-
>(
83-
this: Class,
84-
...plugins: Plugins,
91+
Plugins extends [Plugin, ...Plugin[]]
92+
>(
93+
this: Class,
94+
...plugins: Plugins
8595
): Class & {
86-
plugins: [...Class['plugins'], ...Plugins];
96+
plugins: [...Class["plugins"], ...Plugins];
8797
} & Constructor<UnionToIntersection<ReturnTypeOf<Plugins>>>;
8898

8999
/**
@@ -104,7 +114,8 @@ export declare class Base<TOptions extends Base.Options = Base.Options> {
104114
*/
105115
static defaults<
106116
PredefinedOptionsOne,
107-
ClassOne extends Constructor<Base<Base.Options & PredefinedOptionsOne>> & ClassWithPlugins
117+
ClassOne extends Constructor<Base<Base.Options & PredefinedOptionsOne>> &
118+
ClassWithPlugins
108119
>(
109120
this: ClassOne,
110121
defaults: PredefinedOptionsOne
@@ -122,8 +133,12 @@ export declare class Base<TOptions extends Base.Options = Base.Options> {
122133
): ConstructorRequiringVersion<
123134
ClassOne & ClassTwo & ClassThree,
124135
PredefinedOptionsOne & PredefinedOptionsTwo & PredefinedOptionsThree
125-
> & ClassOne & ClassTwo & ClassThree;
126-
} & ClassOne & ClassTwo;
136+
> &
137+
ClassOne &
138+
ClassTwo &
139+
ClassThree;
140+
} & ClassOne &
141+
ClassTwo;
127142
} & ClassOne;
128143

129144
static defaultOptions: {};
@@ -135,4 +150,4 @@ export declare class Base<TOptions extends Base.Options = Base.Options> {
135150

136151
constructor(options: TOptions);
137152
}
138-
export { };
153+
export {};

package-lock.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
},
1212
"types": "./index.d.ts",
1313
"scripts": {
14-
"test": "npm run -s test:code && npm run -s test:typescript && npm run -s test:coverage",
14+
"lint": "prettier --check '*.{md,json,js,ts}' 'examples/**' 'plugins/**'",
15+
"lint:fix": "prettier --write '*.{md,json,js,ts}' 'examples/**' 'plugins/**'",
16+
"test": "npm run -s test:code && npm run -s test:typescript && npm run -s test:coverage && npm run -s lint",
1517
"test:code": "c8 uvu . '^(examples/.*/)?test.js$'",
1618
"test:coverage": "c8 check-coverage",
1719
"test:typescript": "tsd && tsd examples/*"
@@ -32,6 +34,7 @@
3234
"license": "ISC",
3335
"devDependencies": {
3436
"c8": "^7.7.2",
37+
"prettier": "^2.3.2",
3538
"tsd": "^0.17.0",
3639
"uvu": "^0.5.1"
3740
},

0 commit comments

Comments
 (0)