Skip to content

Commit 03b3857

Browse files
committed
Fixing linter
1 parent 898bad6 commit 03b3857

20 files changed

+238
-239
lines changed

deploy/createTypesPackages.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ const go = async () => {
8686
pkg.files.forEach((fileRef) => {
8787
fs.copyFileSync(
8888
new URL(fileRef.from, import.meta.url),
89-
new URL(fileRef.to, packagePath),
89+
new URL(fileRef.to, packagePath)
9090
);
9191
});
9292

@@ -120,7 +120,7 @@ async function updatePackageJSON(pkg, packagePath) {
120120
let version = "0.0.1";
121121
try {
122122
const npmResponse = await fetch(
123-
`https://registry.npmjs.org/${packageJSON.name}`,
123+
`https://registry.npmjs.org/${packageJSON.name}`
124124
);
125125
/** @type {*} */
126126
const npmPackage = await npmResponse.json();
@@ -145,7 +145,7 @@ async function updatePackageJSON(pkg, packagePath) {
145145
pkgJSONPath,
146146
await format(JSON.stringify(packageJSON), {
147147
filepath: fileURLToPath(pkgJSONPath),
148-
}),
148+
})
149149
);
150150

151151
return packageJSON;
@@ -167,7 +167,7 @@ function copyREADME(pkg, pkgJSON, writePath) {
167167
.replace("{{version}}", pkgJSON.version)
168168
.replace(
169169
"{{release_href}}",
170-
`https://github.com/microsoft/TypeScript-DOM-lib-generator/releases/tag/${htmlEncodedTag}`,
170+
`https://github.com/microsoft/TypeScript-DOM-lib-generator/releases/tag/${htmlEncodedTag}`
171171
);
172172

173173
fs.writeFileSync(writePath, readme);
@@ -200,7 +200,7 @@ export function postProcessDTSFiles(pkg, packagePath) {
200200
iterateThroughFiles((content) => {
201201
return content.replace(
202202
"abort(reason?: any): AbortSignal;",
203-
"// abort(reason?: any): AbortSignal; - To be re-added in the future",
203+
"// abort(reason?: any): AbortSignal; - To be re-added in the future"
204204
);
205205
});
206206

deploy/deployChangedPackages.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ for (const dirName of fs.readdirSync(generatedDir)) {
6161

6262
try {
6363
const oldFile = await getFileFromUnpkg(
64-
`${pkgJSON.name}@${olderVersion}/${filemap.to}`,
64+
`${pkgJSON.name}@${olderVersion}/${filemap.to}`
6565
);
6666
console.log(` - ${file}`);
6767
if (oldFile !== generatedDTSContent)
@@ -100,13 +100,13 @@ Assuming that this means we need to upload this package.`);
100100

101101
await createRelease(
102102
`${pkgJSON.name}@${pkgJSON.version}`,
103-
releaseNotes.join("\n\n"),
103+
releaseNotes.join("\n\n")
104104
);
105105
}
106106
} else {
107107
console.log(
108108
"Wanting to run: 'npm publish --access public' in " +
109-
fileURLToPath(packageDir),
109+
fileURLToPath(packageDir)
110110
);
111111
}
112112

@@ -148,7 +148,7 @@ async function createRelease(tag, body) {
148148
});
149149
} catch (error) {
150150
console.error(
151-
"Creating the GitHub release failed, this is likely due to re-running the deploy.",
151+
"Creating the GitHub release failed, this is likely due to re-running the deploy."
152152
);
153153
}
154154
}
@@ -157,7 +157,7 @@ function verify() {
157157
const authToken = process.env.GITHUB_TOKEN || process.env.GITHUB_API_TOKEN;
158158
if (!authToken) {
159159
throw new Error(
160-
"There isn't an ENV var set up for creating a GitHub release, expected GITHUB_TOKEN.",
160+
"There isn't an ENV var set up for creating a GitHub release, expected GITHUB_TOKEN."
161161
);
162162
}
163163
}

deploy/migrate.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@ const tscWD = maybeTSWorkingDir.find((wd) => existsSync(wd));
1414

1515
if (!tscWD)
1616
throw new Error(
17-
"Could not find a TypeScript clone to put the generated files in.",
17+
"Could not find a TypeScript clone to put the generated files in."
1818
);
1919

2020
const generatedFiles = readdirSync("generated");
2121
const filesToSend = generatedFiles.filter(
22-
(file) => file.includes("dom.") || file.includes("webworker."),
22+
(file) => file.includes("dom.") || file.includes("webworker.")
2323
);
2424

2525
const generatedDir = new URL("../generated/", import.meta.url);
2626
postProcessDTSFiles(
2727
/** @type {any} */
2828
({ files: filesToSend.map((f) => ({ to: f })) }),
29-
generatedDir,
29+
generatedDir
3030
);
3131

3232
filesToSend.forEach((file) => {
@@ -38,5 +38,5 @@ filesToSend.forEach((file) => {
3838
console.log(
3939
`Moved ${filesToSend
4040
.map((f) => f.replace(".generated", ""))
41-
.join(", ")} to '${tscWD}/src/lib'.`,
41+
.join(", ")} to '${tscWD}/src/lib'.`
4242
);

deploy/versionChangelog.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { basename } from "path";
99
const [name, before, to] = process.argv.slice(2);
1010
if (!name || !before || !to) {
1111
throw new Error(
12-
"Expected three arguments: package name, version before, version to",
12+
"Expected three arguments: package name, version before, version to"
1313
);
1414
}
1515

src/build.ts

+17-17
Original file line numberDiff line numberDiff line change
@@ -41,30 +41,30 @@ interface EmitOptions {
4141
async function emitFlavor(
4242
webidl: Browser.WebIdl,
4343
forceKnownTypes: Set<string>,
44-
options: EmitOptions,
44+
options: EmitOptions
4545
) {
4646
const exposed = getExposedTypes(webidl, options.global, forceKnownTypes);
4747
mergeNamesakes(exposed);
4848

4949
const result = emitWebIdl(exposed, options.global[0], "");
5050
await fs.writeFile(
5151
new URL(`${options.name}.generated.d.ts`, options.outputFolder),
52-
result,
52+
result
5353
);
5454

5555
const iterators = emitWebIdl(exposed, options.global[0], "sync");
5656
await fs.writeFile(
5757
new URL(`${options.name}.iterable.generated.d.ts`, options.outputFolder),
58-
iterators,
58+
iterators
5959
);
6060

6161
const asyncIterators = emitWebIdl(exposed, options.global[0], "async");
6262
await fs.writeFile(
6363
new URL(
6464
`${options.name}.asynciterable.generated.d.ts`,
65-
options.outputFolder,
65+
options.outputFolder
6666
),
67-
asyncIterators,
67+
asyncIterators
6868
);
6969
}
7070

@@ -118,7 +118,7 @@ async function emitDom() {
118118

119119
const transferables = widlStandardTypes.flatMap((st) => {
120120
return Object.values(st.browser.interfaces?.interface ?? {}).filter(
121-
(i) => i.transferable,
121+
(i) => i.transferable
122122
);
123123
});
124124

@@ -152,12 +152,12 @@ async function emitDom() {
152152

153153
function mergeApiDescriptions(
154154
idl: Browser.WebIdl,
155-
descriptions: Record<string, string>,
155+
descriptions: Record<string, string>
156156
) {
157157
const namespaces = arrayToMap(
158158
idl.namespaces!,
159159
(i) => i.name,
160-
(i) => i,
160+
(i) => i
161161
);
162162
for (const [key, value] of Object.entries(descriptions)) {
163163
const target = idl.interfaces!.interface[key] || namespaces[key];
@@ -170,12 +170,12 @@ async function emitDom() {
170170

171171
function mergeDeprecatedMessage(
172172
idl: Browser.WebIdl,
173-
descriptions: Record<string, string>,
173+
descriptions: Record<string, string>
174174
) {
175175
const namespaces = arrayToMap(
176176
idl.namespaces!,
177177
(i) => i.name,
178-
(i) => i,
178+
(i) => i
179179
);
180180
for (const [key, value] of Object.entries(descriptions)) {
181181
const target = idl.interfaces!.interface[key] || namespaces[key];
@@ -301,7 +301,7 @@ async function emitDom() {
301301

302302
function prune(
303303
obj: Browser.WebIdl,
304-
template: Partial<Browser.WebIdl>,
304+
template: Partial<Browser.WebIdl>
305305
): Browser.WebIdl {
306306
return filterByNull(obj, template);
307307

@@ -312,13 +312,13 @@ async function emitDom() {
312312
if (!obj[k]) {
313313
console.warn(
314314
`removedTypes.json has a redundant field ${k} in ${JSON.stringify(
315-
template,
316-
).slice(0, 100)}`,
315+
template
316+
).slice(0, 100)}`
317317
);
318318
} else if (Array.isArray(template[k])) {
319319
if (!Array.isArray(obj[k])) {
320320
throw new Error(
321-
`Removal template ${k} is an array but the original field is not`,
321+
`Removal template ${k} is an array but the original field is not`
322322
);
323323
}
324324
// template should include strings
@@ -328,18 +328,18 @@ async function emitDom() {
328328
});
329329
if (filtered[k].length !== obj[k].length - template[k].length) {
330330
const differences = template[k].filter(
331-
(t: any) => !obj[k].includes(t),
331+
(t: any) => !obj[k].includes(t)
332332
);
333333
console.warn(
334-
`removedTypes.json has redundant array items: ${differences}`,
334+
`removedTypes.json has redundant array items: ${differences}`
335335
);
336336
}
337337
} else if (template[k] !== null) {
338338
filtered[k] = filterByNull(obj[k], template[k]);
339339
} else {
340340
if (obj[k].exposed === "") {
341341
console.warn(
342-
`removedTypes.json removes ${k} that has already been disabled by BCD.`,
342+
`removedTypes.json removes ${k} that has already been disabled by BCD.`
343343
);
344344
}
345345
delete filtered[k];

src/build/bcd.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { hasStableImplementation } from "./bcd/stable.js";
1010

1111
function hasMultipleImplementations(support: SupportBlock, prefix?: string) {
1212
const hasStableImpl = (
13-
browser: SimpleSupportStatement | SimpleSupportStatement[] | undefined,
13+
browser: SimpleSupportStatement | SimpleSupportStatement[] | undefined
1414
) => hasStableImplementation(browser, prefix);
1515
let count = 0;
1616
if (hasStableImpl(support.chrome) || hasStableImpl(support.chrome_android)) {
@@ -32,7 +32,7 @@ function isSuitable(
3232
key: string,
3333
compat?: CompatStatement,
3434
parentKey?: string,
35-
prefix?: string,
35+
prefix?: string
3636
) {
3737
const forceAlive = parentKey
3838
? forceKeepAlive[parentKey]?.includes(key)

src/build/bcd/mapper.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function mergeCompatStatements(data?: Identifier): CompatStatement | undefined {
3535
const base = Object.fromEntries(
3636
Object.keys(statements[0].support).map((key) => {
3737
return [key, [] as SimpleSupportStatement[]];
38-
}),
38+
})
3939
);
4040

4141
for (const statement of statements) {
@@ -56,13 +56,13 @@ function mergeCompatStatements(data?: Identifier): CompatStatement | undefined {
5656
function mapInterfaceLike(
5757
name: string,
5858
i: Browser.Interface,
59-
mapper: (data: DataToMap) => any,
59+
mapper: (data: DataToMap) => any
6060
) {
6161
const data = i.mixin
6262
? api.__mixins[name]
6363
: i.legacyNamespace
64-
? api[i.legacyNamespace][name]
65-
: api[name];
64+
? api[i.legacyNamespace][name]
65+
: api[name];
6666
const intCompat = data?.__compat;
6767
const mapped = mapper({ key: name, compat: intCompat, mixin: !!i.mixin });
6868
if (!data) {
@@ -87,7 +87,7 @@ function mapInterfaceLike(
8787
const properties = filterMapRecord(
8888
i.properties?.property,
8989
recordMapper,
90-
i.namespace,
90+
i.namespace
9191
);
9292

9393
if (i.iterator) {
@@ -96,7 +96,7 @@ function mapInterfaceLike(
9696
// for iterable methods such as values(). Use that as a fallback.
9797
// See also: https://github.com/mdn/browser-compat-data/issues/6367
9898
const iteratorCompat = mergeCompatStatements(
99-
data[iteratorKey] ?? data["values"],
99+
data[iteratorKey] ?? data["values"]
100100
);
101101
const iteratorMapped = mapper({
102102
key: iteratorKey,
@@ -122,15 +122,15 @@ function mapInterfaceLike(
122122

123123
export function mapToBcdCompat(
124124
webidl: Browser.WebIdl,
125-
mapper: (data: DataToMap) => any,
125+
mapper: (data: DataToMap) => any
126126
): Browser.WebIdl | undefined {
127127
const map = (name: string, i: Browser.Interface) =>
128128
mapInterfaceLike(name, i, mapper);
129129

130130
const interfaces = filterMapRecord(webidl.interfaces?.interface, map);
131131
const mixins = filterMapRecord(webidl.mixins?.mixin, map);
132132
const namespaces = mapDefined(webidl.namespaces, (n) =>
133-
mapInterfaceLike(n.name, n, mapper),
133+
mapInterfaceLike(n.name, n, mapper)
134134
);
135135
if (
136136
!isEmptyRecord(interfaces) ||

src/build/bcd/stable.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { SimpleSupportStatement } from "@mdn/browser-compat-data/types";
22

33
export function hasStableImplementation(
44
browser: SimpleSupportStatement | SimpleSupportStatement[] | undefined,
5-
prefix?: string,
5+
prefix?: string
66
): boolean {
77
if (!browser) {
88
return false;

0 commit comments

Comments
 (0)