Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add vscode tailwind extensions & prettier tailwind linter, sort tailwind classes #4622

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

pat-s
Copy link
Contributor

@pat-s pat-s commented Dec 26, 2024

These are the ones that cause the auto-sorting in all my recent PRs. If we would all use these (and sort all classes once), we'd have a predictable and consistent order of tailwind classes.

@pat-s pat-s added skip-changelog build CI pipeline related labels Dec 26, 2024
@xoxys
Copy link
Member

xoxys commented Dec 26, 2024

Can we add linting as well then? Not everybody uses VSCode.

@pat-s pat-s changed the title Add vscode tailwind extensions Add vscode tailwind extensions & prettier tailwind linter, sort tailwind classes Dec 26, 2024
@woodpecker-bot
Copy link
Collaborator

woodpecker-bot commented Dec 26, 2024

Deployment of preview was successful: https://woodpecker-ci-woodpecker-pr-4622.surge.sh

@pat-s
Copy link
Contributor Author

pat-s commented Dec 26, 2024

@pat-s pat-s marked this pull request as draft December 26, 2024 22:39
web/.prettierrc.js Outdated Show resolved Hide resolved
.gitpod.yml Outdated
@@ -117,4 +117,6 @@ vscode:
- 'redhat.vscode-yaml'
- 'davidanson.vscode-markdownlint'
- 'streetsidesoftware.code-spell-checker'
- 'dejmedus.tailwind-sorter'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to be doing the same as the prettier sorting?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's the idea?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am auto formatting with prettier on save which would now already sort the classes. Isn't using that plugin redundant?

Copy link
Contributor Author

@pat-s pat-s Dec 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah they might be indeed doing the same. The vscode one can use custom sorting but if we don't need that, we can stick with the prettier plugin.

image

I started with tailwind-sorter and didn't notice that the prettier plugin is then doing the same work. But it is better as it can be used with linting.

.prettierrc.json Outdated
@@ -4,5 +4,6 @@
"singleQuote": true,
"printWidth": 120,
"tabWidth": 2,
"endOfLine": "lf"
"endOfLine": "lf",
"plugins": ["prettier-plugin-tailwindcss"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have to add this to the top-level config? There's no tailwind in there, only in web

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

web/ and docs/ refer to the top-level config currently. See also #4628

Maybe it can be done in a different way, then one does not need to install this in their global npm package stack.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah forget what I said, I think your proposed change should be just fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build CI pipeline related skip-changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants