-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Update isSCSS
test regex
#7922
Update isSCSS
test regex
#7922
Conversation
src/language-css/utils.js
Outdated
@@ -60,7 +60,7 @@ function getPropOfDeclNode(path) { | |||
|
|||
function isSCSS(parser, text) { | |||
const hasExplicitParserChoice = parser === "less" || parser === "scss"; | |||
const IS_POSSIBLY_SCSS = /(\w\s*: [^}:]+|#){|@import[^\n]+(url|,)/; | |||
const IS_POSSIBLY_SCSS = /(\w\s*: ?[^}:]+|#){|@import[^\n]+(url|,)/; |
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.
Should it be *
?
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.
I can't understand regexp too 😄 , I think we should rewrite it, on looking extension
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.
You mean file extension? File extension is not always available, maybe check actual parser (not options.parser)?
This function is also used to decided parser...
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.
I think we should avoid using regex to choice of parser, it most likely doesn't even work correctly
Let's keep it this way to make test pass, we won't need it anymore after #7933 |
Fix
css_atrule/include.css
second format.I don't really understand this regex, but space after
:
should be optional.It's added in https://github.com/prettier/prettier/pull/4317/files#diff-29bcb0b461c4ae51930e975e53edfdd9L481
✨Try the playground for this PR✨