Skip to content

Commit

Permalink
fix token extraction
Browse files Browse the repository at this point in the history
  • Loading branch information
anubra266 committed Nov 26, 2024
1 parent 9b43b55 commit ea9b523
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/cool-waves-enjoy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@pandacss/eslint-plugin': patch
---

Fix token extraction
2 changes: 1 addition & 1 deletion plugin/src/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ export const isColorToken = (value: string | undefined, context: RuleContext<any
const invalidTokensCache = new Map<string, string[]>()

export const extractTokens = (value: string) => {
const regex = /token\(([^"'(),]+)(?:,\s*([^"'(),]+))?\)|\{([^{}]+)\}/g
const regex = /token\(([^"'(),]+)(?:,\s*([^"'(),]+))?\)|\{([^{\r\n}]+)\}/g
const matches = []
let match

Expand Down
5 changes: 5 additions & 0 deletions plugin/tests/_parsing.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,11 @@ const valids5 = [
'const className = css`\n font-size: {fontSizes.md};`',
'const className = styled.h1`\n font-size: {fontSizes.md};`',
'const className = styled(Circle)`\n font-size: {fontSizes.md};`',
`const className = css\`\n
@media (min-width: token(breakpoints.lg)) {
grid-template-columns: auto 450px;
}
\``,
]

const invalids5 = [
Expand Down

0 comments on commit ea9b523

Please sign in to comment.