Skip to content
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

Merged
merged 2 commits into from Apr 2, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/language-css/utils.js
Expand Up @@ -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|,)/;
Copy link
Sponsor Member Author

Choose a reason for hiding this comment

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

Should it be *?

Copy link
Member

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

Copy link
Sponsor Member Author

@fisker fisker Apr 2, 2020

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...

return hasExplicitParserChoice
? parser === "scss"
: IS_POSSIBLY_SCSS.test(text);
Expand Down
1 change: 0 additions & 1 deletion tests_config/run_spec.js
Expand Up @@ -28,7 +28,6 @@ const unstableTests = new Map(
"comments/return-statement.js",
"comments/tagged-template-literal.js",
"comments_closure_typecast/iife.js",
"css_atrule/include.css",
"graphql_interface/separator-detection.graphql",
[
"html_angular/attributes.component.html",
Expand Down