diff --git a/.github/no-response.yml b/.github/no-response.yml deleted file mode 100644 index c60869464..000000000 --- a/.github/no-response.yml +++ /dev/null @@ -1,10 +0,0 @@ -# Configuration for probot-no-response - https://github.com/probot/no-response - -daysUntilClose: 14 -responseRequiredLabel: "status:awaiting response" -closeComment: > - This issue has been automatically closed because there has been no response - to our request for more information from the original author. With only the - information that is currently in the issue, we don't have enough information - to take action. Please reach out if you have or find the answers we need so - that we can investigate further. diff --git a/.github/workflows/bundler-friendly.yml b/.github/workflows/bundler-friendly.yml index 223426438..7bb56c140 100644 --- a/.github/workflows/bundler-friendly.yml +++ b/.github/workflows/bundler-friendly.yml @@ -2,8 +2,8 @@ name: Bundler_Friendly on: schedule: - # “At 00:00 on Sunday.” https://crontab.guru/#0%C2%A00%C2%A0*%C2%A0*%C2%A00 - - cron: "0 0 * * 0" + # “At 00:00 on Sunday.” https://crontab.guru/#0_0_*_*_SUN + - cron: "0 0 * * SUN" pull_request: paths: - "scripts/tools/bundle-test/**" diff --git a/.github/workflows/dev-package-test.yml b/.github/workflows/dev-package-test.yml index 52dce193e..fd993cfc0 100644 --- a/.github/workflows/dev-package-test.yml +++ b/.github/workflows/dev-package-test.yml @@ -2,8 +2,8 @@ name: Dev_Package_Test on: schedule: - # “At 00:00 on Sunday.” https://crontab.guru/#0%C2%A00%C2%A0*%C2%A0*%C2%A00 - - cron: "0 0 * * 0" + # “At 00:00 on Sunday.” https://crontab.guru/#0_0_*_*_SUN + - cron: "0 0 * * SUN" pull_request: paths: - "package.json" diff --git a/.github/workflows/lock.yml b/.github/workflows/lock.yml index a51e3df9e..029e7132b 100644 --- a/.github/workflows/lock.yml +++ b/.github/workflows/lock.yml @@ -2,6 +2,7 @@ name: "Lock" on: schedule: + # “At 00:00.” https://crontab.guru/#0_0_*_*_* - cron: "0 0 * * *" permissions: diff --git a/.github/workflows/no-response.yml b/.github/workflows/no-response.yml new file mode 100644 index 000000000..5981ff4b7 --- /dev/null +++ b/.github/workflows/no-response.yml @@ -0,0 +1,30 @@ +name: No Response + +# Both `issue_comment` and `scheduled` event types are required for this Action +# to work properly. +on: + issue_comment: + types: + - created + schedule: + # “At minute 0.” https://crontab.guru/#0_*_*_*_* + - cron: "0 * * * *" + +permissions: + issues: write + +jobs: + no-response: + runs-on: ubuntu-latest + steps: + - uses: lee-dohm/no-response@v0.5.0 + with: + token: ${{ github.token }} + daysUntilClose: 14 + responseRequiredLabel: "status:awaiting response" + closeComment: > + This issue has been automatically closed because there has been no response + to our request for more information from the original author. With only the + information that is currently in the issue, we don't have enough information + to take action. Please reach out if you have or find the answers we need so + that we can investigate further. diff --git a/changelog_unreleased/scss/9184.md b/changelog_unreleased/scss/9184.md new file mode 100644 index 000000000..de3cace7d --- /dev/null +++ b/changelog_unreleased/scss/9184.md @@ -0,0 +1,35 @@ +#### Fix SCSS map in arguments (#9184 by @agamkrbit) + + +```scss +// Input +$display-breakpoints: map-deep-merge( + ( + "print-only": "only print", + "screen-only": "only screen", + "xs-only": "only screen and (max-width: #{map-get($grid-breakpoints, "sm")-1})", + ), + $display-breakpoints +); + +// Prettier stable +$display-breakpoints: map-deep-merge( + ( + "print-only": "only print", + "screen-only": "only screen", + "xs-only": "only screen and (max-width: #{map-get($grid-breakpoints, " sm + ")-1})", + ), + $display-breakpoints +); + +// Prettier main +$display-breakpoints: map-deep-merge( + ( + "print-only": "only print", + "screen-only": "only screen", + "xs-only": "only screen and (max-width: #{map-get($grid-breakpoints, "sm")-1})", + ), + $display-breakpoints +); +``` diff --git a/netlify.toml b/netlify.toml index b43779137..15b1cdfe0 100644 --- a/netlify.toml +++ b/netlify.toml @@ -3,7 +3,7 @@ [build.environment] NODE_VERSION = "lts/*" - YARN_VERSION = "1.22.18" + YARN_VERSION = "1.22.19" [[headers]] for = "/worker.js" diff --git a/src/language-css/parser-postcss.js b/src/language-css/parser-postcss.js index 6fbfc2da0..88c9eb583 100644 --- a/src/language-css/parser-postcss.js +++ b/src/language-css/parser-postcss.js @@ -118,6 +118,23 @@ async function parseValueNode(valueNode, options) { parenGroupStack.pop(); parenGroup = parenGroupStack.at(-1); } else if (node.type === "comma") { + if (commaGroup.groups.length > 1) { + for (const group of commaGroup.groups) { + // if css interpolation + if ( + group.value && + typeof group.value === "string" && + group.value.includes("#{") + ) { + commaGroup.groups = [ + stringifyNode({ + groups: commaGroup.groups, + }).trim(), + ]; + break; + } + } + } parenGroup.groups.push(commaGroup); commaGroup = { groups: [], diff --git a/tests/format/js/comments/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/comments/__snapshots__/jsfmt.spec.js.snap index 13d0cc272..e7491a0dc 100644 --- a/tests/format/js/comments/__snapshots__/jsfmt.spec.js.snap +++ b/tests/format/js/comments/__snapshots__/jsfmt.spec.js.snap @@ -4030,6 +4030,55 @@ y; ================================================================================ `; +exports[`multi-comments-2.js - {"semi":false} format 1`] = ` +====================================options===================================== +parsers: ["babel", "flow", "typescript"] +printWidth: 80 +semi: false + | printWidth +=====================================input====================================== + const x = 0; + + /* istanbul ignore if */ // debug case currently not triggered + if (true) { + x; + } + +=====================================output===================================== +const x = 0 + +/* istanbul ignore if */ // debug case currently not triggered +if (true) { + x +} + +================================================================================ +`; + +exports[`multi-comments-2.js format 1`] = ` +====================================options===================================== +parsers: ["babel", "flow", "typescript"] +printWidth: 80 + | printWidth +=====================================input====================================== + const x = 0; + + /* istanbul ignore if */ // debug case currently not triggered + if (true) { + x; + } + +=====================================output===================================== +const x = 0; + +/* istanbul ignore if */ // debug case currently not triggered +if (true) { + x; +} + +================================================================================ +`; + exports[`multi-comments-on-same-line.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] diff --git a/tests/format/js/comments/multi-comments-2.js b/tests/format/js/comments/multi-comments-2.js new file mode 100644 index 000000000..a6e34e549 --- /dev/null +++ b/tests/format/js/comments/multi-comments-2.js @@ -0,0 +1,6 @@ + const x = 0; + + /* istanbul ignore if */ // debug case currently not triggered + if (true) { + x; + } diff --git a/tests/format/scss/map/function-argument/__snapshots__/jsfmt.spec.js.snap b/tests/format/scss/map/function-argument/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..0ea75e6bb --- /dev/null +++ b/tests/format/scss/map/function-argument/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,146 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`functional-argument.scss format 1`] = ` +====================================options===================================== +parsers: ["scss"] +printWidth: 80 + | printWidth +=====================================input====================================== +//simple test +$display-breakpoints: map-deep-merge( + ( + "print-only": "only print", + "screen-only": "only screen", + "xs-only": "only screen and (max-width: #{map-get($grid-breakpoints, "sm") - 1})", + "sm-only": "only screen and (min-width: #{map-get($grid-breakpoints, "sm")}) and (max-width: #{map-get($grid-breakpoints, "md") - 1})", + ), + $display-breakpoints +); + + +//list test +@each +$size +in +$sizes { +.icon +#{$size} +{ +border +: +"#{$size + "px"}" +solid +red; +} +} + +@each +$size +in +$sizes { +.icon-#{$size} +{ +border +: +"#{$size + "px"}" +solid +red; +} +} + +//map test +$font-weights +: +("regular": 400 +, +"medium": 500, +"bold": +700); +@each +$name, +$boldness +in +$icons { +.text +#{ +$name +} { +color: red; +font-weight: +"#{$boldness}" +} +} + +$font-weights +: +("regular": 400 +, +"medium": 500, +"bold": +700); +@each +$name, +$boldness +in +$icons { +.text-#{ +$name +} { +color: red; +font-weight: +"#{$boldness}" +} +} + +=====================================output===================================== +//simple test +$display-breakpoints: map-deep-merge( + ( + "print-only": "only print", + "screen-only": "only screen", + "xs-only": "only screen and (max-width: #{map-get($grid-breakpoints, "sm") - 1})", + "sm-only": "only screen and (min-width: #{map-get($grid-breakpoints, "sm")}) and (max-width: #{map-get($grid-breakpoints, "md") - 1})", + ), + $display-breakpoints +); + +//list test +@each $size in $sizes { + .icon #{$size} { + border: "#{$size + "px"}" solid red; + } +} + +@each $size in $sizes { + .icon-#{$size} { + border: "#{$size + "px"}" solid red; + } +} + +//map test +$font-weights: ( + "regular": 400, + "medium": 500, + "bold": 700, +); +@each $name, $boldness in $icons { + .text #{ $name } { + color: red; + font-weight: "#{$boldness}"; + } +} + +$font-weights: ( + "regular": 400, + "medium": 500, + "bold": 700, +); +@each $name, $boldness in $icons { + .text-#{ $name } { + color: red; + font-weight: "#{$boldness}"; + } +} + +================================================================================ +`; diff --git a/tests/format/scss/map/function-argument/functional-argument.scss b/tests/format/scss/map/function-argument/functional-argument.scss new file mode 100644 index 000000000..150afc22e --- /dev/null +++ b/tests/format/scss/map/function-argument/functional-argument.scss @@ -0,0 +1,85 @@ +//simple test +$display-breakpoints: map-deep-merge( + ( + "print-only": "only print", + "screen-only": "only screen", + "xs-only": "only screen and (max-width: #{map-get($grid-breakpoints, "sm") - 1})", + "sm-only": "only screen and (min-width: #{map-get($grid-breakpoints, "sm")}) and (max-width: #{map-get($grid-breakpoints, "md") - 1})", + ), + $display-breakpoints +); + + +//list test +@each +$size +in +$sizes { +.icon +#{$size} +{ +border +: +"#{$size + "px"}" +solid +red; +} +} + +@each +$size +in +$sizes { +.icon-#{$size} +{ +border +: +"#{$size + "px"}" +solid +red; +} +} + +//map test +$font-weights +: +("regular": 400 +, +"medium": 500, +"bold": +700); +@each +$name, +$boldness +in +$icons { +.text +#{ +$name +} { +color: red; +font-weight: +"#{$boldness}" +} +} + +$font-weights +: +("regular": 400 +, +"medium": 500, +"bold": +700); +@each +$name, +$boldness +in +$icons { +.text-#{ +$name +} { +color: red; +font-weight: +"#{$boldness}" +} +} diff --git a/tests/format/scss/map/function-argument/jsfmt.spec.js b/tests/format/scss/map/function-argument/jsfmt.spec.js new file mode 100644 index 000000000..e966f39c5 --- /dev/null +++ b/tests/format/scss/map/function-argument/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(import.meta, ["scss"]); diff --git a/website/playground/Playground.js b/website/playground/Playground.js index 5a8132dcd..c328496e0 100644 --- a/website/playground/Playground.js +++ b/website/playground/Playground.js @@ -48,6 +48,7 @@ const ENABLED_OPTIONS = [ "vueIndentScriptAndStyle", "embeddedLanguageFormatting", "bracketSameLine", + "singleAttributePerLine", ]; class Playground extends React.Component {