Skip to content

Commit 9cd3af4

Browse files
authored
fix token extraction (#188)
2 parents ce87d65 + ea9b523 commit 9cd3af4

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

.changeset/cool-waves-enjoy.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@pandacss/eslint-plugin': patch
3+
---
4+
5+
Fix token extraction

plugin/src/utils/helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ export const isColorToken = (value: string | undefined, context: RuleContext<any
248248
const invalidTokensCache = new Map<string, string[]>()
249249

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

plugin/tests/_parsing.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,11 @@ const valids5 = [
178178
'const className = css`\n font-size: {fontSizes.md};`',
179179
'const className = styled.h1`\n font-size: {fontSizes.md};`',
180180
'const className = styled(Circle)`\n font-size: {fontSizes.md};`',
181+
`const className = css\`\n
182+
@media (min-width: token(breakpoints.lg)) {
183+
grid-template-columns: auto 450px;
184+
}
185+
\``,
181186
]
182187

183188
const invalids5 = [

0 commit comments

Comments
 (0)