From f68757316355bb931c0420a686082297978a370e Mon Sep 17 00:00:00 2001 From: Micha Reiser Date: Tue, 7 Jun 2022 18:03:25 +0200 Subject: [PATCH] chore: Reformat JS files with Rome 0.6.0 (#2669) Upgrade rome to 0.6.0 and reformat the playground and website files --- .github/workflows/pull_request_js.yml | 4 +- .../scripts/updateVersionForPrerelease.mjs | 4 +- editors/vscode/src/commands/syntaxTree.ts | 34 ++- editors/vscode/src/lsp_requests.ts | 18 +- editors/vscode/src/main.ts | 7 +- website/.eleventy.js | 67 ++--- website/api/server.js | 278 +++++++++--------- website/playground/package.json | 2 +- website/playground/pnpm-lock.yaml | 48 +-- website/playground/src/App.tsx | 4 +- website/playground/src/LineWidthInput.tsx | 5 +- website/playground/src/SourceTypeSelect.tsx | 13 +- website/playground/src/TreeView.tsx | 4 +- website/playground/src/utils.ts | 44 ++- website/playground/vite.config.ts | 2 +- website/playground/workers-site/index.js | 5 +- website/src/_data/env.js | 3 +- website/src/_includes/scripts/funding.js | 71 ++--- website/src/_includes/scripts/index.js | 22 +- 19 files changed, 341 insertions(+), 294 deletions(-) diff --git a/.github/workflows/pull_request_js.yml b/.github/workflows/pull_request_js.yml index 2b8b0a0b77b..b808fe57189 100644 --- a/.github/workflows/pull_request_js.yml +++ b/.github/workflows/pull_request_js.yml @@ -15,7 +15,7 @@ env: jobs: format-js: - name: Format JS Files + name: Check JS Files runs-on: ubuntu-latest steps: - name: Install Rome @@ -27,4 +27,4 @@ jobs: uses: actions/checkout@v3 - name: Run Rome Format - run: rome format --ci editors website + run: rome ci editors website diff --git a/editors/vscode/scripts/updateVersionForPrerelease.mjs b/editors/vscode/scripts/updateVersionForPrerelease.mjs index 0e55e503694..5cc3df86f17 100644 --- a/editors/vscode/scripts/updateVersionForPrerelease.mjs +++ b/editors/vscode/scripts/updateVersionForPrerelease.mjs @@ -37,8 +37,8 @@ readFile(manifestPath, "utf8") console.log("Could not write the package.json file at " + manifestPath); process.exit(1); } - }) + },) .catch(() => { console.log("Could not read the package.json file at " + manifestPath); process.exit(1); - }); + },); diff --git a/editors/vscode/src/commands/syntaxTree.ts b/editors/vscode/src/commands/syntaxTree.ts index f1a4aead33d..a457135b74c 100644 --- a/editors/vscode/src/commands/syntaxTree.ts +++ b/editors/vscode/src/commands/syntaxTree.ts @@ -79,9 +79,10 @@ class SyntaxTreeProvider } } - provideTextDocumentContent(uri: Uri, token: CancellationToken): ProviderResult< - string - > { + provideTextDocumentContent( + uri: Uri, + token: CancellationToken, + ): ProviderResult { let documentUri = this.session.editor.document.uri.toString(); // if the document is already cached, we show it const document = this.documents.get(documentUri); @@ -93,16 +94,16 @@ class SyntaxTreeProvider }; // send request to the server and store its content in the cache if successful - return this.session.client - .sendRequest(syntaxTreeRequest, params, token) - .then( - (result) => { - const document = new SyntaxTreeDocument(uri, result); - this.documents.set(documentUri, document); - - return document.value; - }, - ); + return this.session.client.sendRequest( + syntaxTreeRequest, + params, + token, + ).then((result) => { + const document = new SyntaxTreeDocument(uri, result); + this.documents.set(documentUri, document); + + return document.value; + },); } dispose(): any { @@ -113,9 +114,10 @@ class SyntaxTreeProvider return this.eventEmitter.event; } - provideDocumentLinks(document: TextDocument, token: CancellationToken): ProviderResult< - DocumentLink[] - > { + provideDocumentLinks( + document: TextDocument, + token: CancellationToken, + ): ProviderResult { const doc = this.documents.get(document.uri.toString()); if (doc) { return []; diff --git a/editors/vscode/src/lsp_requests.ts b/editors/vscode/src/lsp_requests.ts index 96d2e9af714..dbedb2353b1 100644 --- a/editors/vscode/src/lsp_requests.ts +++ b/editors/vscode/src/lsp_requests.ts @@ -1,10 +1,18 @@ -import { RequestType, TextDocumentIdentifier, Range } from "vscode-languageclient"; +import { + RequestType, + TextDocumentIdentifier, + Range, +} from "vscode-languageclient"; -export interface SyntaxTreeParams { textDocument: TextDocumentIdentifier } +export interface SyntaxTreeParams { + textDocument: TextDocumentIdentifier; +} /** * Request to send to the server when showing the syntax tree of a document */ -export const syntaxTreeRequest = new RequestType( - "rome/syntaxTree", -); +export const syntaxTreeRequest = new RequestType< + SyntaxTreeParams, + string, + void +>("rome/syntaxTree"); diff --git a/editors/vscode/src/main.ts b/editors/vscode/src/main.ts index 02ecf539ac2..61d7dc2cb14 100644 --- a/editors/vscode/src/main.ts +++ b/editors/vscode/src/main.ts @@ -1,5 +1,10 @@ import { ExtensionContext, Uri, window, workspace } from "vscode"; -import { LanguageClient, LanguageClientOptions, ServerOptions, TransportKind } from "vscode-languageclient/node"; +import { + LanguageClient, + LanguageClientOptions, + ServerOptions, + TransportKind, +} from "vscode-languageclient/node"; import { setContextValue } from "./utils"; import { Session } from "./session"; import { syntaxTree } from "./commands/syntaxTree"; diff --git a/website/.eleventy.js b/website/.eleventy.js index bacce6ad194..fda6c46adc2 100644 --- a/website/.eleventy.js +++ b/website/.eleventy.js @@ -25,7 +25,7 @@ const isProduction = process.env.ELEVENTY_ENV === "production"; module.exports = function (eleventyConfig) { - eleventyConfig.addPassthroughCopy({ "static": "." }); + eleventyConfig.addPassthroughCopy({ static: "." }); eleventyConfig.setUseGitIgnore(false); eleventyConfig.setLiquidOptions({ cache: true }); @@ -55,11 +55,10 @@ module.exports = permalinkAttrs: (slug) => ({ "aria-label": slug }), slugify: (title) => { return encodeURIComponent( - String(title) - .trim() - .toLowerCase() - .replace(/[^a-zA-Z\s0-9]/g, "") - .replace(/\s+/g, "-"), + String(title).trim().toLowerCase().replace( + /[^a-zA-Z\s0-9]/g, + "", + ).replace(/\s+/g, "-"), ); }, }, @@ -72,31 +71,29 @@ module.exports = "tagList", function (collection) { let tagSet = new Set(); - collection - .getAll() - .forEach(function (item) { - if ("tags" in item.data) { - let tags = item.data.tags; - - tags = - tags.filter(function (item) { - switch (item) { - // This list should match the `filter` list in tags.liquid - case "all": - case "nav": - case "post": - case "posts": - return false; - } - - return true; - }); - - for (const tag of tags) { - tagSet.add(tag); - } + collection.getAll().forEach(function (item) { + if ("tags" in item.data) { + let tags = item.data.tags; + + tags = + tags.filter(function (item) { + switch (item) { + // This list should match the `filter` list in tags.liquid + case "all": + case "nav": + case "post": + case "posts": + return false; + } + + return true; + },); + + for (const tag of tags) { + tagSet.add(tag); } - }); + } + },); // Returning an array in addCollection works in Eleventy 0.5.3 return [...tagSet]; @@ -194,11 +191,9 @@ module.exports = "blogSummary", (val) => { const lines = val.split("")[0].split("\n"); - return lines - .filter((line) => { - return line.startsWith("

"); - }) - .join("\n"); + return lines.filter((line) => { + return line.startsWith("

"); + },).join("\n"); }, ); @@ -251,7 +246,7 @@ module.exports = }, }, }, - }); + },); return { dir: { input: "src", output: "build" }, diff --git a/website/api/server.js b/website/api/server.js index caa0c1c48cb..b0651e8b907 100644 --- a/website/api/server.js +++ b/website/api/server.js @@ -39,10 +39,7 @@ const tiers = [ metal: "bronze", price: 25, rewards: ["Sticker"], - previousRewards: [ - "Cosmetic Discord role", - "Cosmetic label on GitHub issues", - ], + previousRewards: ["Cosmetic Discord role", "Cosmetic label on GitHub issues"], }, { id: "advocate", @@ -51,10 +48,7 @@ const tiers = [ metal: "silver", price: 50, rewards: ["Sticker pack"], - previousRewards: [ - "Cosmetic Discord role", - "Cosmetic label on GitHub issues", - ], + previousRewards: ["Cosmetic Discord role", "Cosmetic label on GitHub issues"], }, { id: "champion", @@ -247,7 +241,7 @@ async function getContributions(limit) { amount: Number(row.tierPrice) + Number(row.tip), time: new Date(row.createdAt).valueOf(), }; - }); + },); } async function getTierStats() { @@ -265,7 +259,7 @@ async function getTierStats() { ...tier, count: query.rows.length === 0 ? 0 : Number(query.rows[0].count), }; - }), + },), ); } @@ -275,7 +269,7 @@ async function getProgressStats() { db.query( `SELECT SUM("tierPrice") as "tierPrice", SUM("tip") as tip FROM contributions WHERE paid = true`, ), - ]); + ],); const count = countQuery.rows.length === 0 ? 0 : Number( countQuery.rows[0].count, @@ -316,31 +310,31 @@ function getAllContributions() { } async function getFreshStats() { - const [{ count, current, target }, recentContributions, tiers] = await Promise.all([ + const [ + { count, current, target }, + recentContributions, + tiers, + ] = await Promise.all([ getProgressStats(), getContributions(3), getTierStats(), - ]); + ],); return { count, current, target, recentContributions, tiers }; } app.get( "/funding/stats", - wrapAsyncCallback( - async (req, res) => { - res.json(await getStats()); - }, - ), + wrapAsyncCallback(async (req, res) => { + res.json(await getStats()); + },), ); app.get( "/funding/all", - wrapAsyncCallback( - async (req, res) => { - res.json(await getAllContributions()); - }, - ), + wrapAsyncCallback(async (req, res) => { + res.json(await getAllContributions()); + },), ); function generateRewardsDescription(tier) { @@ -356,137 +350,134 @@ function generateRewardsDescription(tier) { app.post( "/funding/checkout", bodyParser.json(), - wrapAsyncCallback( - async (req, res) => { - const { body } = req; + wrapAsyncCallback(async (req, res) => { + const { body } = req; - const email = ensureString(body.email); - const tierPrice = normalizeCurrency(body.tierPrice); - const tip = normalizeCurrency(body.tip); + const email = ensureString(body.email); + const tierPrice = normalizeCurrency(body.tierPrice); + const tip = normalizeCurrency(body.tip); - if (email === "") { - res.json({ error: "Missing email" }); - return; - } + if (email === "") { + res.json({ error: "Missing email" }); + return; + } - const tier = getTierFromAmount(tierPrice); - const lineItems = []; + const tier = getTierFromAmount(tierPrice); + const lineItems = []; + + lineItems.push({ + price_data: { + currency: "usd", + product_data: { + name: `${tier.name} Tier`, + description: generateRewardsDescription(tier), + metadata: { id: tier.id }, + }, + unit_amount: tierPrice * 100, + }, + quantity: 1, + },); + if (tip > 0) { lineItems.push({ price_data: { currency: "usd", - product_data: { - name: `${tier.name} Tier`, - description: generateRewardsDescription(tier), - metadata: { id: tier.id }, - }, - unit_amount: tierPrice * 100, + product_data: { name: "Tip" }, + unit_amount: tip * 100, }, quantity: 1, - }); - - if (tip > 0) { - lineItems.push({ - price_data: { - currency: "usd", - product_data: { name: "Tip" }, - unit_amount: tip * 100, - }, - quantity: 1, - }); - } - - const session = await stripe.checkout.sessions.create({ - payment_method_types: ["card"], - line_items: lineItems, - mode: "payment", - customer_email: email, - success_url: `${process.env.WEBSITE_URL}/funding/checkout-complete`, - cancel_url: `${process.env.WEBSITE_URL}/funding/`, - billing_address_collection: "required", - // Retain body in case of some database corruption - metadata: req.body, - // Don't request shipping address for custom donators - shipping_address_collection: tier.id !== "custom" && tierPrice > 10 ? constants.stripeShippingCollection : undefined, - }); - - const isPublic = ensureBoolean(body.public); - const publicName = ensureString(body.publicName, 100); - const publicComment = ensureString(body.publicComment, 500); - const twitter = normalizeUsername(body.twitter); - const github = normalizeUsername(body.github); - const discord = normalizeUsername(body.discord); - - await db.query( - `INSERT INTO contributions ("stripeSession", "email", "tierId", "tierPrice", "public", "publicName", "publicComment", "tip", "twitter", "github", "discord") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11);`, - [ - session.id, - email, - tier.id, - tierPrice, - isPublic, - publicName, - publicComment, - tip, - twitter, - github, - discord, - ], - ); + },); + } - res.json({ id: session.id }); - }, - ), + const session = await stripe.checkout.sessions.create({ + payment_method_types: ["card"], + line_items: lineItems, + mode: "payment", + customer_email: email, + success_url: `${process.env.WEBSITE_URL}/funding/checkout-complete`, + cancel_url: `${process.env.WEBSITE_URL}/funding/`, + billing_address_collection: "required", + // Retain body in case of some database corruption + metadata: req.body, + // Don't request shipping address for custom donators + shipping_address_collection: + tier.id !== "custom" && tierPrice > 10 ? constants.stripeShippingCollection : undefined, + },); + + const isPublic = ensureBoolean(body.public); + const publicName = ensureString(body.publicName, 100); + const publicComment = ensureString(body.publicComment, 500); + const twitter = normalizeUsername(body.twitter); + const github = normalizeUsername(body.github); + const discord = normalizeUsername(body.discord); + + await db.query( + `INSERT INTO contributions ("stripeSession", "email", "tierId", "tierPrice", "public", "publicName", "publicComment", "tip", "twitter", "github", "discord") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11);`, + [ + session.id, + email, + tier.id, + tierPrice, + isPublic, + publicName, + publicComment, + tip, + twitter, + github, + discord, + ], + ); + + res.json({ id: session.id }); + },), ); app.post( "/stripe-webhook", bodyParser.raw({ type: "application/json" }), - wrapAsyncCallback( - async (req, res) => { - const payload = req.body; - const sig = req.headers["stripe-signature"]; - const event = stripe.webhooks.constructEvent( - payload, - sig, - process.env.STRIPE_WEBHOOK_SECRET, + wrapAsyncCallback(async (req, res) => { + const payload = req.body; + const sig = req.headers["stripe-signature"]; + const event = stripe.webhooks.constructEvent( + payload, + sig, + process.env.STRIPE_WEBHOOK_SECRET, + ); + + // Handle the checkout.session.completed event + if (event.type === "checkout.session.completed") { + const session = event.data.object; + await db.query( + `UPDATE contributions SET paid = true WHERE "stripeSession" = $1 `, + [session.id], ); - // Handle the checkout.session.completed event - if (event.type === "checkout.session.completed") { - const session = event.data.object; - await db.query( - `UPDATE contributions SET paid = true WHERE "stripeSession" = $1 `, - [session.id], - ); - - // Refresh stats - cachedStats = undefined; - cachedAllContributions = undefined; - - // Purge cache from Cloudflare - await fetch( - `https://api.cloudflare.com/client/v4/zones/${process.env.CF_ZONE_ID}/purge_cache`, - { - method: "POST", - headers: { - "Content-Type": "application/json", - Authorization: `Bearer ${process.env.CF_SECRET}`, - }, - body: JSON.stringify({ - files: [ - `${process.env.API_URL}/funding/stats`, - `${process.env.API_URL}/funding/all`, - ], - }), + // Refresh stats + cachedStats = undefined; + cachedAllContributions = undefined; + + // Purge cache from Cloudflare + await fetch( + `https://api.cloudflare.com/client/v4/zones/${process.env.CF_ZONE_ID}/purge_cache`, + { + method: "POST", + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${process.env.CF_SECRET}`, }, - ); - } + body: JSON.stringify({ + files: [ + `${process.env.API_URL}/funding/stats`, + `${process.env.API_URL}/funding/all`, + ], + },), + }, + ); + } - res.status(200); - res.end(); - }, - ), + res.status(200); + res.end(); + },), ); app.use( @@ -515,12 +506,11 @@ async function main() { ); } -main() - .catch((err) => { - // rome-ignore lint/js/preferOptionalChaining: netlify's node version does not support optional call expressions - if (Sentry !== undefined) { - Sentry.captureException(err); - } - console.error(err.stack); - process.exit(1); - }); +main().catch((err) => { + // rome-ignore lint/js/preferOptionalChaining: netlify's node version does not support optional call expressions + if (Sentry !== undefined) { + Sentry.captureException(err); + } + console.error(err.stack); + process.exit(1); +},); diff --git a/website/playground/package.json b/website/playground/package.json index cbbf72038ba..360b180babe 100644 --- a/website/playground/package.json +++ b/website/playground/package.json @@ -30,7 +30,7 @@ "@vitejs/plugin-react": "^1.0.7", "autoprefixer": "^10.4.2", "postcss": "^8.4.6", - "rome": "0.5.0-next", + "rome": "0.6.0-next", "tailwindcss": "^3.0.19", "typescript": "^4.4.4", "vite": "^2.7.2" diff --git a/website/playground/pnpm-lock.yaml b/website/playground/pnpm-lock.yaml index 088418a59b7..ba34c595024 100644 --- a/website/playground/pnpm-lock.yaml +++ b/website/playground/pnpm-lock.yaml @@ -16,7 +16,7 @@ specifiers: react-dom: ^17.0.2 react-json-view: ^1.21.3 react-tabs: ^3.2.3 - rome: 0.5.0-next + rome: 0.6.0-next tailwindcss: ^3.0.19 typescript: ^4.4.4 vite: ^2.7.2 @@ -39,7 +39,7 @@ devDependencies: '@vitejs/plugin-react': 1.1.4 autoprefixer: 10.4.2_postcss@8.4.6 postcss: 8.4.6 - rome: 0.5.0-next + rome: 0.6.0-next tailwindcss: 3.0.19_qm7bagfnbv4vjkuayu3hle4sne typescript: 4.5.5 vite: 2.7.13 @@ -389,48 +389,48 @@ packages: picomatch: 2.3.1 dev: true - /@rometools/cli-darwin-arm64/0.5.0-next: - resolution: {integrity: sha512-dzwIOxvSNPD70DJYzyrxs0DLqUd4p+wDJM/AmHKGTxYJSdQahEG5/scnqfwIGiaSpKP/qNIv4+7Hd0aSaQF0NQ==} + /@rometools/cli-darwin-arm64/0.6.0-next: + resolution: {integrity: sha512-DQzlRUlTRnxhFXG/50aBNQjb60mTpEn2Ko5yWLwW9m4sQiUhG1xK1NXxbCI8MfGnymcUiV1vQDv7ScC51MXLzg==} cpu: [arm64] os: [darwin] requiresBuild: true dev: true optional: true - /@rometools/cli-darwin-x64/0.5.0-next: - resolution: {integrity: sha512-DXb/5PxNvD4ENb0oKiWnV2Zfww+yyZ5Q/ADUQqF1TsQjy8l7+4uiY618Wxo7KfH4y2uJA8b7wnly16bSw44F5g==} + /@rometools/cli-darwin-x64/0.6.0-next: + resolution: {integrity: sha512-/0ubFXniAgdp6GJuZjfH7i+YkGY0Dvr8271OvybeWhcLh72f9JosYp2VIcjgox/eIl9b+iKoAn8IpiBSirTodA==} cpu: [x64] os: [darwin] requiresBuild: true dev: true optional: true - /@rometools/cli-linux-arm64/0.5.0-next: - resolution: {integrity: sha512-1vWKrnQgBgTBeQZquphsmqdCudX4GuwugaQbQVmpCQa+WfKpAe8SAQIJz5G5G3m9uYQRUfwS2AXXEWuMCVHSZQ==} + /@rometools/cli-linux-arm64/0.6.0-next: + resolution: {integrity: sha512-TC8g4dABlYghMMMXHcvtvm08ATkCbSbYcyk4fv4/utOxUTmzDlguGXj8uulMvKCGhTSuKSwdzQztg+QMVhF4Xg==} cpu: [arm64] os: [linux] requiresBuild: true dev: true optional: true - /@rometools/cli-linux-x64/0.5.0-next: - resolution: {integrity: sha512-rKLhodWhYdMmVtIN1mZFxEFTbTiceat6NJUBGbsLHrjQVZ9h9tw8LlK/Lx8dBpzH5j093xKModnxZDFeIYyHLQ==} + /@rometools/cli-linux-x64/0.6.0-next: + resolution: {integrity: sha512-YUym0jh5aZx/DmnwiEawEdw+kcOJti6ym+0FkGsOGiW/Zsaw5K0rzC5T+ucK+TV1TS8Aq7UT244oN3KdbYJkCA==} cpu: [x64] os: [linux] requiresBuild: true dev: true optional: true - /@rometools/cli-win32-arm64/0.5.0-next: - resolution: {integrity: sha512-XDVcPeTAvR9KgCqJQYLkhG2cb5XhsY1ZQUKSGsruxB257spkizb2M299VvLaSKVD7pDakG8Vk0JN3lPXdn0zdQ==} + /@rometools/cli-win32-arm64/0.6.0-next: + resolution: {integrity: sha512-H6swDALdEm2VGAz3xmYylI52/ZjbOjJtTobY/qXHvVOY2BgFNT8SfDCaAfF3rrBm6PPPRqLW5bcP6C0rZh9LOQ==} cpu: [arm64] os: [win32] requiresBuild: true dev: true optional: true - /@rometools/cli-win32-x64/0.5.0-next: - resolution: {integrity: sha512-kZeH17xLyQeAD+Y3vAPFuFnF7RxaCmtN/WSfB4mobje5HsAIqP6YPA7Gxpex/fJhv3rRWyNMTvrZEtDn5ogjHw==} + /@rometools/cli-win32-x64/0.6.0-next: + resolution: {integrity: sha512-KxV4LHYXnO/8bRYsuon5codT4C9VwXokdw/fxAQ128rGrt8G3o0hei0XqdZiS3T0ktiwl0hDxufujNgVPpDUkQ==} cpu: [x64] os: [win32] requiresBuild: true @@ -572,6 +572,7 @@ packages: /@types/prop-types/15.7.4: resolution: {integrity: sha512-rZ5drC/jWjrArrS8BR6SIr4cWpW09RNTYt9AMZo3Jwwif+iacXAqgVjm0B0Bv/S1jhDXKHqRVNCbACkJ89RAnQ==} + dev: true /@types/react-dom/17.0.11: resolution: {integrity: sha512-f96K3k+24RaLGVu/Y2Ng3e1EbZ8/cVJvypZWd7cy0ofCBaf2lcM46xNhycMZ2xGwbBjRql7hOlZ+e2WlJ5MH3Q==} @@ -591,6 +592,7 @@ packages: '@types/prop-types': 15.7.4 '@types/scheduler': 0.16.2 csstype: 3.0.10 + dev: true /@types/responselike/1.0.0: resolution: {integrity: sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA==} @@ -600,6 +602,7 @@ packages: /@types/scheduler/0.16.2: resolution: {integrity: sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew==} + dev: true /@types/unist/2.0.6: resolution: {integrity: sha512-PBjIUxZHOuj0R15/xuwJYjFi+KZdNFrehocChv4g5hu6aFroHue8m0lBP0POdK2nKzbw0cgV1mws8+V/JAcEkQ==} @@ -1125,6 +1128,7 @@ packages: /csstype/3.0.10: resolution: {integrity: sha512-2u44ZG2OcNUO9HDp/Jl8C07x6pU/eTR3ncV91SiK3dhG9TWvRVsCoJw14Ckx5DgWkzGA3waZWO3d7pgqpUI/XA==} + dev: true /debug/4.3.3: resolution: {integrity: sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==} @@ -2958,18 +2962,18 @@ packages: fsevents: 2.3.2 dev: true - /rome/0.5.0-next: - resolution: {integrity: sha512-Y5LmDdSeu35DrqJRQnNHSmZcL6yOyHUhJLKevZN5xXW4GnPwHMLF8rUahnhgAugD5wmyGYAgakwKWA64n6yxkg==} + /rome/0.6.0-next: + resolution: {integrity: sha512-6XFNdUYs/tJ5pMi/aI+iF15nD1lEnYbGMLL7S9BzIRKZo6+2hLd3/cqEtcjT+V58eJoXuQvyIgZg2RFkAYBpAw==} engines: {node: '>=14.18.0'} hasBin: true requiresBuild: true optionalDependencies: - '@rometools/cli-darwin-arm64': 0.5.0-next - '@rometools/cli-darwin-x64': 0.5.0-next - '@rometools/cli-linux-arm64': 0.5.0-next - '@rometools/cli-linux-x64': 0.5.0-next - '@rometools/cli-win32-arm64': 0.5.0-next - '@rometools/cli-win32-x64': 0.5.0-next + '@rometools/cli-darwin-arm64': 0.6.0-next + '@rometools/cli-darwin-x64': 0.6.0-next + '@rometools/cli-linux-arm64': 0.6.0-next + '@rometools/cli-linux-x64': 0.6.0-next + '@rometools/cli-win32-arm64': 0.6.0-next + '@rometools/cli-win32-x64': 0.6.0-next dev: true /run-async/2.4.1: diff --git a/website/playground/src/App.tsx b/website/playground/src/App.tsx index 4ab7be2ef65..ab2decd477e 100644 --- a/website/playground/src/App.tsx +++ b/website/playground/src/App.tsx @@ -14,10 +14,10 @@ function App() { init() .then(() => { setLoadingState(LoadingState.Success); - }) + },) .catch(() => { setLoadingState(LoadingState.Error); - }); + },); }, [], ); diff --git a/website/playground/src/LineWidthInput.tsx b/website/playground/src/LineWidthInput.tsx index 047570a2835..008e1bda586 100644 --- a/website/playground/src/LineWidthInput.tsx +++ b/website/playground/src/LineWidthInput.tsx @@ -1,4 +1,7 @@ -interface Props { lineWidth: number; setLineWidth: (lineWidth: number) => void } +interface Props { + lineWidth: number; + setLineWidth: (lineWidth: number) => void; +} export default function LineWidthInput({ lineWidth, setLineWidth }: Props) { return (

diff --git a/website/playground/src/SourceTypeSelect.tsx b/website/playground/src/SourceTypeSelect.tsx index d4f0c93f5cc..299a73718f4 100644 --- a/website/playground/src/SourceTypeSelect.tsx +++ b/website/playground/src/SourceTypeSelect.tsx @@ -10,7 +10,14 @@ interface Props { } export default function SourceTypeSelect( - { setIsTypeScript, isTypeScript, setIsJsx, isJsx, setSourceType, sourceType }: Props, + { + setIsTypeScript, + isTypeScript, + setIsJsx, + isJsx, + setSourceType, + sourceType, + }: Props, ) { return (
@@ -54,7 +61,7 @@ export default function SourceTypeSelect( setIsTypeScript(e.target.checked); }} className="focus:ring-indigo-500 h-4 w-4 text-indigo-600 border-gray-300 rounded disabled:opacity-30" - disabled={sourceType == SourceType.Script} + disabled={sourceType === SourceType.Script} />
@@ -76,7 +83,7 @@ export default function SourceTypeSelect( checked={isJsx} onChange={(e) => setIsJsx(e.target.checked)} className="focus:ring-indigo-500 h-4 w-4 text-indigo-600 border-gray-300 rounded disabled:opacity-30" - disabled={sourceType == SourceType.Script} + disabled={sourceType === SourceType.Script} />
diff --git a/website/playground/src/TreeView.tsx b/website/playground/src/TreeView.tsx index a57316985d4..6f4608afc5d 100644 --- a/website/playground/src/TreeView.tsx +++ b/website/playground/src/TreeView.tsx @@ -11,7 +11,9 @@ interface Props { setPlaygroundState: Dispatch>; } -export default function TreeView({ tree, treeStyle, setPlaygroundState }: Props) { +export default function TreeView( + { tree, treeStyle, setPlaygroundState }: Props, +) { return (
({ width: undefined, height: undefined, - }); + },); useEffect( () => { // Handler to call on window resize @@ -45,16 +56,20 @@ export function usePlaygroundState(): [ const searchParams = new URLSearchParams(window.location.search); const [playgroundState, setPlaygroundState] = useState( () => ({ - code: window.location.hash !== "#" ? decodeCode( - window.location.hash.substring(1), - ) : "", + code: + window.location.hash !== "#" ? decodeCode( + window.location.hash.substring(1), + ) : "", lineWidth: parseInt(searchParams.get("lineWidth") ?? "80"), - indentStyle: (searchParams.get("indentStyle") as IndentStyle) ?? IndentStyle.Tab, - quoteStyle: (searchParams.get("quoteStyle") as QuoteStyle) ?? QuoteStyle.Double, + indentStyle: + (searchParams.get("indentStyle") as IndentStyle) ?? IndentStyle.Tab, + quoteStyle: + (searchParams.get("quoteStyle") as QuoteStyle) ?? QuoteStyle.Double, indentWidth: parseInt(searchParams.get("indentWidth") ?? "2"), isTypeScript: searchParams.get("typescript") === "true", isJsx: searchParams.get("jsx") === "true", - sourceType: (searchParams.get("sourceType") as SourceType) ?? SourceType.Module, + sourceType: + (searchParams.get("sourceType") as SourceType) ?? SourceType.Module, treeStyle: TreeStyle.Json, }), ); @@ -67,7 +82,7 @@ export function usePlaygroundState(): [ ...options, typescript: isTypeScript.toString(), jsx: isJsx.toString(), - }).toString(); + },).toString(); const url = `${window.location.protocol}//${window.location.host}${window.location.pathname}?${queryString}#${encodeCode( code, )}`; @@ -112,7 +127,10 @@ export function formatWithPrettier( // @ts-ignore let debug = prettier.__debug; const document = debug.printToDoc(code, prettierOptions); - const formattedCode = debug.printDocToString(document, prettierOptions).formatted; + const formattedCode = debug.printDocToString( + document, + prettierOptions, + ).formatted; const ir = debug.formatDoc( document, { parser: "babel", plugins: [parserBabel] }, diff --git a/website/playground/vite.config.ts b/website/playground/vite.config.ts index 13a3c633704..efda705154e 100644 --- a/website/playground/vite.config.ts +++ b/website/playground/vite.config.ts @@ -6,4 +6,4 @@ import svgr from "@honkhonk/vite-plugin-svgr"; export default defineConfig({ base: process.env.BASE_URL, plugins: [react(), svgr()], -}); +},); diff --git a/website/playground/workers-site/index.js b/website/playground/workers-site/index.js index cae4ed1439e..509392c0ec8 100644 --- a/website/playground/workers-site/index.js +++ b/website/playground/workers-site/index.js @@ -1,4 +1,7 @@ -import { getAssetFromKV, mapRequestToAsset } from "@cloudflare/kv-asset-handler"; +import { + getAssetFromKV, + mapRequestToAsset, +} from "@cloudflare/kv-asset-handler"; /** * The DEBUG flag will do two things that help during development: diff --git a/website/src/_data/env.js b/website/src/_data/env.js index 448f81d76f2..3244a6957e5 100644 --- a/website/src/_data/env.js +++ b/website/src/_data/env.js @@ -5,5 +5,6 @@ module.exports = API_DOMAIN: process.env.API_DOMAIN || "https://api.rome.tools", // Prod: pk_live_51HfdGeFXA6dCpYSpI1yUt3vEbUE0AAV0swlTUuBL7XSdzSERrqkNAsitFuTaqDxdS7HcIs5wf0PG4Mqtys01LANs00GteBJgws // Test: pk_test_51HfdGeFXA6dCpYSpScbeo75rVpehHpEPqE5QysKBwJVTnN1NjAgEuGkEHfsgQpBe1KlYwWSeTaUa5ELDSJBPKjzI00ku8lUamF - STRIPE_PUBLIC: process.env.STRIPE_CLIENT || "pk_live_51HfdGeFXA6dCpYSpI1yUt3vEbUE0AAV0swlTUuBL7XSdzSERrqkNAsitFuTaqDxdS7HcIs5wf0PG4Mqtys01LANs00GteBJgws", + STRIPE_PUBLIC: + process.env.STRIPE_CLIENT || "pk_live_51HfdGeFXA6dCpYSpI1yUt3vEbUE0AAV0swlTUuBL7XSdzSERrqkNAsitFuTaqDxdS7HcIs5wf0PG4Mqtys01LANs00GteBJgws", }; diff --git a/website/src/_includes/scripts/funding.js b/website/src/_includes/scripts/funding.js index 3db53241a59..025874377a8 100644 --- a/website/src/_includes/scripts/funding.js +++ b/website/src/_includes/scripts/funding.js @@ -23,7 +23,9 @@ const reviewStepIndicator = document.querySelector(".form-steps .review"); const progressFillContainer = document.querySelector(".progress-fill"); const progressContainer = document.querySelector(".progress"); const progressLoading = document.querySelector(".progress-loading"); -const progressFillText = document.querySelector(".progress-fill .progress-text"); +const progressFillText = document.querySelector( + ".progress-fill .progress-text", +); const progressTotalText = document.querySelector(".progress > .progress-text"); const donationCount = document.querySelector(".donation-count"); @@ -63,28 +65,26 @@ function loadStripe() { } loadingStripePromise = - new Promise( - (resolve, reject) => { - const script = document.createElement("script"); - script.src = "https://js.stripe.com/v3/"; - - script.onload = - () => { - loadingStripePromise = undefined; - loadedStripe = true; - resolve(); - }; - - script.onerror = - (err) => { - loadingStripePromise = undefined; - addErrorToast("while loading the Stripe API", err); - reject(err); - }; - - document.head.appendChild(script); - }, - ); + new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.src = "https://js.stripe.com/v3/"; + + script.onload = + () => { + loadingStripePromise = undefined; + loadedStripe = true; + resolve(); + }; + + script.onerror = + (err) => { + loadingStripePromise = undefined; + addErrorToast("while loading the Stripe API", err); + reject(err); + }; + + document.head.appendChild(script); + },); return loadingStripePromise; } @@ -138,7 +138,7 @@ async function wrapFetch(opts, attempt = 0) { }, 2_000, ); - }); + },); } if (res.status !== 200) { @@ -328,7 +328,9 @@ document.addEventListener( // Select active step const focusableElements = detailsForm.hidden ? reviewFormFocusableElements : detailsFormFocusableElements; const firstFocusableElement = focusableElements[0]; - const lastFocusableElement = focusableElements[focusableElements.length - 1]; + const lastFocusableElement = focusableElements[ + focusableElements.length - 1 + ]; let focusElement; @@ -409,13 +411,12 @@ reviewForm.addEventListener( localStorage.setItem("checkout-tier", selectedTier.name); stripe.redirectToCheckout({ sessionId: res.id }); return new Promise(() => {}); - }); + },); }, - }) - .then(() => { - checkoutButton.textContent = oldCheckoutButtonText; - checkoutButton.disabled = false; - }); + },).then(() => { + checkoutButton.textContent = oldCheckoutButtonText; + checkoutButton.disabled = false; + },); }, ); @@ -625,7 +626,9 @@ function buildTierButton(tier) { already.classList.add("already"); if (tier.count > 0 && tier.type === "personal") { already.textContent = - `${tier.count.toLocaleString()} ${tier.count === 1 ? "person" : "people"} selected this tier`; + `${tier.count.toLocaleString()} ${ + tier.count === 1 ? "person" : "people" + } selected this tier`; } headerRight.appendChild(already); @@ -706,7 +709,7 @@ function processStats(res, interactive) { requestAnimationFrame(() => { progressFillContainer.style.width = `${percent}%`; - }); + },); } if (typeof IntersectionObserver === "undefined") { @@ -758,7 +761,7 @@ wrapFetch({ localStorage.setItem("stats", JSON.stringify(res)); processStats(res, true); }, -}); +},); window.addEventListener( "error", diff --git a/website/src/_includes/scripts/index.js b/website/src/_includes/scripts/index.js index a4d1099eb86..53a1d456bc6 100644 --- a/website/src/_includes/scripts/index.js +++ b/website/src/_includes/scripts/index.js @@ -15,7 +15,7 @@ window.addEventListener( if (isMobileSidebarVisible && !isMobile && isMobileSidebarVisible) { toggleMobileSidebar(); } - }); + },); }, ); @@ -43,7 +43,7 @@ const headingElements = tocLinks.map((link) => { ), link, }; -}); +},); /** * @typedef {Object} CalculatedHeading @@ -271,7 +271,9 @@ class Manager { hasActive = true; // Make sure TOC link is visible - let linkTop = this.headingsCalculated[i].link.offsetTop - sidebarScroller.offsetTop; + let linkTop = this.headingsCalculated[ + i + ].link.offsetTop - sidebarScroller.offsetTop; if (i === 0) { linkTop = 0; } @@ -378,8 +380,8 @@ class Manager { requestAnimationFrame(() => { requestAnimationFrame(() => { copied.style.opacity = "0"; - }); - }); + },); + },); copied.addEventListener( "transitionend", () => { @@ -472,7 +474,11 @@ class Manager { { passive: true }, ); - document.addEventListener("click", this.handleGlobalClick.bind(this), false); + document.addEventListener( + "click", + this.handleGlobalClick.bind(this), + false, + ); } } @@ -601,7 +607,7 @@ if (docsearchInput != null) { indexName: "romefrontend", inputSelector: "#docsearch", debug: false, // Set debug to true if you want to inspect the dropdown - }); + },); }, ); document.body.appendChild(script); @@ -757,7 +763,7 @@ for (const scroller of heroScrollers) { heroCallbacks.push(() => { setActiveIndex(activeIndex + 1, true); - }); + },); } if (heroCallbacks.length > 0) { setInterval(