From 3136564294478ed0274ed74ef61397d4047f4851 Mon Sep 17 00:00:00 2001 From: Edmund Hung Date: Sun, 11 Feb 2024 19:48:25 +0100 Subject: [PATCH] chore: update prettier setup --- .eslintrc.json | 2 +- .prettierrc | 4 -- .prettierrc.js | 32 ++++++++++++ README.md | 3 +- app/root.tsx | 8 +-- functions/[[path]].ts | 2 +- package.json | 115 +++++++++++++++++++++--------------------- tsconfig.json | 42 +++++++-------- 8 files changed, 119 insertions(+), 89 deletions(-) delete mode 100644 .prettierrc create mode 100644 .prettierrc.js diff --git a/.eslintrc.json b/.eslintrc.json index 38b2f49..4ffeeca 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,3 +1,3 @@ { - "extends": ["@remix-run", "prettier"] + "extends": ["@remix-run", "prettier"] } diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index bb9ca71..0000000 --- a/.prettierrc +++ /dev/null @@ -1,4 +0,0 @@ -# Prettier Configuration -# All supported options are listed here: https://prettier.io/docs/en/options.html -singleQuote: true -useTabs: true diff --git a/.prettierrc.js b/.prettierrc.js new file mode 100644 index 0000000..e554965 --- /dev/null +++ b/.prettierrc.js @@ -0,0 +1,32 @@ +/** @type {import("prettier").Config} */ +const config = { + arrowParens: 'avoid', + bracketSameLine: false, + bracketSpacing: true, + embeddedLanguageFormatting: 'auto', + endOfLine: 'lf', + htmlWhitespaceSensitivity: 'css', + insertPragma: false, + jsxSingleQuote: false, + printWidth: 80, + proseWrap: 'always', + quoteProps: 'as-needed', + requirePragma: false, + semi: true, + singleAttributePerLine: false, + singleQuote: true, + tabWidth: 2, + trailingComma: 'all', + useTabs: true, + overrides: [ + { + files: ['**/*.json', '**/*.md'], + options: { + useTabs: false, + }, + }, + ], + plugins: ['prettier-plugin-tailwindcss'], +}; + +export default config; diff --git a/README.md b/README.md index 648d68c..9f23b11 100644 --- a/README.md +++ b/README.md @@ -38,4 +38,5 @@ npm run build && npm run test ## CI/CD -The template ships a [CI workflow](./.github/workflows/ci.yml) which is triggered whenever new changes are pushed. +The template ships a [CI workflow](./.github/workflows/ci.yml) which is +triggered whenever new changes are pushed. diff --git a/app/root.tsx b/app/root.tsx index 2904861..37bd958 100644 --- a/app/root.tsx +++ b/app/root.tsx @@ -96,10 +96,10 @@ function Layout({
-
+
@@ -110,7 +110,7 @@ function Layout({

{description}

{actionText ? ( {actionText} @@ -127,7 +127,7 @@ function Layout({
-
{children}
+
{children}
diff --git a/functions/[[path]].ts b/functions/[[path]].ts index 38c4358..c95cf92 100644 --- a/functions/[[path]].ts +++ b/functions/[[path]].ts @@ -7,7 +7,7 @@ import * as build from '../build/server'; export const onRequest = createPagesFunctionHandler({ build, - getLoadContext: (context) => ({ + getLoadContext: context => ({ env: context.env, waitUntil(promise: Promise) { context.waitUntil(promise); diff --git a/package.json b/package.json index e8c9c6f..6906c1b 100644 --- a/package.json +++ b/package.json @@ -1,59 +1,60 @@ { - "private": true, - "name": "remix-cloudflare-template", - "type": "module", - "description": "All-in-one remix starter template for Cloudflare Pages", - "scripts": { - "dev": "remix vite:dev", - "test": "playwright test --ui", - "start": "wrangler pages dev ./build/client", - "build": "remix vite:build", - "cleanup": "rimraf .cache ./build", - "lint": "eslint --ignore-path .gitignore --cache --cache-location ./node_modules/.cache/eslint .", - "typecheck": "tsc", - "prepare": "husky" - }, - "dependencies": { - "@markdoc/markdoc": "^0.4.0", - "@remix-run/cloudflare": "*", - "@remix-run/cloudflare-pages": "*", - "@remix-run/react": "*", - "isbot": "^3.6.5", - "react": "^18.2.0", - "react-dom": "^18.2.0" - }, - "devDependencies": { - "@cloudflare/workers-types": "^4.20240208.0", - "@octokit/types": "^12.4.0", - "@playwright/test": "^1.41.2", - "@remix-run/dev": "*", - "@remix-run/eslint-config": "*", - "@tailwindcss/typography": "^0.5.10", - "@types/react": "^18.2.55", - "@types/react-dom": "^18.2.19", - "autoprefixer": "^10.4.17", - "concurrently": "^8.2.2", - "cross-env": "^7.0.3", - "eslint": "^8.56.0", - "eslint-config-prettier": "^9.1.0", - "husky": "^9.0.10", - "lint-staged": "^15.2.2", - "miniflare": "^3.20240129.1", - "msw": "^2.1.7", - "postcss": "^8.4.35", - "prettier": "^3.2.5", - "rimraf": "^5.0.5", - "tailwindcss": "^3.4.1", - "typescript": "^5.3.3", - "vite": "^5.1.1", - "vite-tsconfig-paths": "^4.3.1", - "wrangler": "^3.28.1" - }, - "engines": { - "node": ">=18" - }, - "sideEffects": false, - "lint-staged": { - "*.{js,mjs,ts,tsx,css,md,yml}": "prettier --write" - } + "private": true, + "name": "remix-cloudflare-template", + "type": "module", + "description": "All-in-one remix starter template for Cloudflare Pages", + "scripts": { + "dev": "remix vite:dev", + "test": "playwright test --ui", + "start": "wrangler pages dev ./build/client", + "build": "remix vite:build", + "cleanup": "rimraf .cache ./build", + "lint": "eslint --ignore-path .gitignore --cache --cache-location ./node_modules/.cache/eslint .", + "typecheck": "tsc", + "prepare": "husky" + }, + "dependencies": { + "@markdoc/markdoc": "^0.4.0", + "@remix-run/cloudflare": "*", + "@remix-run/cloudflare-pages": "*", + "@remix-run/react": "*", + "isbot": "^3.6.5", + "react": "^18.2.0", + "react-dom": "^18.2.0" + }, + "devDependencies": { + "@cloudflare/workers-types": "^4.20240208.0", + "@octokit/types": "^12.4.0", + "@playwright/test": "^1.41.2", + "@remix-run/dev": "*", + "@remix-run/eslint-config": "*", + "@tailwindcss/typography": "^0.5.10", + "@types/react": "^18.2.55", + "@types/react-dom": "^18.2.19", + "autoprefixer": "^10.4.17", + "concurrently": "^8.2.2", + "cross-env": "^7.0.3", + "eslint": "^8.56.0", + "eslint-config-prettier": "^9.1.0", + "husky": "^9.0.10", + "lint-staged": "^15.2.2", + "miniflare": "^3.20240129.1", + "msw": "^2.1.7", + "postcss": "^8.4.35", + "prettier": "^3.2.5", + "prettier-plugin-tailwindcss": "^0.5.11", + "rimraf": "^5.0.5", + "tailwindcss": "^3.4.1", + "typescript": "^5.3.3", + "vite": "^5.1.1", + "vite-tsconfig-paths": "^4.3.1", + "wrangler": "^3.28.1" + }, + "engines": { + "node": ">=18" + }, + "sideEffects": false, + "lint-staged": { + "*.{js,mjs,ts,tsx,css,md,yml}": "prettier --write" + } } diff --git a/tsconfig.json b/tsconfig.json index 5de314c..77291a9 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,24 +1,24 @@ { - "include": ["env.d.ts", "**/*.ts", "**/*.tsx"], - "compilerOptions": { - "lib": ["DOM", "DOM.Iterable", "ES2022"], - "isolatedModules": true, - "esModuleInterop": true, - "jsx": "react-jsx", - "module": "ESNext", - "moduleResolution": "Bundler", - "resolveJsonModule": true, - "target": "ES2022", - "strict": true, - "allowJs": true, - "skipLibCheck": true, - "forceConsistentCasingInFileNames": true, - "baseUrl": ".", - "paths": { - "~/*": ["./app/*"] - }, + "include": ["env.d.ts", "**/*.ts", "**/*.tsx"], + "compilerOptions": { + "lib": ["DOM", "DOM.Iterable", "ES2022"], + "isolatedModules": true, + "esModuleInterop": true, + "jsx": "react-jsx", + "module": "ESNext", + "moduleResolution": "Bundler", + "resolveJsonModule": true, + "target": "ES2022", + "strict": true, + "allowJs": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "baseUrl": ".", + "paths": { + "~/*": ["./app/*"] + }, - // Vite takes care of building everything, not tsc. - "noEmit": true - } + // Vite takes care of building everything, not tsc. + "noEmit": true + } }