Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump prettier from 2.8.8 to 3.0.3 #344

Merged
merged 6 commits into from
Oct 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,001 changes: 876 additions & 125 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@
"@vue/tsconfig": "^0.4.0",
"eslint": "^8.51.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-vue": "^9.17.0",
"jsdom": "^22.1.0",
"playwright": "^1.39.0",
"prettier": "^2.8.8",
"prettier": "^3.0.3",
"sass": "^1.69.3",
"typescript": "^5.2.2",
"vite": "^4.4.9",
Expand Down
10 changes: 5 additions & 5 deletions postcss.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ if (process.env.NODE_ENV === "production") {
defaultExtractor(content) {
const contentWithoutStyleBlocks = content.replace(
/<style[^]+?<\/style>/gi,
""
"",
);

const classes = Array.from(
contentWithoutStyleBlocks.matchAll(/class="([^"]+?)"/g)
contentWithoutStyleBlocks.matchAll(/class="([^"]+?)"/g),
).map((match) => match[1]);
const styles = classes.flatMap((styles) => styles.split(" "));

const ids = Array.from(
contentWithoutStyleBlocks.matchAll(/id="([^"]+?)"/g)
contentWithoutStyleBlocks.matchAll(/id="([^"]+?)"/g),
).map((match) => match[1]);

const tags = Array.from(
contentWithoutStyleBlocks.matchAll(/<(\w[\w-]*?)[^\w-]/g)
contentWithoutStyleBlocks.matchAll(/<(\w[\w-]*?)[^\w-]/g),
).map((match) => match[1]);

return styles.concat(ids).concat(tags);
Expand All @@ -32,7 +32,7 @@ if (process.env.NODE_ENV === "production") {
/^router-link(|-exact)-active$/,
/data-v-.*/,
],
})
}),
);
}

Expand Down
9 changes: 6 additions & 3 deletions src/ReloadPrompt.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ const { needRefresh, updateServiceWorker } = useRegisterSW({
onRegisteredSW(url, registration) {
if (registration) {
// Check every hour for updates (which if found will then show the reload prompt)
setInterval(() => {
registration.update();
}, 60 * 60 * 1000);
setInterval(
() => {
registration.update();
},
60 * 60 * 1000,
);
}
},
});
Expand Down
2 changes: 1 addition & 1 deletion src/components/Card.vue
Original file line number Diff line number Diff line change
Expand Up @@ -919,7 +919,7 @@ const rankText = computed(() => {
});

const suitText = computed(
() => props.suit[0].toUpperCase() + props.suit.slice(1)
() => props.suit[0].toUpperCase() + props.suit.slice(1),
);

const getX = (index: number, rotated: boolean): number => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Solutions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const toggleSolutions = () => (showSolutions.value = !showSolutions.value);
// Re-hide solutions if the cards change.
watch(
() => props.solutions,
() => (showSolutions.value = false)
() => (showSolutions.value = false),
);
</script>

Expand Down
24 changes: 15 additions & 9 deletions tests/component/Solutions.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import { cleanup, fireEvent, render, screen } from "@testing-library/vue";
import {
cleanup,
fireEvent,
render,
screen,
type MatcherFunction,
} from "@testing-library/vue";
import { afterEach, describe, expect, test } from "vitest";
import Solutions from "../../src/components/Solutions.vue";

Expand All @@ -7,9 +13,9 @@ describe("Solutions", () => {
solutions: ["8 * 1 + 2 * 8", "2 * 8 + 8 * 1", "log_2(8) * 8 * 1"],
};

const solutionsRegex = new RegExp(
props.solutions.join("|").replace(/[*+()]/g, "\\$&")
);
const solutionsMatcher: MatcherFunction = (content) => {
return props.solutions.includes(content);
};

afterEach(() => {
cleanup();
Expand All @@ -18,7 +24,7 @@ describe("Solutions", () => {
test("Hides solutions by default", () => {
render(Solutions, { props });

expect(screen.queryAllByText(solutionsRegex)).to.be.empty;
expect(screen.queryAllByText(solutionsMatcher)).to.be.empty;

screen.getByRole("button", {
name: "Show solutions",
Expand All @@ -32,15 +38,15 @@ describe("Solutions", () => {
name: "Show solutions",
});
await fireEvent.click(showSolutionsButton);
expect(screen.getAllByText(solutionsRegex)).toHaveLength(
props.solutions.length
expect(screen.getAllByText(solutionsMatcher)).toHaveLength(
props.solutions.length,
);

const hideSolutionsButton = screen.getByRole("button", {
name: "Hide solutions",
});
await fireEvent.click(hideSolutionsButton);
expect(screen.queryAllByText(solutionsRegex)).to.be.empty;
expect(screen.queryAllByText(solutionsMatcher)).to.be.empty;
});

test("Hides solutions when they change", async () => {
Expand All @@ -59,7 +65,7 @@ describe("Solutions", () => {
name: "Show solutions",
});

expect(screen.queryAllByText(solutionsRegex)).to.be.empty;
expect(screen.queryAllByText(solutionsMatcher)).to.be.empty;
});

test("Disables showing solutions when none exist", () => {
Expand Down
10 changes: 5 additions & 5 deletions tests/e2e/App.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ test.describe("Functionality", () => {
const button = page.getByRole("button", { name: "Show solutions" });
test.fail(
(await button.getAttribute("disabled")) !== null,
"No solutions after 5 tries"
"No solutions after 5 tries",
);

const selects = await page.getByLabel("Card ").all();
Expand All @@ -95,7 +95,7 @@ test.describe("Functionality", () => {

const solutions = await page.locator("pre").all();
const texts = await Promise.all(
solutions.map((solution) => solution.innerText())
solutions.map((solution) => solution.innerText()),
);
for (const text of texts) {
const numbers = text
Expand Down Expand Up @@ -123,7 +123,7 @@ test.describe("Functionality", () => {
const button = page.getByRole("button", { name: "Show solutions" });
test.fail(
(await button.getAttribute("disabled")) !== null,
"No solutions after 5 tries"
"No solutions after 5 tries",
);

await button.click();
Expand Down Expand Up @@ -162,7 +162,7 @@ test.describe("Accessibility", () => {
test("Solutions are accessible", async ({ page }, { project }) => {
test.skip(
process.env.CI !== undefined && project.name === "Mobile Safari",
"Times out in mobile Safari on CI"
"Times out in mobile Safari on CI",
);

await page.goto("/");
Expand All @@ -179,7 +179,7 @@ test.describe("Accessibility", () => {
const button = page.getByRole("button", { name: "Show solutions" });
test.fail(
(await button.getAttribute("disabled")) !== null,
"No solutions after 5 tries"
"No solutions after 5 tries",
);
await button.click();

Expand Down
6 changes: 3 additions & 3 deletions tests/unit/operation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe("Operations", () => {

test("Joins strings with -", () => {
expect(Subtract.toString("(2 + 1)", "(3 * 4)")).toBe(
"(2 + 1) - (3 * 4)"
"(2 + 1) - (3 * 4)",
);
});
});
Expand All @@ -55,7 +55,7 @@ describe("Operations", () => {

test("Joins strings with *", () => {
expect(Multiply.toString("(2 - 1)", "(3 / 4)")).toBe(
"(2 - 1) * (3 / 4)"
"(2 - 1) * (3 / 4)",
);
});
});
Expand Down Expand Up @@ -89,7 +89,7 @@ describe("Operations", () => {

test("Joins strings with ^", () => {
expect(Exponent.toString("(2 - 1)", "(3 * 4)")).toBe(
"(2 - 1) ^ (3 * 4)"
"(2 - 1) ^ (3 * 4)",
);
});
});
Expand Down
Loading