Skip to content

Commit 1865902

Browse files
committed
refactor: fix formatting
1 parent 1b5ddb2 commit 1865902

36 files changed

+288
-289
lines changed

.prettierignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
**/*.json
1+
**/*.json
2+
/.yarn/**/*

.prettierrc.mjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
/** @type {import("prettier").Options} */
1+
/**
2+
* @type {import("prettier").Options}
3+
*/
24
const config = {
35
bracketSpacing: true,
46
tabWidth: 2,

__tests__/polyfills/fs/access-file.test.ts

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ const executableFile =
2626
GLib.get_current_dir() + "/__tests__/polyfills/fs/files/executable";
2727

2828
const mustCall = <
29-
F extends (...args: any[]) => any = (err?: any, ...args: any[]) => void
29+
F extends (...args: any[]) => any = (err?: any, ...args: any[]) => void,
3030
>(
31-
run: (cb: F) => any
31+
run: (cb: F) => any,
3232
) => {
3333
return new Promise<FunctionMock<F>>((resolve, reject) => {
3434
const t = setTimeout(() => {
@@ -79,7 +79,7 @@ export default describe("fs.access", () => {
7979
expect(mock1).toHaveBeenCalledWithLast(null);
8080

8181
const mock2 = await mustCall((cb) =>
82-
fs.access(thisFile, fs.constants.R_OK, cb)
82+
fs.access(thisFile, fs.constants.R_OK, cb),
8383
);
8484
expect(mock2).toHaveBeenCalledWithLast(null);
8585
});
@@ -89,7 +89,7 @@ export default describe("fs.access", () => {
8989
expect(mock1).toHaveBeenCalledWithLast(null);
9090

9191
const mock2 = await mustCall((cb) =>
92-
fs.access(readOnlyFile, fs.constants.W_OK, cb)
92+
fs.access(readOnlyFile, fs.constants.W_OK, cb),
9393
);
9494
expect(mock2).toHaveBeenCalledWithLast(match.instanceOf(Error));
9595
});
@@ -99,13 +99,13 @@ export default describe("fs.access", () => {
9999
expect(mock1).toHaveBeenCalledWithLast(null);
100100

101101
const mock2 = await mustCall((cb) =>
102-
fs.access(nonReadableFile, fs.constants.R_OK, cb)
102+
fs.access(nonReadableFile, fs.constants.R_OK, cb),
103103
);
104104
expect(mock2).toHaveBeenCalledWithLast(
105105
match.allOf(match.instanceOf(Error), {
106106
code: "EACCES",
107107
path: nonReadableFile,
108-
})
108+
}),
109109
);
110110
});
111111

@@ -115,25 +115,25 @@ export default describe("fs.access", () => {
115115
match.allOf(match.instanceOf(Error), {
116116
code: "ENOENT",
117117
path: nonExistentFile,
118-
})
118+
}),
119119
);
120120
});
121121

122122
it("should correctly report access to a non-executable file", async () => {
123123
const mock = await mustCall((cb) =>
124-
fs.access(thisFile, fs.constants.X_OK, cb)
124+
fs.access(thisFile, fs.constants.X_OK, cb),
125125
);
126126
expect(mock).toHaveBeenCalledWithLast(
127127
match.allOf(match.instanceOf(Error), {
128128
code: "EACCES",
129129
path: thisFile,
130-
})
130+
}),
131131
);
132132
});
133133

134134
it("should correctly report access to an executable file", async () => {
135135
const mock = await mustCall((cb) =>
136-
fs.access(executableFile, fs.constants.X_OK, cb)
136+
fs.access(executableFile, fs.constants.X_OK, cb),
137137
);
138138
expect(mock).toHaveBeenCalledWithLast(null);
139139
});
@@ -143,14 +143,14 @@ export default describe("fs.access", () => {
143143
expect(() => fs.access(thisFile)).toThrowMatch(
144144
match.allOf(match.instanceOf(TypeError), {
145145
code: "ERR_INVALID_ARG_TYPE",
146-
})
146+
}),
147147
);
148148

149149
// @ts-expect-error
150150
expect(() => fs.access(thisFile, fs.constants.R_OK)).toThrowMatch(
151151
match.allOf(match.instanceOf(TypeError), {
152152
code: "ERR_INVALID_ARG_TYPE",
153-
})
153+
}),
154154
);
155155
});
156156
});
@@ -171,7 +171,7 @@ export default describe("fs.access", () => {
171171
expect(result1).toBe(undefined);
172172

173173
expect(() => fs.accessSync(readOnlyFile, fs.constants.W_OK)).toThrowMatch(
174-
match.instanceOf(Error)
174+
match.instanceOf(Error),
175175
);
176176
});
177177

