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 declaration-property-value-no-unknown
false positives for descriptors
#6669
Conversation
🦋 Changeset detectedLatest commit: ca25f9b The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
declaration-property-value-no-unknown
declaration-property-value-no-unknown
false positives for descriptors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@FloEdelmann This is fantastic, thank you!
It's looking good. I've requested a couple of small changes.
lib/rules/declaration-property-value-no-unknown/__tests__/index.js
Outdated
Show resolved
Hide resolved
Co-authored-by: Richard Hallows <jeddy3@users.noreply.github.com>
Co-authored-by: Richard Hallows <jeddy3@users.noreply.github.com>
Co-authored-by: Richard Hallows <jeddy3@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool. LGTM 👏🏼
const { error } = | ||
decl?.parent?.type === 'atrule' | ||
? // @ts-expect-error -- CSSTree types are not complete | ||
forkedLexer.matchAtruleDescriptor(decl.parent.name, prop, cssTreeValueNode) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll send a patch to @types/css-tree
. 💪🏼
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Note that more functions from the Lexer
class are missing, so maybe you can add them all in one batch?
Also, I used @ts-expect-error
instead of @ts-ignore
, so that this PR can be merged first and this will throw an error once the css-tree
types are fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, when I added the Lexer
class type to @types/css-tree
with DefinitelyTyped/DefinitelyTyped#64256, I added only the minimum necessary method as Lexer
really has many methods!
If you know what other methods we will need than matchAtruleDescriptor()
, please let me know. For example, we need methods starting match
like matchAtrulePrelude()
...
I also prefer @ts-expect-error
over @ts-ignore
and more suitable in this situation. 👍🏼
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
matchAtrulePrelude
might be needed for #6560.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've opened PR DefinitelyTyped/DefinitelyTyped#64410. Any feedback is welcome if you have.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making the changes.
LGTM.
Closes #6663.
No, it's self-explanatory.