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 false positives for hex colours in color-function-notation #5650

Merged
merged 6 commits into from Oct 28, 2021

Conversation

lachieh
Copy link
Contributor

@lachieh lachieh commented Oct 25, 2021

Resolves #5638

  • Added isStandardSyntaxColorFunction util and tests
  • Updated color-function-notation rule to use above function

Copy link
Member

@jeddy3 jeddy3 left a comment

Choose a reason for hiding this comment

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

Thanks! Looking good so far.

I've requested some minor changes and asked a query.

lib/utils/__tests__/isStandardSyntaxColorFunction.test.js Outdated Show resolved Hide resolved
lib/utils/__tests__/isStandardSyntaxColorFunction.test.js Outdated Show resolved Hide resolved
lib/utils/isStandardSyntaxColorFunction.js Outdated Show resolved Hide resolved
Copy link
Member

@ybiquitous ybiquitous left a comment

Choose a reason for hiding this comment

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

@lachieh Thanks for creating a nice PR! I've left trivial comments, but otherwise LGTM. 👍🏼

lib/utils/__tests__/isStandardSyntaxColorFunction.test.js Outdated Show resolved Hide resolved
lib/utils/isStandardSyntaxColorFunction.js Outdated Show resolved Hide resolved
lib/utils/isStandardSyntaxColorFunction.js Outdated Show resolved Hide resolved
Copy link
Member

@ybiquitous ybiquitous left a comment

Choose a reason for hiding this comment

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

Thank you! 👍🏼

Copy link
Member

@jeddy3 jeddy3 left a comment

Choose a reason for hiding this comment

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

Almost there, thanks.

I've made one final request.

lib/utils/isStandardSyntaxColorFunction.js Outdated Show resolved Hide resolved
Copy link
Member

@jeddy3 jeddy3 left a comment

Choose a reason for hiding this comment

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

Thank you, LGTM.

Will wait on @ybiquitous approval of those latest changes before merging.

Copy link
Member

@ybiquitous ybiquitous left a comment

Choose a reason for hiding this comment

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

Nice! LGTM 👍🏼

@jeddy3 jeddy3 merged commit b8a8d99 into stylelint:main Oct 28, 2021
@jeddy3
Copy link
Member

jeddy3 commented Oct 28, 2021

  • Fixed: color-function-notation false positives for hex colours (#5650).


// scss rgba() function can accept a hex as the first param
for (const fnNode of node.nodes) {
if (fnNode.type === 'word' && fnNode.value.startsWith('#')) return false;
Copy link

@kamechb kamechb Dec 16, 2021

Choose a reason for hiding this comment

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

I use a color variable like $black in the function, do we handle that case? In that case, it still reports an error which is not expected.
image

Copy link
Member

Choose a reason for hiding this comment

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

@kamechb See #5671.

That issue is labelled as ready to implement. Please consider contributing if you have time.

There are steps on how to fix a bug in a rule in the Developer guide.

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

Successfully merging this pull request may close these issues.

Fix false positives for hex colours in color-function-notation
4 participants