diff --git a/examples/write-patterns/.eslintrc.cjs b/examples/write-patterns/.eslintrc.cjs index 7f182f116c..b630f873ab 100644 --- a/examples/write-patterns/.eslintrc.cjs +++ b/examples/write-patterns/.eslintrc.cjs @@ -5,37 +5,37 @@ module.exports = { node: true, }, extends: [ - `eslint:recommended`, - `plugin:@typescript-eslint/recommended`, - `plugin:prettier/recommended`, + 'eslint:recommended', + 'plugin:@typescript-eslint/recommended', + 'plugin:prettier/recommended', ], parserOptions: { ecmaVersion: 2022, requireConfigFile: false, - sourceType: `module`, + sourceType: 'module', ecmaFeatures: { jsx: true, }, }, - parser: `@typescript-eslint/parser`, - plugins: [`prettier`], + parser: '@typescript-eslint/parser', + plugins: ['prettier'], rules: { - quotes: [`error`, `backtick`], - "no-unused-vars": `off`, - "@typescript-eslint/no-unused-vars": [ - `error`, + quotes: ['error', 'single'], + 'no-unused-vars': 'off', + '@typescript-eslint/no-unused-vars': [ + 'error', { - argsIgnorePattern: `^_`, - varsIgnorePattern: `^_`, - caughtErrorsIgnorePattern: `^_`, + argsIgnorePattern: '^_', + varsIgnorePattern: '^_', + caughtErrorsIgnorePattern: '^_', }, ], }, ignorePatterns: [ - `**/node_modules/**`, - `**/dist/**`, - `tsup.config.ts`, - `vitest.config.ts`, - `.eslintrc.js`, + '**/node_modules/**', + '**/dist/**', + 'tsup.config.ts', + 'vitest.config.ts', + '.eslintrc.js', ], } diff --git a/examples/write-patterns/.prettierrc b/examples/write-patterns/.prettierrc index 31cd55f911..ad4d895523 100644 --- a/examples/write-patterns/.prettierrc +++ b/examples/write-patterns/.prettierrc @@ -1,6 +1,6 @@ { - "trailingComma": "es5", "semi": false, "singleQuote": true, - "tabWidth": 2 + "tabWidth": 2, + "trailingComma": "es5" } diff --git a/examples/write-patterns/package.json b/examples/write-patterns/package.json index 181b241c59..9630b7aca0 100644 --- a/examples/write-patterns/package.json +++ b/examples/write-patterns/package.json @@ -14,6 +14,7 @@ "db:migrate": "dotenv -e ../../.env.dev -- pnpm exec pg-migrations apply --directory ./shared/migrations", "dev": "concurrently \"vite\" \"node shared/backend/api.js\"", "build": "vite build", + "format": "eslint . --ext ts,tsx --fix", "stylecheck": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", "preview": "vite preview", "typecheck": "tsc --noEmit" diff --git a/examples/write-patterns/patterns/1-online-writes/index.tsx b/examples/write-patterns/patterns/1-online-writes/index.tsx index baeebfd914..b50c60f49d 100644 --- a/examples/write-patterns/patterns/1-online-writes/index.tsx +++ b/examples/write-patterns/patterns/1-online-writes/index.tsx @@ -19,17 +19,13 @@ export default function OnlineWrites() { }) if (isLoading) { - return ( -
Loading …
- ) + return
Loading …
} - const todos = data - ? data.sort((a, b) => a.created_at - b.created_at) - : [] + const todos = data ? data.sort((a, b) => a.created_at - b.created_at) : [] async function handleChange(id: string, completed: boolean) { - await client.updateTodo(id, {completed: !completed}) + await client.updateTodo(id, { completed: !completed }) } async function handleDelete(event: React.MouseEvent, id: string) { @@ -50,6 +46,7 @@ export default function OnlineWrites() { form.reset() } + // prettier-ignore return (

Online writes

diff --git a/examples/write-patterns/shared/app/client.ts b/examples/write-patterns/shared/app/client.ts index b77eff0c0b..5a789f2a59 100644 --- a/examples/write-patterns/shared/app/client.ts +++ b/examples/write-patterns/shared/app/client.ts @@ -12,8 +12,8 @@ async function request(url: string, method: string, data?: object) { const options: RequestOptions = { method: method, headers: { - 'Content-Type': `application/json` - } + 'Content-Type': 'application/json', + }, } if (data) { @@ -27,7 +27,7 @@ export async function createTodo(title: string) { const url = `${API_URL}/todos` const data = { id: uuidv4(), - title: title + title: title, } return await request(url, 'POST', data)