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

fix(eslint-plugin): blocklist rule cant match variants #3370

Merged
merged 7 commits into from
Nov 29, 2023

Conversation

chizukicn
Copy link
Contributor

This PR will add a new function isBlockedWithStrict to uno generator and fix the problem that eslint-plugin blocklist cannot match variants

before: It is actually blocked, but eslint-plugin will not prompt
e686d6b8bedf72912f04e5638f26f23d

after:
19a9a217b2426ebf31c57921797c9e25

Copy link

netlify bot commented Nov 22, 2023

Deploy Preview for unocss ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit dfc9be3
🔍 Latest deploy log https://app.netlify.com/sites/unocss/deploys/65653eb921f2750008422a08
😎 Deploy Preview https://deploy-preview-3370--unocss.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

return [...extracted.values()].filter(i => uno.isBlocked(i))
const values = [...extracted.values()]
const blocked = await Promise.all(values.map(i => uno.isBlockedWithStrict(i)))
return values.filter((_, i) => blocked[i])
Copy link
Member

Choose a reason for hiding this comment

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

If it's an eslint only feature, how about moving it out of core? Ideally we could have an option for it (I am ok with default strict)

Copy link
Contributor Author

@chizukicn chizukicn Nov 22, 2023

Choose a reason for hiding this comment

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

I prefer to support strict mode directly in isBlocked. I need to spend some time researching how to implement a simple sync API that removes variants

@chizukicn chizukicn marked this pull request as draft November 22, 2023 13:57
@chizukicn chizukicn changed the title feat(core): add isBlockedWithStrict function fix(eslint-plugin): blocklist rule cant match variants Nov 22, 2023
@chizukicn
Copy link
Contributor Author

It seems that it is unrealistic to handle variants synchronously, I moved this function into eslint-plugin

@chizukicn chizukicn marked this pull request as ready for review November 22, 2023 15:08
@chizukicn chizukicn requested a review from antfu November 22, 2023 15:08
@antfu antfu merged commit db19a01 into unocss:main Nov 29, 2023
9 checks passed
@chizukicn chizukicn deleted the feat/block-strict branch November 30, 2023 02:04
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.

None yet

2 participants