diff --git a/.changeset/cool-waves-enjoy.md b/.changeset/cool-waves-enjoy.md new file mode 100644 index 0000000..20312dd --- /dev/null +++ b/.changeset/cool-waves-enjoy.md @@ -0,0 +1,5 @@ +--- +'@pandacss/eslint-plugin': patch +--- + +Fix token extraction diff --git a/plugin/src/utils/helpers.ts b/plugin/src/utils/helpers.ts index 2f4104a..62232f9 100644 --- a/plugin/src/utils/helpers.ts +++ b/plugin/src/utils/helpers.ts @@ -248,7 +248,7 @@ export const isColorToken = (value: string | undefined, context: RuleContext() export const extractTokens = (value: string) => { - const regex = /token\(([^"'(),]+)(?:,\s*([^"'(),]+))?\)|\{([^{}]+)\}/g + const regex = /token\(([^"'(),]+)(?:,\s*([^"'(),]+))?\)|\{([^{\r\n}]+)\}/g const matches = [] let match diff --git a/plugin/tests/_parsing.test.ts b/plugin/tests/_parsing.test.ts index 9bf5525..581a43d 100644 --- a/plugin/tests/_parsing.test.ts +++ b/plugin/tests/_parsing.test.ts @@ -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 = [