Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: prettier/prettier
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 3.2.3
Choose a base ref
...
head repository: prettier/prettier
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 3.2.4
Choose a head ref
  • 8 commits
  • 18 files changed
  • 1 contributor

Commits on Jan 17, 2024

  1. Update dependents count

    fisker committed Jan 17, 2024
    Copy the full SHA
    38c0d21 View commit details
  2. Copy the full SHA
    4985be5 View commit details
  3. Git blame ignore 3.2.3

    fisker committed Jan 17, 2024
    Copy the full SHA
    c12e3c6 View commit details
  4. Clean changelog_unreleased

    fisker committed Jan 17, 2024
    Copy the full SHA
    dda00cd View commit details
  5. Fix lock file

    fisker committed Jan 17, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    75ec1f7 View commit details
  6. Spellcheck

    fisker committed Jan 17, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    6c6a332 View commit details
  7. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    1cd4d9c View commit details
  8. Release 3.2.4

    fisker committed Jan 17, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    03822f5 View commit details
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -5,6 +5,8 @@
# See https://git-scm.com/docs/git-blame#Documentation/git-blame.txt---ignore-revs-fileltfilegt

# Prettier bump after release
# 3.2.3
4985be553e911fef7d83f3341eb143c443473c58
# 3.2.2
afc0a6b5fae11c86c18bbc345775821607d4d41d
# 3.2.1
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/formatting.md
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ Don't fill the form below manually! Let a program create a report for you:
-->

