From 42d160eb7a1ea8d00117e0d442a4ec3fc1b0bef3 Mon Sep 17 00:00:00 2001 From: yuyinws Date: Mon, 14 Oct 2024 17:33:04 +0800 Subject: [PATCH] feat: add `vitepress-plugin-group-icons` --- .vitepress/config/shared.ts | 13 ++ .vitepress/oxc-logo.svg | 29 ++++ .vitepress/theme/index.ts | 1 + package.json | 1 + pnpm-lock.yaml | 126 ++++++++++++++++++ src/docs/guide/usage/linter.md | 6 +- .../guide/usage/linter/generated-config.md | 4 +- 7 files changed, 173 insertions(+), 7 deletions(-) create mode 100644 .vitepress/oxc-logo.svg diff --git a/.vitepress/config/shared.ts b/.vitepress/config/shared.ts index 47a578acf79..1a4d98c8f32 100644 --- a/.vitepress/config/shared.ts +++ b/.vitepress/config/shared.ts @@ -1,6 +1,7 @@ import { dirname, resolve } from "node:path"; import { fileURLToPath } from "node:url"; import { HeadConfig, defineConfig } from "vitepress"; +import { groupIconMdPlugin, groupIconVitePlugin, localIconLoader } from "vitepress-plugin-group-icons"; const head: HeadConfig[] = [ [ @@ -75,7 +76,19 @@ export const sharedConfig = defineConfig({ copyright: "Copyright © 2023-present Boshen & Oxc Contributors", }, }, + markdown: { + config(md) { + md.use(groupIconMdPlugin); + }, + }, vite: { + plugins: [ + groupIconVitePlugin({ + customIcon: { + ".oxlintrc": localIconLoader(import.meta.url, "../oxc-logo.svg"), + }, + }), + ], resolve: { alias: [ { diff --git a/.vitepress/oxc-logo.svg b/.vitepress/oxc-logo.svg new file mode 100644 index 00000000000..9a7c7643fa8 --- /dev/null +++ b/.vitepress/oxc-logo.svg @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.vitepress/theme/index.ts b/.vitepress/theme/index.ts index e1bf87781c3..90d531a82ea 100644 --- a/.vitepress/theme/index.ts +++ b/.vitepress/theme/index.ts @@ -4,6 +4,7 @@ import DefaultTheme from "vitepress/theme"; import AppBadgeList from "./components/AppBadgeList.vue"; import AppBlogPostHeader from "./components/AppBlogPostHeader.vue"; import Alert from "./components/Alert.vue"; +import "virtual:group-icons.css"; export default { extends: DefaultTheme, diff --git a/package.json b/package.json index 69565fe2ca3..52406640777 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "tsx": "^4.19.1", "typescript": "~5.6.0", "vitepress": "1.3.4", + "vitepress-plugin-group-icons": "^1.2.4", "vue": "^3.5.8" }, "lint-staged": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index de242c4c201..53532469378 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -47,6 +47,9 @@ importers: vitepress: specifier: 1.3.4 version: 1.3.4(@algolia/client-search@4.24.0)(@types/node@22.7.4)(postcss@8.4.47)(search-insights@2.14.0)(typescript@5.6.2) + vitepress-plugin-group-icons: + specifier: ^1.2.4 + version: 1.2.4 vue: specifier: ^3.5.8 version: 3.5.11(typescript@5.6.2) @@ -118,6 +121,12 @@ packages: '@algolia/transporter@4.24.0': resolution: {integrity: sha512-86nI7w6NzWxd1Zp9q3413dRshDqAzSbsQjhcDhPIatEFiZrL1/TjnHL8S7jVKFePlIMzDsZWXAXwXzcok9c5oA==} + '@antfu/install-pkg@0.4.1': + resolution: {integrity: sha512-T7yB5QNG29afhWVkVq7XeIMBa5U/vs9mX69YqayXypPRmYzUmzwnYltplHmPtZ4HPCn+sQKeXW8I47wCbuBOjw==} + + '@antfu/utils@0.7.10': + resolution: {integrity: sha512-+562v9k4aI80m1+VuMHehNJWLOFjBnXn3tdOitzD0il5b7smkSBal4+a3oKiQTbrwMmN/TBUMDvbdoWDehgOww==} + '@babel/helper-string-parser@7.25.7': resolution: {integrity: sha512-CbkjYdsJNHFk8uqpEkpCvRs3YRp9tY6FmFY7wLMSYuGYkrdUi7r2lc4/wqsvlHoMznX3WJ9IP8giGPq68T/Y6g==} engines: {node: '>=6.9.0'} @@ -440,6 +449,18 @@ packages: cpu: [x64] os: [win32] + '@iconify-json/logos@1.2.3': + resolution: {integrity: sha512-JLHS5hgZP1b55EONAWNeqBUuriRfRNKWXK4cqYx0PpVaJfIIMiiMxFfvoQiX/bkE9XgkLhcKmDUqL3LXPdXPwQ==} + + '@iconify-json/vscode-icons@1.2.2': + resolution: {integrity: sha512-bTpT0HJDRqGkxQv8oiETNHLEnBZpnA1QaRD35CQyO7M7qgWVLx2xwn/lK6e4waojmlPC3ckMBx3WFIUUn0/Jdg==} + + '@iconify/types@2.0.0': + resolution: {integrity: sha512-+wluvCrRhXrhyOmRDJ3q8mux9JkKy5SJ/v8ol2tu4FVjyYvtEzkc/3pK15ET6RKg4b4w4BmTk1+gsCUhf21Ykg==} + + '@iconify/utils@2.1.33': + resolution: {integrity: sha512-jP9h6v/g0BIZx0p7XGJJVtkVnydtbgTgt9mVNcGDYwaa7UhdHdI9dvoq+gKj9sijMSJKxUPEG2JyjsgXjxL7Kw==} + '@jridgewell/sourcemap-codec@1.5.0': resolution: {integrity: sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==} @@ -706,6 +727,11 @@ packages: '@vueuse/shared@11.1.0': resolution: {integrity: sha512-YUtIpY122q7osj+zsNMFAfMTubGz0sn5QzE5gPzAIiCmtt2ha3uQUY1+JPyL4gRCTsLPX82Y9brNbo/aqlA91w==} + acorn@8.12.1: + resolution: {integrity: sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==} + engines: {node: '>=0.4.0'} + hasBin: true + algoliasearch@4.24.0: resolution: {integrity: sha512-bf0QV/9jVejssFBmz2HQLxUadxk574t4iwjCKp5E7NBzwKkrDEhKPISIIjAU/p6K5qDx3qoeh4+26zWN1jmw3g==} @@ -762,6 +788,9 @@ packages: resolution: {integrity: sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==} engines: {node: '>=18'} + confbox@0.1.8: + resolution: {integrity: sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w==} + consola@3.2.3: resolution: {integrity: sha512-I5qxpzLv+sJhTVEoLYNcTW+bThDCPsit0vLNKShZx6rLtpilNpmmeTPaeqJb9ZE9dV3DGaeby6Vuhrw38WjeyQ==} engines: {node: ^14.18.0 || >=16.10.0} @@ -900,6 +929,9 @@ packages: isexe@2.0.0: resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} + kolorist@1.8.0: + resolution: {integrity: sha512-Y+60/zizpJ3HRH8DCss+q95yr6145JXZo46OTpFvDZWLfRCE4qChOyk1b26nMaNpfHHgxagk9dXT5OP0Tfe+dQ==} + lilconfig@3.1.2: resolution: {integrity: sha512-eop+wDAvpItUys0FWkHIKeC9ybYrTGbU41U5K7+bttZZeohvnY7M9dZ5kB21GNWiFT2q1OoPTvncPCgSOVO5ow==} engines: {node: '>=14'} @@ -913,6 +945,10 @@ packages: resolution: {integrity: sha512-opevsywziHd3zHCVQGAj8zu+Z3yHNkkoYhWIGnq54RrCVwLz0MozotJEDnKsIBLvkfLGN6BLOyAeRrYI0pKA4g==} engines: {node: '>=18.0.0'} + local-pkg@0.5.0: + resolution: {integrity: sha512-ok6z3qlYyCDS4ZEU27HaU6x/xZa9Whf8jD4ptH5UZTQYZVYeb9bnZ3ojVhiJNLiXK1Hfc0GNbLXcmZ5plLDDBg==} + engines: {node: '>=14'} + log-update@6.1.0: resolution: {integrity: sha512-9ie8ItPR6tjY5uYJh8K/Zrv/RMZ5VOlOWvtZdEHYSTFKZfIBPQa9tOAEeAWhd+AnIneLJ22w5fjOYtoutpWq5w==} engines: {node: '>=18'} @@ -962,6 +998,9 @@ packages: mitt@3.0.1: resolution: {integrity: sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==} + mlly@1.7.2: + resolution: {integrity: sha512-tN3dvVHYVz4DhSXinXIk7u9syPYaJvio118uomkovAtWBT+RdbP6Lfh/5Lvo519YMmwBafwlh20IPTXIStscpA==} + ms@2.1.3: resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} @@ -990,6 +1029,9 @@ packages: engines: {node: '>=14.*'} hasBin: true + package-manager-detector@0.2.2: + resolution: {integrity: sha512-VgXbyrSNsml4eHWIvxxG/nTL4wgybMTXCV2Un/+yEc3aDKKU6nQBZjbeP3Pl3qm9Qg92X/1ng4ffvCeD/zwHgg==} + path-key@3.1.1: resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} engines: {node: '>=8'} @@ -998,6 +1040,9 @@ packages: resolution: {integrity: sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==} engines: {node: '>=12'} + pathe@1.1.2: + resolution: {integrity: sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==} + perfect-debounce@1.0.0: resolution: {integrity: sha512-xCy9V055GLEqoFaHoC1SoLIaLmWctgCUaBaWxDZ7/Zx4CTyX7cJQLJOok/orfjZAh9kEYpjJa4d0KcJmCbctZA==} @@ -1013,6 +1058,9 @@ packages: engines: {node: '>=0.10'} hasBin: true + pkg-types@1.2.1: + resolution: {integrity: sha512-sQoqa8alT3nHjGuTjuKgOnvjo4cljkufdtLMnO2LBP/wRwuDlo1tkaEdMxCRhyGRPacv/ztlZgDPm2b7FAmEvw==} + postcss@8.4.47: resolution: {integrity: sha512-56rxCq7G/XfB4EkXq9Egn5GCqugWvDFjafDOThIdMBsI15iqPqR5r15TfSr1YPYeEI19YeaXMCbY6u88Y76GLQ==} engines: {node: ^10 || ^12 || >=14} @@ -1112,6 +1160,9 @@ packages: tabbable@6.2.0: resolution: {integrity: sha512-Cat63mxsVJlzYvN51JmVXIgNoUokrIaT2zLclCXjRd8boZ0004U4KCs/sToJ75C6sdlByWxpYnb5Boif1VSFew==} + tinyexec@0.3.0: + resolution: {integrity: sha512-tVGE0mVJPGb0chKhqmsoosjsS+qUnJVGJpZgsHYQcGoPlG3B51R3PouqTgEGH2Dc9jjFyOqOpix6ZHNMXp1FZg==} + to-fast-properties@2.0.0: resolution: {integrity: sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==} engines: {node: '>=4'} @@ -1133,6 +1184,9 @@ packages: engines: {node: '>=14.17'} hasBin: true + ufo@1.5.4: + resolution: {integrity: sha512-UsUk3byDzKd04EyoZ7U4DOlxQaD14JUKQl6/P7wiX4FNvUfm3XL246n9W5AmqwW5RSFJ27NAuM0iLscAOYUiGQ==} + undici-types@6.19.8: resolution: {integrity: sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==} @@ -1188,6 +1242,9 @@ packages: terser: optional: true + vitepress-plugin-group-icons@1.2.4: + resolution: {integrity: sha512-pxYzphvRy0Jhpgl3lHszH9Z8Qaj83v4bVr0b8Oi4zSIOQW/uuqGAZ8SaYwkZ1f/8a6ckIeIwZiLfLHA6ySCScQ==} + vitepress@1.3.4: resolution: {integrity: sha512-I1/F6OW1xl3kW4PaIMC6snxjWgf3qfziq2aqsDoFc/Gt41WbcRv++z8zjw8qGRIJ+I4bUW7ZcKFDHHN/jkH9DQ==} hasBin: true @@ -1346,6 +1403,13 @@ snapshots: '@algolia/logger-common': 4.24.0 '@algolia/requester-common': 4.24.0 + '@antfu/install-pkg@0.4.1': + dependencies: + package-manager-detector: 0.2.2 + tinyexec: 0.3.0 + + '@antfu/utils@0.7.10': {} + '@babel/helper-string-parser@7.25.7': {} '@babel/helper-validator-identifier@7.25.7': {} @@ -1525,6 +1589,28 @@ snapshots: '@esbuild/win32-x64@0.23.1': optional: true + '@iconify-json/logos@1.2.3': + dependencies: + '@iconify/types': 2.0.0 + + '@iconify-json/vscode-icons@1.2.2': + dependencies: + '@iconify/types': 2.0.0 + + '@iconify/types@2.0.0': {} + + '@iconify/utils@2.1.33': + dependencies: + '@antfu/install-pkg': 0.4.1 + '@antfu/utils': 0.7.10 + '@iconify/types': 2.0.0 + debug: 4.3.7 + kolorist: 1.8.0 + local-pkg: 0.5.0 + mlly: 1.7.2 + transitivePeerDependencies: + - supports-color + '@jridgewell/sourcemap-codec@1.5.0': {} '@oxlint/darwin-arm64@0.9.9': @@ -1766,6 +1852,8 @@ snapshots: - '@vue/composition-api' - vue + acorn@8.12.1: {} + algoliasearch@4.24.0: dependencies: '@algolia/cache-browser-local-storage': 4.24.0 @@ -1825,6 +1913,8 @@ snapshots: commander@12.1.0: {} + confbox@0.1.8: {} + consola@3.2.3: {} copy-anything@3.0.5: @@ -1989,6 +2079,8 @@ snapshots: isexe@2.0.0: {} + kolorist@1.8.0: {} + lilconfig@3.1.2: {} lint-staged@15.2.10: @@ -2015,6 +2107,11 @@ snapshots: rfdc: 1.4.1 wrap-ansi: 9.0.0 + local-pkg@0.5.0: + dependencies: + mlly: 1.7.2 + pkg-types: 1.2.1 + log-update@6.1.0: dependencies: ansi-escapes: 7.0.0 @@ -2073,6 +2170,13 @@ snapshots: mitt@3.0.1: {} + mlly@1.7.2: + dependencies: + acorn: 8.12.1 + pathe: 1.1.2 + pkg-types: 1.2.1 + ufo: 1.5.4 + ms@2.1.3: {} nanoid@3.3.7: {} @@ -2104,10 +2208,14 @@ snapshots: '@oxlint/win32-arm64': 0.9.9 '@oxlint/win32-x64': 0.9.9 + package-manager-detector@0.2.2: {} + path-key@3.1.1: {} path-key@4.0.0: {} + pathe@1.1.2: {} + perfect-debounce@1.0.0: {} picocolors@1.1.0: {} @@ -2116,6 +2224,12 @@ snapshots: pidtree@0.6.0: {} + pkg-types@1.2.1: + dependencies: + confbox: 0.1.8 + mlly: 1.7.2 + pathe: 1.1.2 + postcss@8.4.47: dependencies: nanoid: 3.3.7 @@ -2223,6 +2337,8 @@ snapshots: tabbable@6.2.0: {} + tinyexec@0.3.0: {} + to-fast-properties@2.0.0: {} to-regex-range@5.0.1: @@ -2240,6 +2356,8 @@ snapshots: typescript@5.6.2: {} + ufo@1.5.4: {} + undici-types@6.19.8: {} unist-util-is@6.0.0: @@ -2284,6 +2402,14 @@ snapshots: '@types/node': 22.7.4 fsevents: 2.3.3 + vitepress-plugin-group-icons@1.2.4: + dependencies: + '@iconify-json/logos': 1.2.3 + '@iconify-json/vscode-icons': 1.2.2 + '@iconify/utils': 2.1.33 + transitivePeerDependencies: + - supports-color + vitepress@1.3.4(@algolia/client-search@4.24.0)(@types/node@22.7.4)(postcss@8.4.47)(search-insights@2.14.0)(typescript@5.6.2): dependencies: '@docsearch/css': 3.6.1 diff --git a/src/docs/guide/usage/linter.md b/src/docs/guide/usage/linter.md index 075fb264d25..66aeadbf695 100644 --- a/src/docs/guide/usage/linter.md +++ b/src/docs/guide/usage/linter.md @@ -104,7 +104,7 @@ If you are looking for a way to use oxlint in projects that still need ESLint, Y ### lint-staged -```json +```json [package.json] { "lint-staged": { "**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx,vue,astro,svelte}": "oxlint" @@ -143,9 +143,7 @@ It is advised to pin the version, otherwise CI may fail after a new release. ### pre-commit -.pre-commit-hooks.yaml - -```yaml +```yaml [.pre-commit-hooks.yaml] repos: - repo: https://github.com/oxc-project/mirrors-oxlint rev: v0.0.0 # change to the latest version diff --git a/src/docs/guide/usage/linter/generated-config.md b/src/docs/guide/usage/linter/generated-config.md index b92598d8d98..bebdd85f894 100644 --- a/src/docs/guide/usage/linter/generated-config.md +++ b/src/docs/guide/usage/linter/generated-config.md @@ -12,9 +12,7 @@ Only the `.json` format is supported. You can use comments in configuration file Example -`.oxlintrc.json` - -```json +```json [.oxlintrc.json] { "env": { "browser": true