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

Consistently quote Sass modules strings #11461

Merged
merged 6 commits into from Sep 9, 2021

Conversation

niksy
Copy link
Contributor

@niksy niksy commented Sep 7, 2021

Fixes #11053.

Description

Checklist

  • I’ve added tests to confirm my change works.
  • (If changing the API or CLI) I’ve documented the changes I’ve made (in the docs/ directory).
  • (If the change is user-facing) I’ve added my changes to changelog_unreleased/*/XXXX.md file following changelog_unreleased/TEMPLATE.md.
  • I’ve read the contributing guidelines.

Try the playground for this PR

Copy link
Member

@sosukesuzuki sosukesuzuki left a comment

Choose a reason for hiding this comment

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

Thank you for PR! Please check one comment

@@ -525,7 +525,7 @@ function parseNestedCSS(node, options) {
return node;
}

if (lowercasedName === "import") {
if (["import", "use", "forward"].includes(lowercasedName)) {
Copy link
Member

Choose a reason for hiding this comment

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

Could you define a new function as following:

const moduleRuleNames = new Set(["import", "use", "forward"]);
function isModuleRuleName(name) {
  return moduleRuleNames.has(name);
}

And replace this to

if (isModuleRuleName(lowercasedName)) {

?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

@@ -0,0 +1,2 @@
@use "module";
@forward "module";
Copy link
Member

Choose a reason for hiding this comment

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

We need more tests here, because we use parser here and it can break output, please add:

@use 'library' with (
  $black: #222,
  $border-radius: 0.1rem
);

ideally even more

Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

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

Need more tests

@niksy
Copy link
Contributor Author

niksy commented Sep 8, 2021

@alexander-akait I’ve added more use cases in tests.

Copy link
Member

@sosukesuzuki sosukesuzuki left a comment

Choose a reason for hiding this comment

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

CI failed but no related to this PR. When we fixed CI, we'll merge this.

@sosukesuzuki sosukesuzuki merged commit 1c4da1e into prettier:main Sep 9, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SCSS @use strings not quoted consistently
3 participants