diff --git a/.github/ISSUE_TEMPLATE/formatting.md b/.github/ISSUE_TEMPLATE/formatting.md index eeb25ffd0a28..1c493aa7ce92 100644 --- a/.github/ISSUE_TEMPLATE/formatting.md +++ b/.github/ISSUE_TEMPLATE/formatting.md @@ -26,7 +26,7 @@ Don't fill the form below manually! Let a program create a report for you: --> -**Prettier 3.8.2** +**Prettier 3.8.3** [Playground link](https://prettier.io/playground/#.....) ```sh diff --git a/.github/ISSUE_TEMPLATE/integration.md b/.github/ISSUE_TEMPLATE/integration.md index 84a3febc525d..85dd18b63e99 100644 --- a/.github/ISSUE_TEMPLATE/integration.md +++ b/.github/ISSUE_TEMPLATE/integration.md @@ -20,7 +20,7 @@ BEFORE SUBMITTING AN ISSUE: **Environments:** -- Prettier Version: 3.8.2 +- Prettier Version: 3.8.3 - Running Prettier via: - Runtime: - Operating System: diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ccd6026fa68..f73d9d1fa2ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,23 @@ +# 3.8.3 + +[diff](https://github.com/prettier/prettier/compare/3.8.2...3.8.3) + +#### SCSS: Prevent trailing comma in `if()` function ([#18471](https://github.com/prettier/prettier/pull/18471) by [@kovsu](https://github.com/kovsu)) + + +```scss +// Input +$value: if(sass(false): 1; else: -1); + +// Prettier 3.8.2 +$value: if( + sass(false): 1; else: -1, +); + +// Prettier 3.8.3 +$value: if(sass(false): 1; else: -1); +``` + # 3.8.2 [diff](https://github.com/prettier/prettier/compare/3.8.1...3.8.2) diff --git a/changelog_unreleased/angular/18722.md b/changelog_unreleased/angular/18722.md deleted file mode 100644 index 61e69535e885..000000000000 --- a/changelog_unreleased/angular/18722.md +++ /dev/null @@ -1,41 +0,0 @@ -#### Support Angular v21.2 (#18722, #19034 by @fisker) - -Exhaustive typechecking with `@default never;` - - -```html - -@switch (foo) { - @case (1) {} - @default never; -} - - -SyntaxError: Incomplete block "default never". If you meant to write the @ character, you should use the "@" HTML entity instead. (3:3) - - -@switch (foo) { - @case (1) {} - @default never; -} -``` - -`arrow function` and `instanceof` expressions. - - -```html - -@let fn = (a) => a? 1:2; - -{{ fn ( a instanceof b)}} - - -@let fn = (a) => a? 1:2; - -{{ fn ( a instanceof b)}} - - -@let fn = (a) => (a ? 1 : 2); - -{{ fn(a instanceof b) }} -``` diff --git a/changelog_unreleased/scss/18471.md b/changelog_unreleased/scss/18471.md new file mode 100644 index 000000000000..f4ff3d42c9d5 --- /dev/null +++ b/changelog_unreleased/scss/18471.md @@ -0,0 +1,15 @@ +#### Prevent trailing comma in `if()` function (#18471 by @kovsu) + + +```scss +// Input +$value: if(sass(false): 1; else: -1); + +// Prettier stable +$value: if( + sass(false): 1; else: -1, +); + +// Prettier main +$value: if(sass(false): 1; else: -1); +``` diff --git a/package.json b/package.json index 8529cd77f001..77598680199e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "prettier", - "version": "3.8.2", + "version": "3.8.3", "description": "Prettier is an opinionated code formatter", "bin": "./bin/prettier.cjs", "repository": "prettier/prettier", @@ -93,7 +93,7 @@ "minimist": "1.2.8", "n-readlines": "1.0.1", "outdent": "0.8.0", - "oxc-parser": "0.99.0", + "oxc-parser": "0.125.0", "parse-json": "8.3.0", "picocolors": "1.1.1", "please-upgrade-node": "3.2.0", @@ -165,7 +165,7 @@ "node-style-text": "2.1.2", "npm-run-all2": "8.0.4", "open-editor": "6.0.0", - "prettier": "3.8.1", + "prettier": "3.8.2", "pretty-bytes": "7.1.0", "pretty-ms": "9.3.0", "rollup-plugin-license": "3.6.0", diff --git a/packages/plugin-oxc/package.json b/packages/plugin-oxc/package.json index fa754d4b50f2..9f437f38376e 100644 --- a/packages/plugin-oxc/package.json +++ b/packages/plugin-oxc/package.json @@ -1,6 +1,6 @@ { "name": "@prettier/plugin-oxc", - "version": "0.1.3", + "version": "0.1.4", "description": "Prettier Oxc plugin.", "type": "module", "exports": { diff --git a/src/language-css/utilities/index.js b/src/language-css/utilities/index.js index b2354bdca6fb..6477cb24a3b9 100644 --- a/src/language-css/utilities/index.js +++ b/src/language-css/utilities/index.js @@ -261,6 +261,18 @@ function isSCSSMapItemNode(path, options) { return false; } + const parentNode = path.parent; + + // Don't treat SCSS if function arguments as maps (`if(sass(condition): value; else: value)`) + // https://sass-lang.com/documentation/breaking-changes/if-function/ + if ( + parentNode && + parentNode.type === "value-func" && + parentNode.value === "if" + ) { + return false; + } + const parentParentNode = path.grandparent; // Check open parens contain key/value pair (i.e. `(key: value)` and `(key: (value, other-value)`) diff --git a/tests/format/angular/expression/__snapshots__/format.test.js.snap b/tests/format/angular/expression/__snapshots__/format.test.js.snap index 4dabdf06424d..ec6f2d953a6b 100644 --- a/tests/format/angular/expression/__snapshots__/format.test.js.snap +++ b/tests/format/angular/expression/__snapshots__/format.test.js.snap @@ -3,7 +3,8 @@ exports[`arrow-function.html format 1`] = ` ====================================options===================================== parsers: ["angular"] - printWidth: 80 (default) | +printWidth: 80 + | printWidth =====================================input====================================== @let fn = (a, b) => componentValue + a + b; One: {{fn(0, 1)}} @@ -94,7 +95,8 @@ printWidth: 80 exports[`instanceof-operator.html format 1`] = ` ====================================options===================================== parsers: ["angular"] - printWidth: 80 (default) | +printWidth: 80 + | printWidth =====================================input====================================== {{ diff --git a/tests/format/angular/expression/arrow-function-options/__snapshots__/format.test.js.snap b/tests/format/angular/expression/arrow-function-options/__snapshots__/format.test.js.snap index 71cf5f605c0d..62bf880b8721 100644 --- a/tests/format/angular/expression/arrow-function-options/__snapshots__/format.test.js.snap +++ b/tests/format/angular/expression/arrow-function-options/__snapshots__/format.test.js.snap @@ -4,7 +4,8 @@ exports[`snippet: #0 - {"arrowParens":"avoid"} format 1`] = ` ====================================options===================================== arrowParens: "avoid" parsers: ["angular"] - printWidth: 80 (default) | +printWidth: 80 + | printWidth =====================================input====================================== @let fn = ( oneArgument) => 1; =====================================output===================================== @@ -18,7 +19,7 @@ exports[`snippet: #0 - {"printWidth":1,"trailingComma":"all"} format 1`] = ` parsers: ["angular"] printWidth: 1 trailingComma: "all" - | printWidth: 1 + | printWidth =====================================input====================================== @let fn = ( should, not, print,trailing, comma) => 1; =====================================output===================================== @@ -39,7 +40,8 @@ exports[`snippet: #1 - {"arrowParens":"avoid"} format 1`] = ` ====================================options===================================== arrowParens: "avoid" parsers: ["angular"] - printWidth: 80 (default) | +printWidth: 80 + | printWidth =====================================input====================================== @let fn = oneArgument => 1; =====================================output===================================== diff --git a/tests/format/scss/function/18465.scss b/tests/format/scss/function/18465.scss new file mode 100644 index 000000000000..426305a74e31 --- /dev/null +++ b/tests/format/scss/function/18465.scss @@ -0,0 +1 @@ +$value: if(sass(false): 1; else: -1); diff --git a/tests/format/scss/function/__snapshots__/format.test.js.snap b/tests/format/scss/function/__snapshots__/format.test.js.snap index 78c6b2c6b074..381e9685f0fe 100644 --- a/tests/format/scss/function/__snapshots__/format.test.js.snap +++ b/tests/format/scss/function/__snapshots__/format.test.js.snap @@ -210,6 +210,36 @@ div { ================================================================================ `; +exports[`18465.scss - {"trailingComma":"es5"} format 1`] = ` +====================================options===================================== +parsers: ["scss"] +printWidth: 80 +trailingComma: "es5" + | printWidth +=====================================input====================================== +$value: if(sass(false): 1; else: -1); + +=====================================output===================================== +$value: if(sass(false): 1; else: -1); + +================================================================================ +`; + +exports[`18465.scss - {"trailingComma":"none"} format 1`] = ` +====================================options===================================== +parsers: ["scss"] +printWidth: 80 +trailingComma: "none" + | printWidth +=====================================input====================================== +$value: if(sass(false): 1; else: -1); + +=====================================output===================================== +$value: if(sass(false): 1; else: -1); + +================================================================================ +`; + exports[`arbitrary-arguments.scss - {"trailingComma":"es5"} format 1`] = ` ====================================options===================================== parsers: ["scss"] diff --git a/website/src/pages/index.jsx b/website/src/pages/index.jsx index bc52848a7d3b..006fc28fa4ba 100644 --- a/website/src/pages/index.jsx +++ b/website/src/pages/index.jsx @@ -331,7 +331,7 @@ function UsersSection() {

More than{" "} - 9.9 million{" "} + 10 million{" "} dependent repositories on GitHub

- + +