From a7a161e152eeeb3d57ec49cd4e132dd9afa50f5e Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Wed, 26 May 2021 10:57:58 +0200 Subject: [PATCH] Update prettier and other dependencies --- package.json | 32 ++++++++++++++++---------------- src/emitter.ts | 7 ++++--- src/expose.ts | 2 +- src/helpers.ts | 4 ++-- src/idlfetcher.ts | 12 ++++++------ src/widlprocess.ts | 17 +++++++---------- 6 files changed, 36 insertions(+), 38 deletions(-) diff --git a/package.json b/package.json index 50b76472e..6f2f4f1a2 100644 --- a/package.json +++ b/package.json @@ -17,24 +17,24 @@ }, "dependencies": { "@mdn/browser-compat-data": "2.0.7", - "@types/jsdom": "^16.2.4", - "@types/node": "^14.6.4", - "@types/node-fetch": "^2.5.7", - "@types/webidl2": "^23.13.2", - "@typescript-eslint/eslint-plugin": "^4.16.1", - "@typescript-eslint/parser": "^4.16.1", - "cpx2": "^2.0.0", - "danger": "^10.5.4", - "eslint": "^7.21.0", - "eslint-config-prettier": "^8.1.0", - "eslint-plugin-prettier": "^3.3.1", - "jsdom": "^16.4.0", + "@types/jsdom": "^16.2.10", + "@types/node": "^15.6.1", + "@types/node-fetch": "^2.5.10", + "@types/webidl2": "^23.13.5", + "@typescript-eslint/eslint-plugin": "^4.25.0", + "@typescript-eslint/parser": "^4.25.0", + "cpx2": "^3.0.0", + "danger": "^10.6.4", + "eslint": "^7.27.0", + "eslint-config-prettier": "^8.3.0", + "eslint-plugin-prettier": "^3.4.0", + "jsdom": "^16.6.0", "node-fetch": "^2.6.1", - "parse-diff": "^0.7.0", - "prettier": "^2.2.1", + "parse-diff": "^0.8.1", + "prettier": "^2.3.0", "print-diff": "^1.0.0", - "styleless-innertext": "^1.1.2", + "styleless-innertext": "^1.1.3", "typescript": "^4.3.0-dev.20210327", - "webidl2": "^23.13.1" + "webidl2": "^24.1.1" } } diff --git a/src/emitter.ts b/src/emitter.ts index 1e115218e..2d4316613 100644 --- a/src/emitter.ts +++ b/src/emitter.ts @@ -413,9 +413,10 @@ export function emitWebIdl( return type; } - function convertDomTypeToTsTypeWorker( - obj: Browser.Typed - ): { name: string; nullable: boolean } { + function convertDomTypeToTsTypeWorker(obj: Browser.Typed): { + name: string; + nullable: boolean; + } { let type; if (typeof obj.type === "string") { type = { diff --git a/src/expose.ts b/src/expose.ts index 6636a6efe..2bb2e4a47 100644 --- a/src/expose.ts +++ b/src/expose.ts @@ -194,7 +194,7 @@ function deepClone(o: T, custom: (o: any) => any): T { return o; } if (Array.isArray(o)) { - return (o.map((v) => deepClone(v, custom)) as any) as T; + return o.map((v) => deepClone(v, custom)) as any as T; } const mapped = custom(o); if (mapped !== undefined) { diff --git a/src/helpers.ts b/src/helpers.ts index 79fcded74..60ef97a4b 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -65,9 +65,9 @@ export function filter( ): T { if (typeof obj === "object") { if (Array.isArray(obj)) { - return (mapDefined(obj, (e) => + return mapDefined(obj, (e) => fn(e, undefined) ? filter(e, fn) : undefined - ) as any) as T; + ) as any as T; } else { const result: any = {}; for (const e in obj) { diff --git a/src/idlfetcher.ts b/src/idlfetcher.ts index 61859ff8e..b27243310 100644 --- a/src/idlfetcher.ts +++ b/src/idlfetcher.ts @@ -26,9 +26,9 @@ const cssPropSelector = [ ].join(","); async function fetchIDLs(filter: string[]) { - const idlSources = (require("../inputfiles/idlSources.json") as IDLSource[]).filter( - (source) => !filter.length || filter.includes(source.title) - ); + const idlSources = ( + require("../inputfiles/idlSources.json") as IDLSource[] + ).filter((source) => !filter.length || filter.includes(source.title)); await Promise.all( idlSources.map(async (source) => { const { idl, comments } = await fetchIDL(source); @@ -92,9 +92,9 @@ function extractIDL(dom: DocumentFragment) { } function extractCSSDefinitions(dom: DocumentFragment) { - const properties = Array.from( - dom.querySelectorAll(cssPropSelector) - ).map((element) => element.textContent!.trim()); + const properties = Array.from(dom.querySelectorAll(cssPropSelector)).map( + (element) => element.textContent!.trim() + ); if (!properties.length) { return ""; diff --git a/src/widlprocess.ts b/src/widlprocess.ts index ca79fa224..f1e90c1c2 100644 --- a/src/widlprocess.ts +++ b/src/widlprocess.ts @@ -29,13 +29,11 @@ export function convert(text: string, commentMap: Record) { } else if (rootType.type === "namespace") { browser.namespaces!.push(convertNamespace(rootType, commentMap)); } else if (rootType.type === "callback interface") { - browser["callback-interfaces"]!.interface[ - rootType.name - ] = convertInterfaceCommon(rootType, commentMap); + browser["callback-interfaces"]!.interface[rootType.name] = + convertInterfaceCommon(rootType, commentMap); } else if (rootType.type === "callback") { - browser["callback-functions"]!["callback-function"][ - rootType.name - ] = convertCallbackFunctions(rootType); + browser["callback-functions"]!["callback-function"][rootType.name] = + convertCallbackFunctions(rootType); addComments( browser["callback-functions"]!["callback-function"][rootType.name], commentMap, @@ -79,10 +77,9 @@ function getExtAttr(extAttrs: webidl2.ExtendedAttribute[], name: string) { attr.rhs.type === "string-list" || attr.rhs.type === "decimal-list" || attr.rhs.type === "integer-list" - ? (attr.rhs - .value as webidl2.ExtendedAttributeRightHandSideIdentifier[]).map( - (item) => item.value - ) + ? ( + attr.rhs.value as webidl2.ExtendedAttributeRightHandSideIdentifier[] + ).map((item) => item.value) : [attr.rhs.value]; }