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

Invalid value detection #872

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

Alpha1337k
Copy link

Hi there,

I created an addition to the extension that checks for invalid tailwindcss values. I think it could help novice programmers debug their css quicker.

Screenshots:

In code:
image
In problems:
image

Quick fixes:
image

It's currently in mvp state, but if you want we can make it 'production' ready.

If you are not interested, no problem, did this for my own learnings anyways :P

Thanks,
Alpha

@adamwathan
Copy link
Member

Cool idea! How do you think it should work alongside custom CSS? You might have a class like calendar-button or something that you need because of some third-party UI component you're using and I think that would currently be treated as an error 🤔

@Alpha1337k
Copy link
Author

Alpha1337k commented Oct 25, 2023

Yes, currently all non tailwind classes get flagged as errors.

The perfect solution would be to get all the css classes in the project and compare against those. However, I don't think thats possible (?).

Solution 2 is to only flag errors where we are N% sure that they are related to tailwind:

  • bg-gree would get flagged, because it looks like bg-green
  • calendar-button would not get flagged, because it looks very little like an tailwind class.

Furthermore, we could implement an ignore quickaction. Kinda like this:
image

What do you think?

* Feat: working ignore option

* Chore: cleanup && improve: better similarity finding

* Chore: more styling and wording changes

* Chore: more wording changes..
@Alpha1337k
Copy link
Author

Hi @adamwathan,

I finally had some time to add the ignore feature; The ignored keys get stored in the workspaces settings.json file, just like e.g CSpell. For me this works great!

Please take a look again and let me know what you think.

Thanks,

@Alpha1337k
Copy link
Author

Hey I completely forgot about this pull request but it seems no one has looked at it yet. @thecrypticace could you take a look?

@RafalFilipek
Copy link

What if we just inform users that there are custom elements? We don't have to assume that every unknown element is an error.

CleanShot 2024-08-21 at 17 23 48@2x

If a project is using Tailwind, I think it's safe to assume that generally Tailwind classes will be used. From my experience, all I need is quick feedback that I have a custom element.

This is quite similar to how CSpell is working in VSCode.

CleanShot 2024-08-21 at 17 30 31@2x

From here we can think about some extra heuristics or options regarding detection etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants