Skip to content

Ensure -- is allowed inside candidates#16972

Merged
RobinMalfait merged 3 commits intomainfrom
fix/candidates-with-double-dashes
Mar 5, 2025
Merged

Ensure -- is allowed inside candidates#16972
RobinMalfait merged 3 commits intomainfrom
fix/candidates-with-double-dashes

Conversation

@RobinMalfait
Copy link
Member

This PR fixes an issue where named utilities that contain double dashes -- are not extracted correctly.

Some people use -- in the middle of the utility to create some form of namespaced utility.

Given this input:

let x = 'foo--bar'

The extracted candidates before this change:

[ "let", "x", "--bar" ]

The extracted candidates after this change:

[ "let", "x", "foo--bar", "--bar" ]

The reason --bar is still extracted in both cases is because of the CSS variable machine. We could improve its extraction by checking its boundary characters but that's a different issue.

For now, the important thing is that foo--bar was extracted.

Test plan

  1. Added new test
  2. Existing tests pass
Some people using `--` inside of a utility name to give it some sort of namespace. This allows you to write `foo--bar`.
@RobinMalfait RobinMalfait requested a review from a team as a code owner March 5, 2025 21:20
@RobinMalfait RobinMalfait force-pushed the fix/candidates-with-double-dashes branch from 75639f6 to 992273c Compare March 5, 2025 21:22
@RobinMalfait RobinMalfait merged commit 9c59b07 into main Mar 5, 2025
5 checks passed
@RobinMalfait RobinMalfait deleted the fix/candidates-with-double-dashes branch March 5, 2025 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants