From 90f45eb07631217832244abb3e0e6904db549a01 Mon Sep 17 00:00:00 2001 From: Marcin Kulpa Date: Thu, 20 Feb 2025 02:28:40 +0100 Subject: [PATCH] Chore/enhance prettier config (#3022) * chore: enhance prettier config * chore: fix prettier issues * Update package.json --------- Co-authored-by: Daishi Kato --- .github/DISCUSSION_TEMPLATE/bug-report.yml | 2 +- .github/FUNDING.yml | 5 +- .github/ISSUE_TEMPLATE/bug_report.md | 2 - .github/pull_request_template.md | 2 - .prettierignore | 2 + examples/demo/index.html | 7 +- examples/demo/src/pmndrs.css | 234 ++++++++++----------- examples/demo/src/styles.css | 30 ++- examples/starter/index.html | 2 +- examples/starter/tsconfig.json | 1 - package.json | 4 +- vitest.config.mts | 4 +- 12 files changed, 161 insertions(+), 134 deletions(-) create mode 100644 .prettierignore diff --git a/.github/DISCUSSION_TEMPLATE/bug-report.yml b/.github/DISCUSSION_TEMPLATE/bug-report.yml index cd8c436c..9e1fe7b4 100644 --- a/.github/DISCUSSION_TEMPLATE/bug-report.yml +++ b/.github/DISCUSSION_TEMPLATE/bug-report.yml @@ -1,4 +1,4 @@ -labels: ["bug"] +labels: ['bug'] body: - type: markdown attributes: diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 9730895a..d1588be8 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -10,4 +10,7 @@ liberapay: # Replace with a single Liberapay username issuehunt: # Replace with a single IssueHunt username otechie: # Replace with a single Otechie username lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry -custom: ['https://daishi.gumroad.com/l/uaxms', 'https://daishi.gumroad.com/l/learn-zustand-v4'] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] +custom: [ + 'https://daishi.gumroad.com/l/uaxms', + 'https://daishi.gumroad.com/l/learn-zustand-v4', + ] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index bb6135f5..00e23d73 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -4,6 +4,4 @@ about: This is to create a new issue that already has an assignee. Please open a title: '' labels: '' assignees: '' - --- - diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index a11baaa1..0e904f6a 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -4,8 +4,6 @@ Fixes # ## Summary - - ## Check List - [ ] `pnpm run fix` for formatting and linting code and docs diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..dee70d2f --- /dev/null +++ b/.prettierignore @@ -0,0 +1,2 @@ +dist +pnpm-lock.yaml diff --git a/examples/demo/index.html b/examples/demo/index.html index 663b24e2..f8fc23e1 100644 --- a/examples/demo/index.html +++ b/examples/demo/index.html @@ -1,11 +1,14 @@ - + - + diff --git a/examples/demo/src/pmndrs.css b/examples/demo/src/pmndrs.css index ed77570c..3faecdb3 100644 --- a/examples/demo/src/pmndrs.css +++ b/examples/demo/src/pmndrs.css @@ -4,120 +4,120 @@ * @author Paul Henschel */ - code[class*='language-'], - pre[class*='language-'] { - color: #e4f0fb!important; - background: none!important; - text-shadow: 0 1px rgba(0, 0, 0, 0.3)!important; - font-family: Menlo, Monaco, 'Courier New', monospace!important; - font-size: 0.95em!important; - text-align: left!important; - white-space: pre!important; - word-spacing: normal!important; - word-break: normal!important; - word-wrap: normal!important; - line-height: 1.5!important; - - -moz-tab-size: 4!important; - -o-tab-size: 4!important; - tab-size: 4!important; - - -webkit-hyphens: none!important; - -moz-hyphens: none!important; - -ms-hyphens: none!important; - hyphens: none!important; - } - - /* Code blocks */ - pre[class*='language-'] { - padding: 3.75em!important; - margin: -2.5em 0!important; - overflow: auto!important; - border-radius: 0.75em!important; - } - - :not(pre) > code[class*='language-'], - pre[class*='language-'] { - background: #252b37!important; - } - - /* Inline code */ - :not(pre) > code[class*='language-'] { - padding: 0.1em!important; - border-radius: 0.3em!important; - white-space: normal!important; - } - - .token.comment, - .token.prolog, - .token.doctype, - .token.cdata { - color: #a6accd!important; - } - - .token.punctuation { - color: #e4f0fb!important; - } - - .token.namespace { - opacity: 0.7!important; - } - - .token.property, - .token.tag, - .token.constant, - .token.symbol, - .token.deleted { - color: #e4f0fb!important; - } - - .token.boolean, - .token.number { - color: #5de4c7!important; - } - - .token.selector, - .token.attr-value, - .token.string, - .token.char, - .token.builtin, - .token.inserted { - color: #5de4c7!important; - } - - .token.attr-name, - .token.operator, - .token.entity, - .token.url, - .language-css .token.string, - .style .token.string, - .token.variable { - color: #add7ff!important; - } - - .token.atrule, - .token.function, - .token.class-name { - color: #5de4c7!important; - } - - .token.keyword { - color: #add7ff!important; - } - - .token.regex, - .token.important { - color: #fffac2!important; - } - - .token.important, - .token.bold { - font-weight: bold!important; - } - .token.italic { - font-style: italic!important; - } - - .token.entity { - cursor: help!important; - } \ No newline at end of file +code[class*='language-'], +pre[class*='language-'] { + color: #e4f0fb !important; + background: none !important; + text-shadow: 0 1px rgba(0, 0, 0, 0.3) !important; + font-family: Menlo, Monaco, 'Courier New', monospace !important; + font-size: 0.95em !important; + text-align: left !important; + white-space: pre !important; + word-spacing: normal !important; + word-break: normal !important; + word-wrap: normal !important; + line-height: 1.5 !important; + + -moz-tab-size: 4 !important; + -o-tab-size: 4 !important; + tab-size: 4 !important; + + -webkit-hyphens: none !important; + -moz-hyphens: none !important; + -ms-hyphens: none !important; + hyphens: none !important; +} + +/* Code blocks */ +pre[class*='language-'] { + padding: 3.75em !important; + margin: -2.5em 0 !important; + overflow: auto !important; + border-radius: 0.75em !important; +} + +:not(pre) > code[class*='language-'], +pre[class*='language-'] { + background: #252b37 !important; +} + +/* Inline code */ +:not(pre) > code[class*='language-'] { + padding: 0.1em !important; + border-radius: 0.3em !important; + white-space: normal !important; +} + +.token.comment, +.token.prolog, +.token.doctype, +.token.cdata { + color: #a6accd !important; +} + +.token.punctuation { + color: #e4f0fb !important; +} + +.token.namespace { + opacity: 0.7 !important; +} + +.token.property, +.token.tag, +.token.constant, +.token.symbol, +.token.deleted { + color: #e4f0fb !important; +} + +.token.boolean, +.token.number { + color: #5de4c7 !important; +} + +.token.selector, +.token.attr-value, +.token.string, +.token.char, +.token.builtin, +.token.inserted { + color: #5de4c7 !important; +} + +.token.attr-name, +.token.operator, +.token.entity, +.token.url, +.language-css .token.string, +.style .token.string, +.token.variable { + color: #add7ff !important; +} + +.token.atrule, +.token.function, +.token.class-name { + color: #5de4c7 !important; +} + +.token.keyword { + color: #add7ff !important; +} + +.token.regex, +.token.important { + color: #fffac2 !important; +} + +.token.important, +.token.bold { + font-weight: bold !important; +} +.token.italic { + font-style: italic !important; +} + +.token.entity { + cursor: help !important; +} diff --git a/examples/demo/src/styles.css b/examples/demo/src/styles.css index e98fb070..a50264c7 100644 --- a/examples/demo/src/styles.css +++ b/examples/demo/src/styles.css @@ -19,7 +19,18 @@ body, } body { - font-family: -apple-system, BlinkMacSystemFont, avenir next, avenir, helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, arial, + font-family: + -apple-system, + BlinkMacSystemFont, + avenir next, + avenir, + helvetica neue, + helvetica, + ubuntu, + roboto, + noto, + segoe ui, + arial, sans-serif; } @@ -110,7 +121,18 @@ span.header-left { } a { - font-family: -apple-system, BlinkMacSystemFont, avenir next, avenir, helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, arial, + font-family: + -apple-system, + BlinkMacSystemFont, + avenir next, + avenir, + helvetica neue, + helvetica, + ubuntu, + roboto, + noto, + segoe ui, + arial, sans-serif; font-weight: 400; font-size: 16px; @@ -191,11 +213,11 @@ a.bottom-right { margin-right: -0px; } .code-container > pre[class*='language-'] { - font-size: 0.6rem!important; + font-size: 0.6rem !important; border-radius: 10px 10px 0 0 !important; } .counter { position: absolute; top: -120px; } -} \ No newline at end of file +} diff --git a/examples/starter/index.html b/examples/starter/index.html index 91f9ad21..e6d9ec78 100644 --- a/examples/starter/index.html +++ b/examples/starter/index.html @@ -1,4 +1,4 @@ - + diff --git a/examples/starter/tsconfig.json b/examples/starter/tsconfig.json index 6aae5756..e7841da9 100644 --- a/examples/starter/tsconfig.json +++ b/examples/starter/tsconfig.json @@ -19,4 +19,3 @@ "include": ["vite.config.ts", "./src/**/*"], "exclude": ["node_modules"] } - diff --git a/package.json b/package.json index 9f36106a..edf27e2a 100644 --- a/package.json +++ b/package.json @@ -65,10 +65,10 @@ "build:traditional": "rollup -c --config-traditional", "postbuild": "pnpm run patch-d-ts && pnpm run copy && pnpm run patch-old-ts && pnpm run patch-esm-ts", "fix": "pnpm run fix:lint && pnpm run fix:format", - "fix:format": "prettier \"*.{js,json,md}\" \"{examples,src,tests,docs}/**/*.{js,jsx,ts,tsx,md,mdx}\" --write", + "fix:format": "prettier . --write", "fix:lint": "eslint . --fix", "test": "pnpm run \"/^test:.*/\"", - "test:format": "prettier \"*.{js,json,md}\" \"{examples,src,tests,docs}/**/*.{js,jsx,ts,tsx,md,mdx}\" --list-different", + "test:format": "prettier . --list-different", "test:types": "tsc --noEmit", "test:lint": "eslint .", "test:spec": "vitest run", diff --git a/vitest.config.mts b/vitest.config.mts index cf89edb2..c6a80d65 100644 --- a/vitest.config.mts +++ b/vitest.config.mts @@ -16,7 +16,9 @@ export default defineConfig({ globals: true, environment: 'jsdom', dir: 'tests', - reporters: process.env.GITHUB_ACTIONS ? ['default', 'github-actions'] : ['default'], + reporters: process.env.GITHUB_ACTIONS + ? ['default', 'github-actions'] + : ['default'], setupFiles: ['tests/setup.ts'], coverage: { include: ['src/**/'],