@@ -180,12 +180,12 @@ export default describe("fs.access", () => {
180180
expect(result1).toBe(undefined);
181181

182182
expect(() =>
183-
fs.accessSync(nonReadableFile, fs.constants.R_OK)
183+
fs.accessSync(nonReadableFile, fs.constants.R_OK),
184184
).toThrowMatch(
185185
match.allOf(match.instanceOf(Error), {
186186
code: "EACCES",
187187
path: nonReadableFile,
188-
})
188+
}),
189189
);
190190
});
191191

@@ -194,13 +194,13 @@ export default describe("fs.access", () => {
194194
match.allOf(match.instanceOf(Error), {
195195
code: "ENOENT",
196196
path: nonExistentFile,
197-
})
197+
}),
198198
);
199199
});
200200

201201
it("should correctly report access to a non-executable file", () => {
202202
expect(() => fs.accessSync(thisFile, fs.constants.X_OK)).toThrowMatch(
203-
match.instanceOf(Error)
203+
match.instanceOf(Error),
204204
);
205205
});
206206

@@ -226,7 +226,7 @@ export default describe("fs.access", () => {
226226
expect(result1).toBe(undefined);
227227

228228
await expect(fs.access(readOnlyFile, fs.constants.W_OK)).toRejectMatch(
229-
match.instanceOf(Error)
229+
match.instanceOf(Error),
230230
);
231231
});
232232

@@ -238,7 +238,7 @@ export default describe("fs.access", () => {
238238
match.allOf(match.instanceOf(Error), {
239239
code: "EACCES",
240240
path: nonReadableFile,
241-
})
241+
}),
242242
);
243243
});
244244

@@ -247,13 +247,13 @@ export default describe("fs.access", () => {
247247
match.allOf(match.instanceOf(Error), {
248248
code: "ENOENT",
249249
path: nonExistentFile,
250-
})
250+
}),
251251
);
252252
});
253253

254254
it("should correctly report access to a non-executable file", async () => {
255255
await expect(fs.access(thisFile, fs.constants.X_OK)).toRejectMatch(
256-
match.instanceOf(Error)
256+
match.instanceOf(Error),
257257
);
258258
});
259259

__tests__/polyfills/fs/append-file.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ const file =
1010
GLib.get_current_dir() + "/__tests__/polyfills/fs/files/append-test";
1111

1212
const mustCall = <
13-
F extends (...args: any[]) => any = (err?: any, ...args: any[]) => void
13+
F extends (...args: any[]) => any = (err?: any, ...args: any[]) => void,
1414
>(
15-
run: (cb: F) => any
15+
run: (cb: F) => any,
1616
) => {
1717
return new Promise<FunctionMock<F>>((resolve, reject) => {
1818
const t = setTimeout(() => {
@@ -87,14 +87,14 @@ export default describe("fs.appendFile", () => {
8787
expect(() => fs.appendFile(file, s)).toThrowMatch(
8888
match.allOf(match.instanceOf(TypeError), {
8989
code: "ERR_INVALID_ARG_TYPE",
90-
})
90+
}),
9191
);
9292

9393
// @ts-expect-error
9494
expect(() => fs.appendFile(file, s, {})).toThrowMatch(
9595
match.allOf(match.instanceOf(TypeError), {
9696
code: "ERR_INVALID_ARG_TYPE",
97-
})
97+
}),
9898
);
9999
});
100100
});

__tests__/polyfills/fs/read-file.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ const nonExistentFile =
2222
GLib.get_current_dir() + "/__tests__/polyfills/fs/files/non-existent";
2323

