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

chore: add prettier-plugin-tailwindcss & eslint cache #4114

Merged
merged 10 commits into from
Mar 31, 2023

Conversation

QuiiBz
Copy link
Member

@QuiiBz QuiiBz commented Mar 30, 2023

🎯 Changes

Add eslint-plugin-tailwindcss for automatic class name sorting, and some utility rules:

  • the no-arbitrary-value rule is set to warn, we have around 15 occurrences in www. Do we want to turn it off?
  • the no-custom-classname rule is set to warn by default, which allowed me to fix unused/wrong classes

This PR also adds --cache to every eslint call, which greatly improves the speed of running eslint locally (it only reruns on files that have changed)

✅ Checklist

  • I have followed the steps listed in the Contributing guide.
  • If necessary, I have added documentation related to the changes made.
  • I have added or updated the tests related to the changes made.

@vercel
Copy link

vercel bot commented Mar 30, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
next-prisma-starter ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Mar 31, 2023 at 7:46AM (UTC)
og-image ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Mar 31, 2023 at 7:46AM (UTC)
www ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Mar 31, 2023 at 7:46AM (UTC)

@@ -11,7 +11,7 @@ type Props = {

export const ContentSlider = ({ cards }: Props) => {
return (
<div className="no-scrollbar grid snap-x snap-mandatory gap-8 overflow-x-auto px-4 sm:grid-cols-1 md:grid-cols-2 xl:grid-cols-3">
<div className="grid snap-x snap-mandatory gap-8 overflow-x-auto px-4 sm:grid-cols-1 md:grid-cols-2 xl:grid-cols-3">
Copy link
Member Author

Choose a reason for hiding this comment

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

no-scrollbar class doesn't exists

@@ -10,7 +10,7 @@ export const Preview = () => {
muted
playsInline
width="1200px"
className="border-6 rounded-lg border-[#111111] bg-[#111111] shadow-xl md:hidden"
className="rounded-lg border-4 border-[#111111] bg-[#111111] shadow-xl md:hidden"
Copy link
Member Author

Choose a reason for hiding this comment

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

border-6 doesn't exist in tailwind, so I've replaced it with border-4. We can also use an arbitrary value instead.

.eslintrc.js Outdated
@@ -8,6 +8,7 @@ const config = {
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'plugin:tailwindcss/recommended',
Copy link
Member

Choose a reason for hiding this comment

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

i've only used the prettier-plugin before - how does this compare?

I was thinking of making a PR just now migrating to tailwind 3.3 with TS config, does this support that? We added support to the prettier plugin here: tailwindlabs/prettier-plugin-tailwindcss#137

Copy link
Member Author

Choose a reason for hiding this comment

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

This eslint plugin is similar to the prettier one (to order class names) but also adds some interesting rules.

tailwind.config.ts doesn't seem to be supported yet, but I'll happily dig into adding support for it: francoismassart/eslint-plugin-tailwindcss#228

@juliusmarminge
Copy link
Member

juliusmarminge commented Mar 31, 2023

Just checked this out and was gonna fix the eslint plugin but autosave is suuuuperslow for me now - is this a heavy plugin? Saving a file is like 5sec - and that's after making the plugin only run on www & websocket example

@juliusmarminge
Copy link
Member

Changed to prettier plugin for now, but left the eslint config in there just commented out so we can swap later if it gets faster (im guessing its cause i put the ts-configs in there and it doesn't load those properly)

@juliusmarminge juliusmarminge changed the title chore: add eslint-plugin-tailwindcss & eslint cache chore: add prettier-plugin-tailwindcss & eslint cache Mar 31, 2023
@juliusmarminge
Copy link
Member

Hijacked your PR even more and updated prettier too XD

@QuiiBz
Copy link
Member Author

QuiiBz commented Mar 31, 2023

Just checked this out and was gonna fix the eslint plugin but autosave is suuuuperslow for me now

I thought it was a bug on my computer, but sadly yeah it appears that it's kinda slow :(

Does the prettier plugin supports tailwind.config.ts?

@juliusmarminge
Copy link
Member

Does the prettier plugin supports tailwind.config.ts?

Yes it does! tailwindlabs/prettier-plugin-tailwindcss#137

@juliusmarminge juliusmarminge merged commit 663c63e into main Mar 31, 2023
@juliusmarminge juliusmarminge deleted the chore/eslint-plugin-tailwindcss branch March 31, 2023 07:50
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
😌 QoL Quality of life for contributors @trpc/react-query @trpc/server 🕸 www Stuff to do with the website (`/www` folder)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants