Skip to content

Commit 3ca8961

Browse files
authored
Use oxfmt (#99)
* chore: convert buttons to shadcn * chore: use oxfmt * chore: run formatter
1 parent d733058 commit 3ca8961

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+1680
-1975
lines changed

.github/workflows/cla.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: "CLA"
3-
on: # yamllint disable-line rule:truthy
3+
on: # yamllint disable-line rule:truthy
44
issue_comment:
55
types:
66
- "created"

.oxfmtrc.jsonc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"$schema": "./node_modules/oxfmt/configuration_schema.json",
3+
"ignorePatterns": ["src/spicedb-common/protodefs", "examples", "public"],
4+
}

.prettierignore

Lines changed: 0 additions & 6 deletions
This file was deleted.

api/lookupshare.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { GetObjectCommand, S3Client } from "@aws-sdk/client-s3";
22
import type { VercelRequest, VercelResponse } from "@vercel/node";
33

4-
const encodeURL =
5-
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
4+
const encodeURL = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
65

76
export default async function handler(req: VercelRequest, res: VercelResponse) {
87
const shareid = req.query.shareid ?? "";

api/share.ts

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ import { PutObjectCommand, S3Client } from "@aws-sdk/client-s3";
22
import type { VercelRequest, VercelResponse } from "@vercel/node";
33
import { createHash } from "crypto";
44

5-
const encodeURL =
6-
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
5+
const encodeURL = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
76

87
export type SharedDataV2 = {
98
version: "2";
@@ -44,11 +43,7 @@ function validateSharedDataV2(data): data is SharedDataV2 {
4443
return false;
4544
}
4645

47-
const optionalStringFields = [
48-
"relationships_yaml",
49-
"validation_yaml",
50-
"assertions_yaml",
51-
];
46+
const optionalStringFields = ["relationships_yaml", "validation_yaml", "assertions_yaml"];
5247
for (const field of optionalStringFields) {
5348
if (field in data && typeof data[field] !== "string") {
5449
return false;
@@ -100,12 +95,7 @@ export default async function handler(req: VercelRequest, res: VercelResponse) {
10095
// Validate that the computed hash only contains allowed characters
10196
for (const char of shareHash) {
10297
if (!encodeURL.includes(char)) {
103-
console.error(
104-
"Computed hash contains invalid character:",
105-
char,
106-
"in hash:",
107-
shareHash,
108-
);
98+
console.error("Computed hash contains invalid character:", char, "in hash:", shareHash);
10999
return res.status(500).json({ error: "Hash generation error" });
110100
}
111101
}

cypress.config.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ export default defineConfig({
1111

1212
e2e: {
1313
baseUrl: "http://localhost:3000",
14-
specPattern: [
15-
"cypress/integration/**/*.spec.{js,ts}",
16-
"cypress/e2e/**/*.cy.{js,jsx,ts,tsx}",
17-
],
14+
specPattern: ["cypress/integration/**/*.spec.{js,ts}", "cypress/e2e/**/*.cy.{js,jsx,ts,tsx}"],
1815
},
1916
});

cypress/integration/basic.spec.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ describe("Playground", () => {
66
});
77

88
it("displays tutorial", () => {
9-
cy.get(".react-joyride__tooltip")
10-
.contains("Welcome!")
11-
.should("have.length", 1);
9+
cy.get(".react-joyride__tooltip").contains("Welcome!").should("have.length", 1);
1210
});
1311

1412
it("can dismiss tutorial", () => {

cypress/integration/nav.spec.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,7 @@ describe("Navigation", () => {
99
it("displays schema tab", () => {
1010
cy.tab("Schema");
1111
// Default editor content
12-
cy.editorText().containsAll([
13-
"definition user {}",
14-
"definition resource {",
15-
"}",
16-
]);
12+
cy.editorText().containsAll(["definition user {}", "definition resource {", "}"]);
1713
// Sub-menu buttons
1814
cy.get("button").contains("Format").should("exist");
1915
});

cypress/support/commands.js

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -38,28 +38,21 @@ Cypress.Commands.add("panelText", () => {
3838

3939
// Wait until WASM developer package is loaded
4040
Cypress.Commands.add("waitForWasm", () => {
41-
cy.waitUntil(
42-
() => cy.window().then((win) => !!win.runSpiceDBDeveloperRequest),
43-
{
44-
errorMsg: "WASM development package not loaded",
45-
timeout: 30000,
46-
interval: 500,
47-
},
48-
);
41+
cy.waitUntil(() => cy.window().then((win) => !!win.runSpiceDBDeveloperRequest), {
42+
errorMsg: "WASM development package not loaded",
43+
timeout: 30000,
44+
interval: 500,
45+
});
4946
return;
5047
});
5148

5249
// -- Child commands --
5350
// Asserts that all list items are present.
54-
Cypress.Commands.add(
55-
"containsAll",
56-
{ prevSubject: "element" },
57-
(subject, list) => {
58-
list.forEach((line) => {
59-
cy.wrap(subject).contains(line);
60-
});
61-
},
62-
);
51+
Cypress.Commands.add("containsAll", { prevSubject: "element" }, (subject, list) => {
52+
list.forEach((line) => {
53+
cy.wrap(subject).contains(line);
54+
});
55+
});
6356

6457
//
6558
// -- This is a dual command --

eslint.config.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@ export default tseslint.config(
1919
},
2020
rules: {
2121
...reactHooks.configs.recommended.rules,
22-
"react-refresh/only-export-components": [
23-
"warn",
24-
{ allowConstantExport: true },
25-
],
22+
"react-refresh/only-export-components": ["warn", { allowConstantExport: true }],
2623
},
2724
},
2825
);

0 commit comments

Comments
 (0)