Skip to content

ensure that media params remain string values#558

Merged
RyanZim merged 2 commits intomasterfrom
fix-557--intuitive-akita-caa1b56c5d
Feb 12, 2024
Merged

ensure that media params remain string values#558
RyanZim merged 2 commits intomasterfrom
fix-557--intuitive-akita-caa1b56c5d

Conversation

@romainmenke
Copy link
Copy Markdown
Collaborator

fixes : #557

Comment on lines -9 to -21
function split(params, start) {
const list = []
const last = params.reduce((item, node, index) => {
if (index < start) return ""
if (node.type === "div" && node.value === ",") {
list.push(item)
return ""
}
return item + stringify(node)
}, "")
list.push(last)
return list
}
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I overlooked that this was still present and JavaScript automatically joins arrays of strings with ,.

This entire section has become redundant with the refactors for v16.

Copy link
Copy Markdown
Collaborator

@RyanZim RyanZim left a comment

Choose a reason for hiding this comment

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

Code looks good; should we add a test case with the reproduction from #557?

@romainmenke romainmenke force-pushed the fix-557--intuitive-akita-caa1b56c5d branch from 62dae71 to 2d1301c Compare February 10, 2024 23:40
@romainmenke
Copy link
Copy Markdown
Collaborator Author

Thank you for reviewing @RyanZim 🙇

I've added a separate plugin that always runs after postcss-import and checks the types of all AtRule AST nodes. This way we get maximum coverage for this aspect as it runs with each test case.

It tests a few more things than just atrule.params, just in case.

@RyanZim RyanZim merged commit ba92913 into master Feb 12, 2024
@RyanZim RyanZim deleted the fix-557--intuitive-akita-caa1b56c5d branch February 12, 2024 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Emitted @media AtRules are invalid

2 participants