2424
const mustCall = <
25-
F extends (...args: any[]) => any = (err?: any, ...args: any[]) => void
25+
F extends (...args: any[]) => any = (err?: any, ...args: any[]) => void,
2626
>(
27-
run: (cb: F) => any
27+
run: (cb: F) => any,
2828
) => {
2929
return new Promise<FunctionMock<F>>((resolve, reject) => {
3030
const t = setTimeout(() => {
@@ -101,7 +101,7 @@ export default describe("fs.readFile", () => {
101101
it("throws error when callback is not provided", async () => {
102102
// @ts-expect-error
103103
expect(() => fs.readFile(nonExistentFile)).toThrowMatch(
104-
match.instanceOf(Error)
104+
match.instanceOf(Error),
105105
);
106106
});
107107
});
@@ -127,13 +127,13 @@ export default describe("fs.readFile", () => {
127127

128128
it("throws error when reading from a non-readable file", () => {
129129
expect(() => fs.readFileSync(nonReadableFile)).toThrowMatch(
130-
match.instanceOf(Error)
130+
match.instanceOf(Error),
131131
);
132132
});
133133

134134
it("throws error when reading non-existent file", () => {
135135
expect(() => fs.readFileSync(nonExistentFile)).toThrowMatch(
136-
match.instanceOf(Error)
136+
match.instanceOf(Error),
137137
);
138138
});
139139
});
@@ -159,13 +159,13 @@ export default describe("fs.readFile", () => {
159159

160160
it("throws error when reading from a non-readable file", async () => {
161161
await expect(fs.readFile(nonReadableFile)).toRejectMatch(
162-
match.instanceOf(Error)
162+
match.instanceOf(Error),
163163
);
164164
});
165165

166166
it("throws error when reading non-existent file", async () => {
167167
await expect(fs.readFile(nonExistentFile)).toRejectMatch(
168-
match.instanceOf(Error)
168+
match.instanceOf(Error),
169169
);
170170
});
171171
});

__tests__/polyfills/fs/write-file.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ const readOnlyFile =
2020
GLib.get_current_dir() + "/__tests__/polyfills/fs/files/read-only-file";
2121

2222
const mustCall = <
23-
F extends (...args: any[]) => any = (err?: any, ...args: any[]) => void
23+
F extends (...args: any[]) => any = (err?: any, ...args: any[]) => void,
2424
>(
25-
run: (cb: F) => any
25+
run: (cb: F) => any,
2626
) => {
2727
return new Promise<FunctionMock<F>>((resolve, reject) => {
2828
const t = setTimeout(() => {
@@ -74,7 +74,7 @@ export default describe("fs.writeFile", () => {
7474

7575
it("accepts buffer", async () => {
7676
const mock = await mustCall((cb) =>
77-
fs.writeFile(file, Buffer.from(s), cb)
77+
fs.writeFile(file, Buffer.from(s), cb),
7878
);
7979
expect(mock).toHaveBeenCalledWithLast(null);
8080

@@ -85,19 +85,19 @@ export default describe("fs.writeFile", () => {
8585
it("throws when writing to a read-only file", async () => {
8686
const mock = await mustCall((cb) => fs.writeFile(readOnlyFile, s, cb));
8787
expect(mock).toHaveBeenCalledWithLast(
88-
match.allOf(match.instanceOf(Error))
88+
match.allOf(match.instanceOf(Error)),
8989
);
9090
});
9191

9292
it("throws when callback is not provided", async () => {
9393
// @ts-expect-error
9494
expect(() => fs.writeFile(file, s)).toThrowMatch(
95-
match.allOf(match.instanceOf(Error))
95+
match.allOf(match.instanceOf(Error)),
9696
);
9797

9898
// @ts-expect-error
9999
expect(() => fs.writeFile(file, s, {})).toThrowMatch(
100-
match.allOf(match.instanceOf(Error))
100+
match.allOf(match.instanceOf(Error)),
101101
);
102102
});
103103
});
@@ -119,7 +119,7 @@ export default describe("fs.writeFile", () => {
119119

120120
it("throws when writing to a read-only file", async () => {
121121
expect(() => fs.writeFileSync(readOnlyFile, s)).toThrowMatch(
122-
match.allOf(match.instanceOf(Error))
122+
match.allOf(match.instanceOf(Error)),
123123
);
124124
});
125125
});
@@ -141,7 +141,7 @@ export default describe("fs.writeFile", () => {
141141

142142
it("throws when writing to a read-only file", async () => {
143143
await expect(fs.writeFile(readOnlyFile, s)).toRejectMatch(
144-
match.allOf(match.instanceOf(Error))
144+
match.allOf(match.instanceOf(Error)),
145145
);
146146
});
147147
});

__tests__/utils/tracked-function.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ interface TrackedFunction<A extends any[], R> {
55
}
66

77
export const createFunction = <A extends any[], R>(
8-
fn: (...args: A) => R
8+
fn: (...args: A) => R,
99
): TrackedFunction<A, R> => {
1010
const calls: TrackedFunction<A, R>["calls"] = [];
1111

src/build.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ import { BundleProgram } from "./programs/bundle-program";
44
import { InitProgram } from "./programs/init-program";
55
import { StartProgram } from "./programs/start-program";
66

7-
/** Invokes the CLI program that builds the app. */
7+
/**
8+
* Invokes the CLI program that builds the app.
9+
*/
810
export async function build() {
911
configure((main) => {
1012
main.setDisplayName("react-gnome");
@@ -16,14 +18,14 @@ export async function build() {
1618
const initCmd = main.addSubCommand("init", () => new InitProgram());
1719

1820
bundleCmd.setDescription(
19-
"Create a bundled js file, without the tarball or meson configuration. This is useful if you want to manage the build process yourself."
21+
"Create a bundled js file, without the tarball or meson configuration. This is useful if you want to manage the build process yourself.",
2022
);
2123
buildCmd.setDescription(
22-
"Create a tarball and meson configuration thats ready to be installed."
24+
"Create a tarball and meson configuration thats ready to be installed.",
2325
);
2426
startCmd.setDescription("Build and run the app immediately after.");
2527
initCmd.setDescription(
26-
"Initialize a new project with the necessary files and scripts."
28+
"Initialize a new project with the necessary files and scripts.",
2729
);
2830
});
2931
}

0 commit comments

Comments
 (0)