-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix a bug: css urls are incorrectly stripped of commas #14476
Merged
fisker
merged 24 commits into
prettier:main
from
seiyab:14237-css-urls-are-incorrectly-stripped-of-commas-2
Mar 29, 2023
Merged
Changes from 12 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
44ca4fc
test for #14237 "@font-face urls are incorrectly stripped of commas"
seiyab dda6511
fix #14237
seiyab 4a92d92
update snapshot for #14237
seiyab 3f86644
add changelog
seiyab 5e96943
fix typo in changelog
seiyab 3e31769
Update changelog_unreleased/css/14476.md
seiyab 0f60624
add test for broken edge case
seiyab 3dccc3e
fix some edge cases
seiyab 2ca6512
Add edge cases
seiyab 2977c89
add trailing triple backquotes into changelog
seiyab 2fcf543
prevent AST change false positive
seiyab 4d4d2a6
change approach
seiyab dd9158b
Minor refactor
fisker aaf0417
Rename
fisker d76003f
Simplify
fisker 234fe6c
Rename function
fisker 4186594
Test space
fisker b5fa585
More test
fisker aa52707
Rename functions
fisker b7751a8
Fix path
fisker d0b816e
Fix
fisker 3579c7e
Merge remote-tracking branch 'origin/main' into 14237-css-urls-are-in…
seiyab 4935c44
revert line unexpectedly written by editor
seiyab ff86851
Update 14476.md
fisker File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#### Fix a bug that incorrectly strips of commas in some cases (#14476 by @seiyab) | ||
|
||
<!-- prettier-ignore --> | ||
```css | ||
/* Input */ | ||
@font-face { | ||
src: url(RobotoFlex-VariableFont_GRAD,XTRA,YOPQ,YTAS,YTDE,YTFI,YTLC,YTUC,opsz,slnt,wdth,wght.ttf); | ||
} | ||
|
||
/* Prettier stable */ | ||
@font-face { | ||
src: url(RobotoFlex-VariableFont_GRADXTRAYOPQYTASYTDEYTFIYTLCYTUCopszslntwdthwght.ttf); | ||
} | ||
|
||
/* Prettier main */ | ||
@font-face { | ||
src: url(RobotoFlex-VariableFont_GRAD,XTRA,YOPQ,YTAS,YTDE,YTFI,YTLC,YTUC,opsz,slnt,wdth,wght.ttf); | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
"use strict"; | ||
|
||
const getHighestAncestor = (node) => { | ||
while (node.parent) { | ||
node = node.parent; | ||
} | ||
return node; | ||
}; | ||
|
||
module.exports = getHighestAncestor; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
"use strict"; | ||
|
||
const getHighestAncestor = require("./get-highest-ancestor.js"); | ||
|
||
/** | ||
* @param {*} node | ||
* @returns {string} | ||
*/ | ||
function stringifyFuncParam(node) { | ||
const text = getHighestAncestor(node).text.slice( | ||
node.group.open.sourceIndex + 1, | ||
node.group.close.sourceIndex | ||
); | ||
const innerText = text.trim(); | ||
return innerText; | ||
} | ||
|
||
module.exports = stringifyFuncParam; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can also use this here.
prettier/src/language-css/parser-postcss.js
Line 54 in 4d4d2a6
I'll change it if you want.