**Prettier 3.2.3**
**Prettier 3.2.4**
[Playground link](https://prettier.io/playground/#.....)

```sh
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/integration.md
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ BEFORE SUBMITTING AN ISSUE:

**Environments:**

- Prettier Version: 3.2.3
- Prettier Version: 3.2.4
- Running Prettier via: <!-- CLI, Node.js API, Browser API, etc. -->
- Runtime: <!-- Node.js v14, Chrome v83, etc. -->
- Operating System: <!-- Windows, Linux, macOS, etc. -->
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
# 3.2.4

[diff](https://github.com/prettier/prettier/compare/3.2.3...3.2.4)

#### Fix incorrect parser inference ([#15947](https://github.com/prettier/prettier/pull/15947) by [@fisker](https://github.com/fisker))

Files like `.eslintrc.json` were incorrectly formatted as JSONC files.

<!-- prettier-ignore -->
```jsx
// Input
prettier --file-info .eslintrc.json
{ "ignored": false, "inferredParser": "jsonc" }

// Prettier 3.2.4
prettier --file-info .eslintrc.json
{ "ignored": false, "inferredParser": "json" }
```

# 3.2.3

[diff](https://github.com/prettier/prettier/compare/3.2.2...3.2.3)
12 changes: 0 additions & 12 deletions changelog_unreleased/api/15927.md

This file was deleted.

14 changes: 14 additions & 0 deletions changelog_unreleased/json/15947.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#### Fix incorrect parser inference (#15947 by @fisker)

Files like `.eslintrc.json` were incorrectly formatted as JSONC files.

<!-- prettier-ignore -->
```jsx
// Input
prettier --file-info .eslintrc.json
{ "ignored": false, "inferredParser": "jsonc" }

// Prettier main
prettier --file-info .eslintrc.json
{ "ignored": false, "inferredParser": "json" }
```
30 changes: 0 additions & 30 deletions changelog_unreleased/typescript/15881.md

This file was deleted.

2 changes: 2 additions & 0 deletions cspell.json
Original file line number Diff line number Diff line change
@@ -156,6 +156,7 @@
"jscodeshift",
"jsesc",
"jsfmt",
"jslintrc",
"jsonata",
"judgements",
"kalmanb",
@@ -284,6 +285,7 @@
"softlines",
"Sorin",
"Sosuke",
"sosukesuzuki",
"Spampinato",
"speculationrules",
"srcset",
32 changes: 16 additions & 16 deletions docs/browser.md
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ Required options:

- **[`parser`](options.md#parser) (or [`filepath`](options.md#file-path))**: One of these options has to be specified for Prettier to know which parser to use.

- **`plugins`**: Unlike the `format` function from the [Node.js-based API](api.md#prettierformatsource--options), this function doesn’t load plugins automatically. The `plugins` option is required because all the parsers included in the Prettier package come as plugins (for reasons of file size). These plugins are files in <https://unpkg.com/browse/prettier@3.2.3/plugins/>. Note that `estree` plugin should be loaded when printing JavaScript, TypeScript, Flow, or JSON.
- **`plugins`**: Unlike the `format` function from the [Node.js-based API](api.md#prettierformatsource--options), this function doesn’t load plugins automatically. The `plugins` option is required because all the parsers included in the Prettier package come as plugins (for reasons of file size). These plugins are files in <https://unpkg.com/browse/prettier@3.2.4/plugins/>. Note that `estree` plugin should be loaded when printing JavaScript, TypeScript, Flow, or JSON.

You need to load the ones that you’re going to use and pass them to `prettier.format` using the `plugins` option.

@@ -29,8 +29,8 @@ See below for examples.
### Global

```html
<script src="https://unpkg.com/prettier@3.2.3/standalone.js"></script>
<script src="https://unpkg.com/prettier@3.2.3/plugins/graphql.js"></script>
<script src="https://unpkg.com/prettier@3.2.4/standalone.js"></script>
<script src="https://unpkg.com/prettier@3.2.4/plugins/graphql.js"></script>
<script>
(async () => {
const formatted = await prettier.format("type Query { hello: String }", {
@@ -47,8 +47,8 @@ Note that the [`unpkg` field](https://unpkg.com/#examples) in Prettier’s `pack

```html
<script type="module">
import * as prettier from "https://unpkg.com/prettier@3.2.3/standalone.mjs";
import prettierPluginGraphql from "https://unpkg.com/prettier@3.2.3/plugins/graphql.mjs";
import * as prettier from "https://unpkg.com/prettier@3.2.4/standalone.mjs";
import prettierPluginGraphql from "https://unpkg.com/prettier@3.2.4/plugins/graphql.mjs";
const formatted = await prettier.format("type Query { hello: String }", {
parser: "graphql",
@@ -61,8 +61,8 @@ Note that the [`unpkg` field](https://unpkg.com/#examples) in Prettier’s `pack

```js
define([
"https://unpkg.com/prettier@3.2.3/standalone.js",
"https://unpkg.com/prettier@3.2.3/plugins/graphql.js",
"https://unpkg.com/prettier@3.2.4/standalone.js",
"https://unpkg.com/prettier@3.2.4/plugins/graphql.js",
], async (prettier, ...plugins) => {
const formatted = await prettier.format("type Query { hello: String }", {
parser: "graphql",
@@ -90,8 +90,8 @@ This syntax doesn’t necessarily work in the browser, but it can be used when b
### Worker

```js
importScripts("https://unpkg.com/prettier@3.2.3/standalone.js");
importScripts("https://unpkg.com/prettier@3.2.3/plugins/graphql.js");
importScripts("https://unpkg.com/prettier@3.2.4/standalone.js");
importScripts("https://unpkg.com/prettier@3.2.4/plugins/graphql.js");

(async () => {
const formatted = await prettier.format("type Query { hello: String }", {
@@ -107,9 +107,9 @@ If you want to format [embedded code](options.md#embedded-language-formatting),

```html
<script type="module">
import * as prettier from "https://unpkg.com/prettier@3.2.3/standalone.mjs";
import prettierPluginBabel from "https://unpkg.com/prettier@3.2.3/plugins/babel.mjs";
import prettierPluginEstree from "https://unpkg.com/prettier@3.2.3/plugins/estree.mjs";
import * as prettier from "https://unpkg.com/prettier@3.2.4/standalone.mjs";
import prettierPluginBabel from "https://unpkg.com/prettier@3.2.4/plugins/babel.mjs";
import prettierPluginEstree from "https://unpkg.com/prettier@3.2.4/plugins/estree.mjs";
console.log(
await prettier.format("const html=/* HTML */ `<DIV> </DIV>`", {
@@ -125,10 +125,10 @@ The HTML code embedded in JavaScript stays unformatted because the `html` parser

```html
<script type="module">
import * as prettier from "https://unpkg.com/prettier@3.2.3/standalone.mjs";
import prettierPluginBabel from "https://unpkg.com/prettier@3.2.3/plugins/babel.mjs";
import prettierPluginEstree from "https://unpkg.com/prettier@3.2.3/plugins/estree.mjs";
import prettierPluginHtml from "https://unpkg.com/prettier@3.2.3/plugins/html.mjs";
import * as prettier from "https://unpkg.com/prettier@3.2.4/standalone.mjs";
import prettierPluginBabel from "https://unpkg.com/prettier@3.2.4/plugins/babel.mjs";
import prettierPluginEstree from "https://unpkg.com/prettier@3.2.4/plugins/estree.mjs";
import prettierPluginHtml from "https://unpkg.com/prettier@3.2.4/plugins/html.mjs";
console.log(
await prettier.format("const html=/* HTML */ `<DIV> </DIV>`", {
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "prettier",
"version": "3.2.3",
"version": "3.2.4",
"description": "Prettier is an opinionated code formatter",
"bin": "./bin/prettier.cjs",
"repository": "prettier/prettier",
@@ -147,7 +147,7 @@
"jest-watch-typeahead": "2.2.2",
"magic-string": "0.30.5",
"npm-run-all2": "6.1.1",
"prettier": "3.2.2",
"prettier": "3.2.3",
"pretty-bytes": "6.1.1",
"rollup-plugin-license": "3.2.0",
"semver": "7.5.4",
4 changes: 3 additions & 1 deletion scripts/release/steps/bump-prettier.js
Original file line number Diff line number Diff line change
@@ -47,7 +47,9 @@ export default async function bumpPrettier(params) {

await logPromise(
"Installing Prettier",
runYarn(["add", "--dev", `prettier@${version}`]),
// TODO: Remove this if `yarn up ...` works
// runYarn(["add", "--dev", `prettier@${version}`]),
runYarn(["up", `prettier@${version}`]),
);

await logPromise("Updating files", format());
16 changes: 16 additions & 0 deletions src/language-json/languages.evaluate.js
Original file line number Diff line number Diff line change
@@ -14,10 +14,26 @@ const languages = [
parsers: ["json"],
vscodeLanguageIds: ["json"],
extensions: data.extensions.filter((extension) => extension !== ".jsonl"),
filenames: [
...data.filenames,
".babelrc",
".jscsrc",
".jshintrc",
".jslintrc",
".swcrc",
],
})),
createLanguage(linguistLanguages["JSON with Comments"], () => ({
parsers: ["jsonc"],
vscodeLanguageIds: ["jsonc"],
// Too many filenames from `linguist-languages` are not a valid JSONC files.
// https://github.com/prettier/prettier/issues/15945#issuecomment-1895371835
filenames: [
"devcontainer.json",
"jsconfig.json",
"language-configuration.json",
"tsconfig.json",
],
})),
createLanguage(linguistLanguages.JSON5, () => ({
parsers: ["json5"],
18 changes: 7 additions & 11 deletions tests/integration/__tests__/__snapshots__/support-info.js.snap
Original file line number Diff line number Diff line change
@@ -488,7 +488,12 @@ exports[`CLI --support-info (stdout) 1`] = `
"Pipfile.lock",
"composer.lock",
"flake.lock",
"mcmod.info"
"mcmod.info",
".babelrc",
".jscsrc",
".jshintrc",
".jslintrc",
".swcrc"
],
"linguistLanguageId": 174,
"name": "JSON",
@@ -522,19 +527,10 @@ exports[`CLI --support-info (stdout) 1`] = `
".sublime_session"
],
"filenames": [
".babelrc",
".devcontainer.json",
".eslintrc.json",
".jscsrc",
".jshintrc",
".jslintrc",
".swcrc",
"api-extractor.json",
"devcontainer.json",
"jsconfig.json",
"language-configuration.json",
"tsconfig.json",
"tslint.json"
"tsconfig.json"
],
"group": "JSON",
"linguistLanguageId": 423,
4 changes: 2 additions & 2 deletions tests/integration/__tests__/with-parser-inference.js
Original file line number Diff line number Diff line change
@@ -66,8 +66,8 @@ describe("infers parser from filename", () => {
{
"jsc": {
// Requires v1.2.50 or upper and requires target to be es2016 or upper.
"keepClassNames": false,
},
"keepClassNames": false
}
}
` + "\n",
);
6 changes: 3 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
"noImplicitAny": false,
"strictNullChecks": false,

"typeRoots": ["./types", "./node_modules/@types"]
"typeRoots": ["./types", "./node_modules/@types"],
},
"exclude": [
"coverage/",
@@ -53,6 +53,6 @@
"scripts/",
"tests/",
"website/",
"types/"
]
"types/",
],
}
2 changes: 1 addition & 1 deletion website/pages/en/index.js
Original file line number Diff line number Diff line change
@@ -337,7 +337,7 @@ const UsersSection = ({ language }) => {
<div style={{ marginLeft: ".7em", width: "260px" }}>
<p>
More than{" "}
<strong data-placeholder="dependent-npm">16.2k</strong>{" "}
<strong data-placeholder="dependent-npm">16.3k</strong>{" "}
dependent packages on npm
</p>
<Button href="https://www.npmjs.com/browse/depended/prettier">
32 changes: 16 additions & 16 deletions website/versioned_docs/version-stable/browser.md
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ Required options:

- **[`parser`](options.md#parser) (or [`filepath`](options.md#file-path))**: One of these options has to be specified for Prettier to know which parser to use.

- **`plugins`**: Unlike the `format` function from the [Node.js-based API](api.md#prettierformatsource--options), this function doesn’t load plugins automatically. The `plugins` option is required because all the parsers included in the Prettier package come as plugins (for reasons of file size). These plugins are files in <https://unpkg.com/browse/prettier@3.2.3/plugins/>. Note that `estree` plugin should be loaded when printing JavaScript, TypeScript, Flow, or JSON.
- **`plugins`**: Unlike the `format` function from the [Node.js-based API](api.md#prettierformatsource--options), this function doesn’t load plugins automatically. The `plugins` option is required because all the parsers included in the Prettier package come as plugins (for reasons of file size). These plugins are files in <https://unpkg.com/browse/prettier@3.2.4/plugins/>. Note that `estree` plugin should be loaded when printing JavaScript, TypeScript, Flow, or JSON.

You need to load the ones that you’re going to use and pass them to `prettier.format` using the `plugins` option.

@@ -30,8 +30,8 @@ See below for examples.
### Global

```html
<script src="https://unpkg.com/prettier@3.2.3/standalone.js"></script>
<script src="https://unpkg.com/prettier@3.2.3/plugins/graphql.js"></script>
<script src="https://unpkg.com/prettier@3.2.4/standalone.js"></script>
<script src="https://unpkg.com/prettier@3.2.4/plugins/graphql.js"></script>
<script>
(async () => {
const formatted = await prettier.format("type Query { hello: String }", {
@@ -48,8 +48,8 @@ Note that the [`unpkg` field](https://unpkg.com/#examples) in Prettier’s `pack

```html
<script type="module">
import * as prettier from "https://unpkg.com/prettier@3.2.3/standalone.mjs";
import prettierPluginGraphql from "https://unpkg.com/prettier@3.2.3/plugins/graphql.mjs";
import * as prettier from "https://unpkg.com/prettier@3.2.4/standalone.mjs";
import prettierPluginGraphql from "https://unpkg.com/prettier@3.2.4/plugins/graphql.mjs";
const formatted = await prettier.format("type Query { hello: String }", {
parser: "graphql",
@@ -62,8 +62,8 @@ Note that the [`unpkg` field](https://unpkg.com/#examples) in Prettier’s `pack

```js
define([
"https://unpkg.com/prettier@3.2.3/standalone.js",
"https://unpkg.com/prettier@3.2.3/plugins/graphql.js",
"https://unpkg.com/prettier@3.2.4/standalone.js",
"https://unpkg.com/prettier@3.2.4/plugins/graphql.js",
], async (prettier, ...plugins) => {
const formatted = await prettier.format("type Query { hello: String }", {
parser: "graphql",
@@ -91,8 +91,8 @@ This syntax doesn’t necessarily work in the browser, but it can be used when b
### Worker

```js
importScripts("https://unpkg.com/prettier@3.2.3/standalone.js");
importScripts("https://unpkg.com/prettier@3.2.3/plugins/graphql.js");
importScripts("https://unpkg.com/prettier@3.2.4/standalone.js");
importScripts("https://unpkg.com/prettier@3.2.4/plugins/graphql.js");

(async () => {
const formatted = await prettier.format("type Query { hello: String }", {
@@ -108,9 +108,9 @@ If you want to format [embedded code](options.md#embedded-language-formatting),

```html
<script type="module">
import * as prettier from "https://unpkg.com/prettier@3.2.3/standalone.mjs";
import prettierPluginBabel from "https://unpkg.com/prettier@3.2.3/plugins/babel.mjs";
import prettierPluginEstree from "https://unpkg.com/prettier@3.2.3/plugins/estree.mjs";
import * as prettier from "https://unpkg.com/prettier@3.2.4/standalone.mjs";
import prettierPluginBabel from "https://unpkg.com/prettier@3.2.4/plugins/babel.mjs";
import prettierPluginEstree from "https://unpkg.com/prettier@3.2.4/plugins/estree.mjs";
console.log(
await prettier.format("const html=/* HTML */ `<DIV> </DIV>`", {
@@ -126,10 +126,10 @@ The HTML code embedded in JavaScript stays unformatted because the `html` parser

```html
<script type="module">
import * as prettier from "https://unpkg.com/prettier@3.2.3/standalone.mjs";
import prettierPluginBabel from "https://unpkg.com/prettier@3.2.3/plugins/babel.mjs";
import prettierPluginEstree from "https://unpkg.com/prettier@3.2.3/plugins/estree.mjs";
import prettierPluginHtml from "https://unpkg.com/prettier@3.2.3/plugins/html.mjs";
import * as prettier from "https://unpkg.com/prettier@3.2.4/standalone.mjs";
import prettierPluginBabel from "https://unpkg.com/prettier@3.2.4/plugins/babel.mjs";
import prettierPluginEstree from "https://unpkg.com/prettier@3.2.4/plugins/estree.mjs";
import prettierPluginHtml from "https://unpkg.com/prettier@3.2.4/plugins/html.mjs";
console.log(
await prettier.format("const html=/* HTML */ `<DIV> </DIV>`", {
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
@@ -7317,12 +7317,12 @@ __metadata:
languageName: node
linkType: hard

"prettier@npm:3.2.2":
version: 3.2.2
resolution: "prettier@npm:3.2.2"
"prettier@npm:3.2.3":
version: 3.2.3
resolution: "prettier@npm:3.2.3"
bin:
prettier: bin/prettier.cjs
checksum: ab9470ff6cfd19f28bc424f22e58f2fc4a488d148b9384f6c3739235017c8350cae82b3697392c23d9b098b9d8dfaa1cc9ff4ef25fd45f54c97b95f9cc7a1f7d
checksum: cc05f25f22aa18f6b602b4cd923f388f077fe0a9fa15be100b25d4b406e8f1a50d534e5513a129f12f3fc40bc8058006a41dbf68d72c86a1a6b8009e59ffeb66
languageName: node
linkType: hard

@@ -7431,7 +7431,7 @@ __metadata:
postcss-scss: "npm:4.0.9"
postcss-selector-parser: "npm:2.2.3"
postcss-values-parser: "npm:2.0.1"
prettier: "npm:3.2.2"
prettier: "npm:3.2.3"
pretty-bytes: "npm:6.1.1"
regexp-util: "npm:2.0.0"
remark-footnotes: "npm:2.0.0"