From 5b0d7887373426628f61214ef59043caa48f8d9a Mon Sep 17 00:00:00 2001 From: Patrick Schratz Date: Tue, 31 Dec 2024 14:03:21 +0100 Subject: [PATCH 1/2] Add vscode tailwind extensions & prettier tailwind linter, sort tailwind classes (#4622) Co-authored-by: Anbraten <6918444+anbraten@users.noreply.github.com> --- .gitpod.yml | 1 + .vscode/extensions.json | 3 +- .woodpecker/docs.yaml | 5 +- .woodpecker/static.yaml | 6 +- .woodpecker/web.yaml | 11 ++++ docs/docs/92-development/03-ui.md | 1 + .../src/theme/WoodpeckerPlugin.tsx | 2 +- .../src/theme/WoodpeckerPluginList.tsx | 2 +- web/.prettierrc.js | 2 +- web/package.json | 1 + web/pnpm-lock.yaml | 64 +++++++++++++++++++ web/src/App.vue | 8 +-- .../admin/settings/queue/AdminQueueStats.vue | 20 +++--- web/src/components/agent/AgentList.vue | 10 +-- web/src/components/atomic/Badge.vue | 6 +- web/src/components/atomic/Button.vue | 8 +-- web/src/components/atomic/CountBadge.vue | 2 +- web/src/components/atomic/DocsLink.vue | 2 +- web/src/components/atomic/Error.vue | 2 +- web/src/components/atomic/Icon.vue | 2 +- web/src/components/atomic/IconButton.vue | 6 +- web/src/components/atomic/ListItem.vue | 4 +- web/src/components/atomic/Warning.vue | 2 +- web/src/components/form/Checkbox.vue | 8 +-- web/src/components/form/InputField.vue | 6 +- web/src/components/form/RadioField.vue | 8 +-- web/src/components/form/SelectField.vue | 2 +- web/src/components/form/TextField.vue | 4 +- web/src/components/layout/Container.vue | 2 +- web/src/components/layout/Panel.vue | 12 ++-- web/src/components/layout/Popup.vue | 6 +- web/src/components/layout/Settings.vue | 8 +-- .../layout/header/ActivePipelines.vue | 8 +-- web/src/components/layout/header/Navbar.vue | 28 ++++---- .../layout/popups/DeployPipelinePopup.vue | 4 +- web/src/components/layout/scaffold/Header.vue | 16 ++--- web/src/components/layout/scaffold/Tabs.vue | 8 +-- .../pipeline-feed/PipelineFeedItem.vue | 12 ++-- .../pipeline-feed/PipelineFeedSidebar.vue | 4 +- web/src/components/registry/RegistryList.vue | 8 +-- web/src/components/repo/RepoItem.vue | 14 ++-- .../components/repo/pipeline/PipelineItem.vue | 28 ++++---- .../components/repo/pipeline/PipelineLog.vue | 38 +++++------ .../repo/pipeline/PipelineStatusIcon.vue | 2 +- .../repo/pipeline/PipelineStepList.vue | 36 +++++------ web/src/components/secrets/SecretEdit.vue | 2 +- web/src/components/secrets/SecretList.vue | 10 +-- web/src/style.css | 10 +-- web/src/views/Login.vue | 18 +++--- web/src/views/NotFound.vue | 4 +- web/src/views/RepoAdd.vue | 4 +- web/src/views/Repos.vue | 6 +- web/src/views/admin/AdminInfo.vue | 4 +- web/src/views/admin/AdminOrgs.vue | 10 +-- web/src/views/admin/AdminQueue.vue | 8 +-- web/src/views/admin/AdminRegistries.vue | 2 +- web/src/views/admin/AdminRepos.vue | 10 +-- web/src/views/admin/AdminSecrets.vue | 2 +- web/src/views/admin/AdminUsers.vue | 14 ++-- web/src/views/cli/Auth.vue | 12 ++-- web/src/views/repo/RepoBranch.vue | 2 +- web/src/views/repo/RepoBranches.vue | 2 +- web/src/views/repo/RepoManualPipeline.vue | 6 +- web/src/views/repo/RepoPullRequest.vue | 2 +- web/src/views/repo/RepoPullRequests.vue | 4 +- web/src/views/repo/RepoWrapper.vue | 2 +- web/src/views/repo/pipeline/Pipeline.vue | 16 ++--- .../repo/pipeline/PipelineChangedFiles.vue | 2 +- .../views/repo/pipeline/PipelineConfig.vue | 2 +- web/src/views/repo/pipeline/PipelineDebug.vue | 8 +-- .../views/repo/pipeline/PipelineErrors.vue | 4 +- .../views/repo/pipeline/PipelineWrapper.vue | 8 +-- web/src/views/repo/settings/Actions.vue | 8 +-- web/src/views/repo/settings/Crons.vue | 16 ++--- web/src/views/repo/settings/General.vue | 6 +- web/src/views/user/UserCLIAndAPI.vue | 4 +- 76 files changed, 363 insertions(+), 277 deletions(-) diff --git a/.gitpod.yml b/.gitpod.yml index b99e67542..8eeda234e 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -117,4 +117,5 @@ vscode: - 'redhat.vscode-yaml' - 'davidanson.vscode-markdownlint' - 'streetsidesoftware.code-spell-checker' + - 'stivo.tailwind-fold' # cSpell:enable diff --git a/.vscode/extensions.json b/.vscode/extensions.json index fba35f380..d9312886c 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -8,7 +8,8 @@ "voorjaar.windicss-intellisense", "Vue.volar", "redhat.vscode-yaml", - "davidanson.vscode-markdownlint" + "davidanson.vscode-markdownlint", + "stivo.tailwind-fold" ], // List of extensions recommended by VS Code that should not be recommended for users of this workspace. "unwantedRecommendations": [] diff --git a/.woodpecker/docs.yaml b/.woodpecker/docs.yaml index 9bb85833b..583560aca 100644 --- a/.woodpecker/docs.yaml +++ b/.woodpecker/docs.yaml @@ -38,9 +38,12 @@ when: steps: prettier: - image: docker.io/woodpeckerci/plugin-prettier:1.0.0 + image: docker.io/woodpeckerci/plugin-prettier:next settings: version: 3.3.3 + plugins: + - 'prettier-plugin-tailwindcss' + - '@ianvs/prettier-plugin-sort-imports' when: - event: pull_request diff --git a/.woodpecker/static.yaml b/.woodpecker/static.yaml index 22b6cf064..3918b864f 100644 --- a/.woodpecker/static.yaml +++ b/.woodpecker/static.yaml @@ -19,7 +19,11 @@ steps: - tree --gitignore -I 012_columns_rename_procs_to_steps.go -I versioned_docs -I '*opensource.svg'| pnpx cspell lint --no-progress stdin - name: prettier - image: docker.io/woodpeckerci/plugin-prettier:1.0.0 + image: docker.io/woodpeckerci/plugin-prettier:next + pull: true depends_on: [] settings: version: 3.3.3 + plugins: + - 'prettier-plugin-tailwindcss' + - '@ianvs/prettier-plugin-sort-imports' diff --git a/.woodpecker/web.yaml b/.woodpecker/web.yaml index 141f4acb6..02cf80911 100644 --- a/.woodpecker/web.yaml +++ b/.woodpecker/web.yaml @@ -24,6 +24,17 @@ steps: - pnpm install --frozen-lockfile when: *when + prettier: + depends_on: + - install-dependencies + image: docker.io/woodpeckerci/plugin-prettier:next + pull: true + settings: + version: 3.3.3 + plugins: + - 'prettier-plugin-tailwindcss' + - '@ianvs/prettier-plugin-sort-imports' + lint: depends_on: - install-dependencies diff --git a/docs/docs/92-development/03-ui.md b/docs/docs/92-development/03-ui.md index 6a01584c2..1416c5e4a 100644 --- a/docs/docs/92-development/03-ui.md +++ b/docs/docs/92-development/03-ui.md @@ -24,6 +24,7 @@ The following list contains some tools and frameworks used by the Woodpecker UI. - [Windicss](https://windicss.org/) (similar to Tailwind) - use Windicss classes where possible - if needed extend the Windicss config to use new classes + - classes are sorted following the [prettier tailwind sort plugin](https://tailwindcss.com/blog/automatic-class-sorting-with-prettier) - [Vite](https://vitejs.dev/) (similar to Webpack) - [Typescript](https://www.typescriptlang.org/) - avoid using `any` and `unknown` (the linter will prevent you from doing so anyways :wink:) diff --git a/docs/plugins/woodpecker-plugins/src/theme/WoodpeckerPlugin.tsx b/docs/plugins/woodpecker-plugins/src/theme/WoodpeckerPlugin.tsx index 5826ccb94..0aeaa86b1 100644 --- a/docs/plugins/woodpecker-plugins/src/theme/WoodpeckerPlugin.tsx +++ b/docs/plugins/woodpecker-plugins/src/theme/WoodpeckerPlugin.tsx @@ -7,7 +7,7 @@ import { IconContainer, IconPlugin, IconVerified, IconWebsite } from './Icons'; export function WoodpeckerPlugin({ plugin }: { plugin: WoodpeckerPluginType }) { return ( -
+
diff --git a/docs/plugins/woodpecker-plugins/src/theme/WoodpeckerPluginList.tsx b/docs/plugins/woodpecker-plugins/src/theme/WoodpeckerPluginList.tsx index e80e32b59..266236f7e 100644 --- a/docs/plugins/woodpecker-plugins/src/theme/WoodpeckerPluginList.tsx +++ b/docs/plugins/woodpecker-plugins/src/theme/WoodpeckerPluginList.tsx @@ -52,7 +52,7 @@ export function WoodpeckerPluginList({ plugins }: { plugins: WoodpeckerPlugin[] return ( -
+

Woodpecker CI plugins

diff --git a/web/.prettierrc.js b/web/.prettierrc.js index 1fb217ea6..51832a96e 100644 --- a/web/.prettierrc.js +++ b/web/.prettierrc.js @@ -5,7 +5,7 @@ const config = JSON.parse(await readFile(new URL('../.prettierrc.json', import.m export default { ...config, - plugins: ['@ianvs/prettier-plugin-sort-imports'], + plugins: ['@ianvs/prettier-plugin-sort-imports', 'prettier-plugin-tailwindcss'], importOrder: [ '', // Imports not matched by other special words or groups. '', // Empty string will match any import not matched by other special words or groups. diff --git a/web/package.json b/web/package.json index 9bd4e7a92..343df48ed 100644 --- a/web/package.json +++ b/web/package.json @@ -29,6 +29,7 @@ "marked": "^15.0.4", "node-emoji": "^2.2.0", "pinia": "^2.3.0", + "prettier-plugin-tailwindcss": "^0.6.9", "prismjs": "^1.29.0", "semver": "^7.6.3", "simple-icons": "^14.0.0", diff --git a/web/pnpm-lock.yaml b/web/pnpm-lock.yaml index 7e6a89d06..9c5e6f011 100644 --- a/web/pnpm-lock.yaml +++ b/web/pnpm-lock.yaml @@ -44,6 +44,9 @@ importers: pinia: specifier: ^2.3.0 version: 2.3.0(typescript@5.7.2)(vue@3.5.13(typescript@5.7.2)) + prettier-plugin-tailwindcss: + specifier: ^0.6.9 + version: 0.6.9(@ianvs/prettier-plugin-sort-imports@4.4.0(@vue/compiler-sfc@3.5.13)(prettier@3.4.2))(prettier@3.4.2) prismjs: specifier: ^1.29.0 version: 1.29.0 @@ -2361,6 +2364,61 @@ packages: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} engines: {node: '>= 0.8.0'} + prettier-plugin-tailwindcss@0.6.9: + resolution: {integrity: sha512-r0i3uhaZAXYP0At5xGfJH876W3HHGHDp+LCRUJrs57PBeQ6mYHMwr25KH8NPX44F2yGTvdnH7OqCshlQx183Eg==} + engines: {node: '>=14.21.3'} + peerDependencies: + '@ianvs/prettier-plugin-sort-imports': '*' + '@prettier/plugin-pug': '*' + '@shopify/prettier-plugin-liquid': '*' + '@trivago/prettier-plugin-sort-imports': '*' + '@zackad/prettier-plugin-twig-melody': '*' + prettier: ^3.0 + prettier-plugin-astro: '*' + prettier-plugin-css-order: '*' + prettier-plugin-import-sort: '*' + prettier-plugin-jsdoc: '*' + prettier-plugin-marko: '*' + prettier-plugin-multiline-arrays: '*' + prettier-plugin-organize-attributes: '*' + prettier-plugin-organize-imports: '*' + prettier-plugin-sort-imports: '*' + prettier-plugin-style-order: '*' + prettier-plugin-svelte: '*' + peerDependenciesMeta: + '@ianvs/prettier-plugin-sort-imports': + optional: true + '@prettier/plugin-pug': + optional: true + '@shopify/prettier-plugin-liquid': + optional: true + '@trivago/prettier-plugin-sort-imports': + optional: true + '@zackad/prettier-plugin-twig-melody': + optional: true + prettier-plugin-astro: + optional: true + prettier-plugin-css-order: + optional: true + prettier-plugin-import-sort: + optional: true + prettier-plugin-jsdoc: + optional: true + prettier-plugin-marko: + optional: true + prettier-plugin-multiline-arrays: + optional: true + prettier-plugin-organize-attributes: + optional: true + prettier-plugin-organize-imports: + optional: true + prettier-plugin-sort-imports: + optional: true + prettier-plugin-style-order: + optional: true + prettier-plugin-svelte: + optional: true + prettier@3.4.2: resolution: {integrity: sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ==} engines: {node: '>=14'} @@ -5404,6 +5462,12 @@ snapshots: prelude-ls@1.2.1: {} + prettier-plugin-tailwindcss@0.6.9(@ianvs/prettier-plugin-sort-imports@4.4.0(@vue/compiler-sfc@3.5.13)(prettier@3.4.2))(prettier@3.4.2): + dependencies: + prettier: 3.4.2 + optionalDependencies: + '@ianvs/prettier-plugin-sort-imports': 4.4.0(@vue/compiler-sfc@3.5.13)(prettier@3.4.2) + prettier@3.4.2: {} prismjs@1.29.0: {} diff --git a/web/src/App.vue b/web/src/App.vue index 98e0ffb41..a516cbca6 100644 --- a/web/src/App.vue +++ b/web/src/App.vue @@ -1,14 +1,14 @@