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.2
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.3
Choose a head ref
  • 17 commits
  • 47 files changed
  • 3 contributors

Commits on Jan 14, 2024

  1. Copy the full SHA
    afc0a6b View commit details
  2. Git blame ignore 3.2.2

    sosukesuzuki committed Jan 14, 2024
    Copy the full SHA
    513dd0b View commit details
  3. Copy the full SHA
    d3be642 View commit details
  4. Run yarn

    sosukesuzuki committed Jan 14, 2024
    Copy the full SHA
    56f5f4c View commit details
  5. Verified

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

Commits on Jan 15, 2024

  1. chore(deps): update typescript-eslint to v6.18.1 (#15881)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    Co-authored-by: fisker <lionkay@gmail.com>
    renovate[bot] and fisker authored Jan 15, 2024

    Verified

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

Commits on Jan 16, 2024

  1. Simplify loc.js (#15933)

    fisker authored Jan 16, 2024

    Verified

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

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

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

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

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

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    be17405 View commit details
  7. Fix parser inference (#15927)

    fisker authored Jan 16, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    c566c9d View commit details
  8. chore(deps): update dependency browserslist-to-esbuild to v2.1.1 (#15930

    )
    
    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Jan 16, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    12ab585 View commit details
  9. chore(deps): update dependency flow-parser to v0.226.0 (#15931)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Jan 16, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    86fd77d View commit details
  10. chore(deps): update typescript-eslint to v6.19.0 (#15939)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Jan 16, 2024

    Verified

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

Commits on Jan 17, 2024

  1. Release 3.2.3

    fisker committed Jan 17, 2024
    Copy the full SHA
    42ba437 View commit details
Showing with 719 additions and 359 deletions.
  1. +2 −0 .git-blame-ignore-revs
  2. +1 −1 .github/ISSUE_TEMPLATE/formatting.md
  3. +1 −1 .github/ISSUE_TEMPLATE/integration.md
  4. +3 −4 .prettierrc
  5. +2 −2 .vscode/extensions.json
  6. +4 −4 .vscode/settings.example.json
  7. +48 −0 CHANGELOG.md
  8. +12 −0 changelog_unreleased/api/15927.md
  9. +0 −8 changelog_unreleased/javascript/15896.md
  10. +0 −13 changelog_unreleased/javascript/15920.md
  11. +30 −0 changelog_unreleased/typescript/15881.md
  12. +1 −14 cspell.json
  13. +1 −1 docs/api.md
  14. +16 −16 docs/browser.md
  15. +7 −7 package.json
  16. +2 −4 src/language-graphql/loc.js
  17. +1 −2 src/language-graphql/parser-graphql.js
  18. +5 −7 src/language-js/loc.js
  19. +6 −8 src/language-js/parse/babel.js
  20. +9 −1 src/language-js/parse/utils/create-babel-parse-error.js
  21. +7 −13 src/language-js/print/cast-expression.js
  22. +1 −31 src/language-js/print/module.js
  23. +4 −3 src/language-js/print/typescript.js
  24. +34 −0 src/language-js/utils/get-text-without-comments.js
  25. +7 −24 src/language-js/utils/index.js
  26. +0 −10 src/language-json/parser-json.js
  27. +11 −8 src/utils/infer-parser.js
  28. +7 −0 tests/format/misc/errors/babel-missing-plugins/__snapshots__/jsfmt.spec.js.snap
  29. +10 −0 tests/format/misc/errors/babel-missing-plugins/jsfmt.spec.js
  30. +17 −17 tests/format/misc/errors/json/__snapshots__/jsfmt.spec.js.snap
  31. +23 −0 tests/format/misc/errors/typescript/catch-clause-with-initializer/__snapshots__/jsfmt.spec.js.snap
  32. +4 −0 tests/format/misc/errors/typescript/catch-clause-with-initializer/catch-clause-with-initializer.ts
  33. +1 −0 tests/format/misc/errors/typescript/catch-clause-with-initializer/jsfmt.spec.js
  34. +253 −0 .../format/misc/errors/typescript/decrement-and-increment-operators/__snapshots__/jsfmt.spec.js.snap
  35. +33 −0 tests/format/misc/errors/typescript/decrement-and-increment-operators/jsfmt.spec.js
  36. +0 −56 tests/format/typescript/compiler/__snapshots__/jsfmt.spec.js.snap
  37. +0 −22 tests/format/typescript/compiler/decrementAndIncrementOperators.ts
  38. +1 −5 tests/format/typescript/compiler/jsfmt.spec.js
  39. +8 −0 tests/format/typescript/module/__snapshots__/jsfmt.spec.js.snap
  40. +4 −0 tests/format/typescript/module/keyword.ts
  41. +45 −0 tests/format/typescript/update-expression/__snapshots__/jsfmt.spec.js.snap
  42. +1 −0 tests/format/typescript/update-expression/jsfmt.spec.js
  43. +16 −0 tests/format/typescript/update-expression/update-expressions.ts
  44. +4 −0 tests/integration/__tests__/file-info.js
  45. +1 −1 website/versioned_docs/version-stable/api.md
  46. +16 −16 website/versioned_docs/version-stable/browser.md
  47. +60 −60 yarn.lock
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.2
afc0a6b5fae11c86c18bbc345775821607d4d41d
# 3.2.1
5811ad00705488365e0d0baf50c92965edddf58e
# 3.2.0
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.2**
**Prettier 3.2.3**
[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.2
- Prettier Version: 3.2.3
- Running Prettier via: <!-- CLI, Node.js API, Browser API, etc. -->
- Runtime: <!-- Node.js v14, Chrome v83, etc. -->
- Operating System: <!-- Windows, Linux, macOS, etc. -->
7 changes: 3 additions & 4 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -5,7 +5,6 @@ overrides:
- files: "bin/prettier.cjs"
options:
trailingComma: none
# TODO: Enable this after `jsonc` parser released
# - files: ".vscode/*.json"
# options:
# parser: jsonc
- files: ".vscode/*.json"
options:
parser: jsonc
4 changes: 2 additions & 2 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -3,6 +3,6 @@
"esbenp.prettier-vscode",
"editorconfig.editorconfig",
"dbaeumer.vscode-eslint",
"streetsidesoftware.code-spell-checker"
]
"streetsidesoftware.code-spell-checker",
],
}
8 changes: 4 additions & 4 deletions .vscode/settings.example.json
Original file line number Diff line number Diff line change
@@ -2,14 +2,14 @@
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": ["source.fixAll.eslint"]
"editor.codeActionsOnSave": ["source.fixAll.eslint"],
},
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
"source.fixAll.eslint": "explicit",
},
"prettier.requireConfig": true,
"eslint.experimental.useFlatConfig": true,
"files.exclude": {
"dist*": true
}
"dist*": true,
},
}
48 changes: 48 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,51 @@
# 3.2.3

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

#### Throw errors for invalid code ([#15881](https://github.com/prettier/prettier/pull/15881) by [@fisker](https://github.com/fisker), [@Josh-Cena](https://github.com/Josh-Cena), [@auvred](https://github.com/auvred))

<!-- prettier-ignore -->
```ts
// Input
1++;

// Prettier 3.2.2
1++;

// Prettier 3.2.3
SyntaxError: Invalid left-hand side expression in unary operation (1:1)
> 1 | 1++;
| ^
```

<!-- prettier-ignore -->
```ts
// Input
try {} catch (error = 1){}

// Prettier 3.2.2
try {
} catch (error) {}

// Prettier 3.2.3
SyntaxError: Catch clause variable cannot have an initializer. (1:23)
> 1 | try {} catch (error = 1){}
| ^
```

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

<!-- prettier-ignore -->
```console
// Prettier 3.2.2
prettier --file-info tsconfig.json
{ "ignored": false, "inferredParser": "json" }

// Prettier 3.2.3
prettier --file-info tsconfig.json
{ "ignored": false, "inferredParser": "jsonc" }
```

# 3.2.2

[diff](https://github.com/prettier/prettier/compare/3.2.1...3.2.2)
12 changes: 12 additions & 0 deletions changelog_unreleased/api/15927.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#### Fix parser inference (#15927 by @fisker)

<!-- prettier-ignore -->
```console
// Prettier stable
prettier --file-info tsconfig.json
{ "ignored": false, "inferredParser": "json" }

// Prettier main
prettier --file-info tsconfig.json
{ "ignored": false, "inferredParser": "jsonc" }
```
8 changes: 0 additions & 8 deletions changelog_unreleased/javascript/15896.md

This file was deleted.

13 changes: 0 additions & 13 deletions changelog_unreleased/javascript/15920.md

This file was deleted.

30 changes: 30 additions & 0 deletions changelog_unreleased/typescript/15881.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#### Throw errors for invalid code (#15881 by @fisker, @Josh-Cena, @auvred)

<!-- prettier-ignore -->
```ts
// Input
1++;

// Prettier stable
1++;

// Prettier main
SyntaxError: Invalid left-hand side expression in unary operation (1:1)
> 1 | 1++;
| ^
```

<!-- prettier-ignore -->
```ts
// Input
try {} catch (error = 1){}

// Prettier stable
try {
} catch (error) {}

// Prettier main
SyntaxError: Catch clause variable cannot have an initializer. (1:23)
> 1 | try {} catch (error = 1){}
| ^
```
15 changes: 1 addition & 14 deletions cspell.json
Original file line number Diff line number Diff line change
@@ -50,7 +50,6 @@
"cliify",
"cmds",
"codebases",
"Codecov",
"codemirror",
"codemod",
"codemods",
@@ -80,10 +79,8 @@
"Dolzhykov",
"Doshi",
"dotfile",
"dotfiles",
"duailibe",
"Duperron",
"eastasianwidth",
"Eemeli",
"ekkhus",
"elektronik",
@@ -96,7 +93,6 @@
"eslump",
"espree",
"esproposal",
"estree",
"execa",
"Fabio",
"fabiospampinato",
@@ -107,14 +103,12 @@
"Filipe",
"Fiorini",
"Fisker",
"fizzbuzz",
"flamegraph",
"foldgutter",
"formatprg",
"Friedly",
"frobble",
"ftest",
"fuzzer",
"Georgii",
"gettin",
"githook",
@@ -171,14 +165,11 @@
"Kasturi",
"kddnewton",
"Kearney",
"keyframes",
"keyof",
"Khatri",
"Konstantin",
"l’objectif",
"lcov",
"libdef",
"lilconfig",
"linebreak",
"linebreaks",
"lintstaged",
@@ -271,7 +262,6 @@
"Rects",
"Redeclaration",
"refmt",
"regexes",
"rhengles",
"Rubocop",
"ruleset",
@@ -303,7 +293,6 @@
"starturl",
"stylefmt",
"styleguides",
"stylelint",
"stylelintrc",
"Stylesheet",
"subal",
@@ -343,7 +332,6 @@
"unparenthesized",
"unparseable",
"Unrestrict",
"unstaged",
"upvoted",
"upvotes",
"valourous",
@@ -361,7 +349,6 @@
"webcompat",
"webstorm",
"Weixin",
"whitespaces",
"withastro",
"wxss",
"xdescribe",
@@ -374,7 +361,7 @@
"ignoreRegExpList": [
"<!-- prettier-ignore -->\\n(`{3,})\\w*\\n[\\s\\S]+?\\1",
"\\[(\\*{2})?@[-\\w]+?\\1\\]",
"by @[-\\w]+(?:, @[-\\w]+)?",
"by @[-\\w]+(?:, @[-\\w]+)*",
"ve{2,}r{2,}y",
"ve+r+y+long\\w*",
"\\(https?://.*?\\)",
2 changes: 1 addition & 1 deletion docs/api.md
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@ await prettier.formatWithCursor(" 1", { cursorOffset: 2, parser: "babel" });

## `prettier.resolveConfig(fileUrlOrPath [, options])`

`resolveConfig` can be used to resolve configuration for a given source file, passing its path or url as the first argument. The config search will start at the file location and continue to search up the directory (you can use `process.cwd()` to start searching from the current directory). Or you can pass directly the path of the config file as `options.config` if you don’t wish to search for it. A promise is returned which will resolve to:
`resolveConfig` can be used to resolve configuration for a given source file, passing its path or url as the first argument. The config search will start at the directory of the file location and continue to search up the directory. Or you can pass directly the path of the config file as `options.config` if you don’t wish to search for it. A promise is returned which will resolve to:

- An options object, providing a [config file](configuration.md) was found.
- `null`, if no file was found.
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.2/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.3/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.2/standalone.js"></script>
<script src="https://unpkg.com/prettier@3.2.2/plugins/graphql.js"></script>
<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>
(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.2/standalone.mjs";
import prettierPluginGraphql from "https://unpkg.com/prettier@3.2.2/plugins/graphql.mjs";
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";
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.2/standalone.js",
"https://unpkg.com/prettier@3.2.2/plugins/graphql.js",
"https://unpkg.com/prettier@3.2.3/standalone.js",
"https://unpkg.com/prettier@3.2.3/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.2/standalone.js");
importScripts("https://unpkg.com/prettier@3.2.2/plugins/graphql.js");
importScripts("https://unpkg.com/prettier@3.2.3/standalone.js");
importScripts("https://unpkg.com/prettier@3.2.3/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.2/standalone.mjs";
import prettierPluginBabel from "https://unpkg.com/prettier@3.2.2/plugins/babel.mjs";
import prettierPluginEstree from "https://unpkg.com/prettier@3.2.2/plugins/estree.mjs";
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";
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.2/standalone.mjs";
import prettierPluginBabel from "https://unpkg.com/prettier@3.2.2/plugins/babel.mjs";
import prettierPluginEstree from "https://unpkg.com/prettier@3.2.2/plugins/estree.mjs";
import prettierPluginHtml from "https://unpkg.com/prettier@3.2.2/plugins/html.mjs";
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";
console.log(
await prettier.format("const html=/* HTML */ `<DIV> </DIV>`", {
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "prettier",
"version": "3.2.2",
"version": "3.2.3",
"description": "Prettier is an opinionated code formatter",
"bin": "./bin/prettier.cjs",
"repository": "prettier/prettier",
@@ -38,8 +38,8 @@
"@iarna/toml": "2.2.5",
"@prettier/is-es5-identifier-name": "0.2.0",
"@prettier/parse-srcset": "3.1.0",
"@typescript-eslint/typescript-estree": "6.17.0",
"@typescript-eslint/visitor-keys": "6.17.0",
"@typescript-eslint/typescript-estree": "6.19.0",
"@typescript-eslint/visitor-keys": "6.19.0",
"acorn": "8.11.3",
"acorn-jsx": "5.3.2",
"angular-estree-parser": "9.0.0",
@@ -60,7 +60,7 @@
"fast-json-stable-stringify": "2.1.0",
"file-entry-cache": "7.0.2",
"find-cache-dir": "5.0.0",
"flow-parser": "0.225.1",
"flow-parser": "0.226.0",
"get-east-asian-width": "1.2.0",
"get-stdin": "9.0.0",
"graphql": "16.8.1",
@@ -116,10 +116,10 @@
"@types/file-entry-cache": "5.0.4",
"@types/find-cache-dir": "3.2.1",
"@types/jest": "29.5.8",
"@typescript-eslint/eslint-plugin": "6.17.0",
"@typescript-eslint/eslint-plugin": "6.19.0",
"benchmark": "2.1.4",
"browserslist": "4.22.2",
"browserslist-to-esbuild": "2.1.0",
"browserslist-to-esbuild": "2.1.1",
"c8": "9.0.0",
"cross-env": "7.0.3",
"cspell": "8.3.2",
@@ -147,7 +147,7 @@
"jest-watch-typeahead": "2.2.2",
"magic-string": "0.30.5",
"npm-run-all2": "6.1.1",
"prettier": "3.2.1",
"prettier": "3.2.2",
"pretty-bytes": "6.1.1",
"rollup-plugin-license": "3.2.0",
"semver": "7.5.4",
6 changes: 2 additions & 4 deletions src/language-graphql/loc.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
function locStart(nodeOrToken) {
return nodeOrToken.kind === "Comment"
? nodeOrToken.start
: nodeOrToken.loc.start;
return nodeOrToken.loc.start;
}

function locEnd(nodeOrToken) {
return nodeOrToken.kind === "Comment" ? nodeOrToken.end : nodeOrToken.loc.end;
return nodeOrToken.loc.end;
}

export { locEnd, locStart };
3 changes: 1 addition & 2 deletions src/language-graphql/parser-graphql.js
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ function parseComments(ast) {
const { startToken, endToken } = ast.loc;
for (let token = startToken; token !== endToken; token = token.next) {
if (token.kind === "Comment") {
comments.push(token);
comments.push({ ...token, loc: { start: token.start, end: token.end } });
}
}

@@ -34,7 +34,6 @@ function createParseError(error) {
}

function parse(text /*, options */) {
/** @type {any} */
let ast;
try {
ast = parseGraphql(text, parseOptions);
12 changes: 5 additions & 7 deletions src/language-js/loc.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
import isNonEmptyArray from "../utils/is-non-empty-array.js";

/**
* @typedef {import("./types/estree.js").Node} Node
*/

function locStart(node) {
const start = node.range ? node.range[0] : node.start;
const start = node.range?.[0] ?? node.start;

// Handle nodes with decorators. They should start at the first decorator
const decorators = node.declaration?.decorators ?? node.decorators;
if (isNonEmptyArray(decorators)) {
return Math.min(locStart(decorators[0]), start);
const firstDecorator = (node.declaration?.decorators ?? node.decorators)?.[0];
if (firstDecorator) {
return Math.min(locStart(firstDecorator), start);
}

return start;
}

function locEnd(node) {
return node.range ? node.range[1] : node.end;
return node.range?.[1] ?? node.end;
}

/**
14 changes: 6 additions & 8 deletions src/language-js/parse/babel.js
Original file line number Diff line number Diff line change
@@ -99,7 +99,7 @@ function isFlowFile(text, options) {
function parseWithOptions(parse, text, options) {
const ast = parse(text, options);
const error = ast.errors.find(
(error) => !allowedMessageCodes.has(error.reasonCode),
(error) => !allowedReasonCodes.has(error.reasonCode),
);
if (error) {
throw error;
@@ -171,11 +171,11 @@ function createParse({ isExpression = false, optionsCombinations }) {
}

// Error codes are defined in
// - https://github.com/babel/babel/blob/v7.14.0/packages/babel-parser/src/parser/error-message.js
// - https://github.com/babel/babel/blob/v7.14.0/packages/babel-parser/src/plugins/typescript/index.js#L69-L153
// - https://github.com/babel/babel/blob/v7.14.0/packages/babel-parser/src/plugins/flow/index.js#L51-L140
// - https://github.com/babel/babel/blob/v7.14.0/packages/babel-parser/src/plugins/jsx/index.js#L23-L39
const allowedMessageCodes = new Set([
// - https://github.com/babel/babel/tree/v7.23.6/packages/babel-parser/src/parse-error
// - https://github.com/babel/babel/blob/v7.23.6/packages/babel-parser/src/plugins/typescript/index.ts#L73-L223
// - https://github.com/babel/babel/blob/v7.23.6/packages/babel-parser/src/plugins/flow/index.ts#L47-L224
// - https://github.com/babel/babel/blob/v7.23.6/packages/babel-parser/src/plugins/jsx/index.ts#L23-L44
const allowedReasonCodes = new Set([
"StrictNumericEscape",
"StrictWith",
"StrictOctalLiteral",
@@ -190,8 +190,6 @@ const allowedMessageCodes = new Set([

"UnsupportedParameterPropertyKind",

"MixedLabeledAndUnlabeledElements",

"DuplicateAccessibilityModifier",

"DecoratorExportClass",
10 changes: 9 additions & 1 deletion src/language-js/parse/utils/create-babel-parse-error.js
Original file line number Diff line number Diff line change
@@ -6,15 +6,23 @@ function createBabelParseError(error) {
let {
message,
loc: { line, column },
reasonCode,
} = error;

let cause = error;
if (reasonCode === "MissingPlugin" || reasonCode === "MissingOneOfPlugins") {
message = "Unexpected token.";
cause = undefined;
}

const suffix = ` (${line}:${column})`;
if (message.endsWith(suffix)) {
message = message.slice(0, -suffix.length);
}

return createError(message, {
loc: { start: { line, column: column + 1 } },
cause: error,
cause,
});
}

20 changes: 7 additions & 13 deletions src/language-js/print/cast-expression.js
Original file line number Diff line number Diff line change
@@ -2,31 +2,25 @@ import { group, indent, softline } from "../../document/builders.js";
import { isCallExpression, isMemberExpression } from "../utils/index.js";

function printBinaryCastExpression(path, options, print) {
const { parent, node } = path;
let parts = [];
const { parent, node, key } = path;
const parts = [print("expression")];
switch (node.type) {
case "AsConstExpression":
parts = [print("expression"), " as const"];
parts.push(" as const");
break;
case "AsExpression":
case "TSAsExpression":
parts = [print("expression"), " ", "as", " ", print("typeAnnotation")];
parts.push(" as ", print("typeAnnotation"));
break;
case "SatisfiesExpression":
case "TSSatisfiesExpression":
parts = [
print("expression"),
" ",
"satisfies",
" ",
print("typeAnnotation"),
];
parts.push(" satisfies ", print("typeAnnotation"));
break;
}

if (
(isCallExpression(parent) && parent.callee === node) ||
(isMemberExpression(parent) && parent.object === node)
(key === "callee" && isCallExpression(parent)) ||
(key === "object" && isMemberExpression(parent))
) {
return group([indent([softline, ...parts]), softline]);
}
32 changes: 1 addition & 31 deletions src/language-js/print/module.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import assert from "node:assert";

import {
group,
hardline,
@@ -13,6 +11,7 @@ import { printDanglingComments } from "../../main/comments/print.js";
import isNonEmptyArray from "../../utils/is-non-empty-array.js";
import UnexpectedNodeError from "../../utils/unexpected-node-error.js";
import { hasSameLoc, locEnd, locStart } from "../loc.js";
import getTextWithoutComments from "../utils/get-text-without-comments.js";
import {
CommentCheckFlags,
createTypeCheckFunction,
@@ -249,35 +248,6 @@ function shouldPrintSpecifiers(node, options) {
return text.trimEnd().endsWith("from");
}

function getTextWithoutComments(options, start, end) {
let text = options.originalText.slice(start, end);

for (const comment of options[Symbol.for("comments")]) {
const commentStart = locStart(comment);
// Comments are sorted, we can escape if the comment is after the range
if (commentStart > end) {
break;
}

const commentEnd = locEnd(comment);
if (commentEnd < start) {
continue;
}

const commentLength = commentEnd - commentStart;
text =
text.slice(0, commentStart - start) +
" ".repeat(commentLength) +
text.slice(commentEnd - start);
}

if (process.env.NODE_ENV !== "production") {
assert(text.length === end - start);
}

return text;
}

function getImportAttributesKeyword(node, options) {
// Babel parser add this property to indicate the keyword is `assert`
if (node.extra?.deprecatedAssertSyntax) {
7 changes: 4 additions & 3 deletions src/language-js/print/typescript.js
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@ import {
} from "../../document/builders.js";
import UnexpectedNodeError from "../../utils/unexpected-node-error.js";
import { locStart } from "../loc.js";
import getTextWithoutComments from "../utils/get-text-without-comments.js";
import {
isArrayOrTupleExpression,
isObjectOrRecordExpression,
@@ -311,9 +312,9 @@ function printTypescript(path, options, print) {
node.kind ??
// TODO: Use `node.kind` when babel update AST
(isStringLiteral(node.id) ||
/(?:^|\s)module(?:\s|$)/.test(
options.originalText.slice(locStart(node), locStart(node.id)),
)
getTextWithoutComments(options, locStart(node), locStart(node.id))
.trim()
.endsWith("module")
? "module"
: "namespace");
parts.push(kind, " ");
34 changes: 34 additions & 0 deletions src/language-js/utils/get-text-without-comments.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import assert from "node:assert";

import { locEnd, locStart } from "../loc.js";

function getTextWithoutComments(options, start, end) {
let text = options.originalText.slice(start, end);

for (const comment of options[Symbol.for("comments")]) {
const commentStart = locStart(comment);
// Comments are sorted, we can escape if the comment is after the range
if (commentStart > end) {
break;
}

const commentEnd = locEnd(comment);
if (commentEnd < start) {
continue;
}

const commentLength = commentEnd - commentStart;
text =
text.slice(0, commentStart - start) +
" ".repeat(commentLength) +
text.slice(commentEnd - start);
}

if (process.env.NODE_ENV !== "production") {
assert(text.length === end - start);
}

return text;
}

export default getTextWithoutComments;
31 changes: 7 additions & 24 deletions src/language-js/utils/index.js
Original file line number Diff line number Diff line change
@@ -419,22 +419,6 @@ const isMemberExpression = skipChainExpression(
createTypeCheckFunction(["MemberExpression", "OptionalMemberExpression"]),
);

/**
* Retrieves a property from a node, considering any ChainExpression.
* If the node is a ChainExpression, the property is obtained from its expression.
* Otherwise, the property is obtained directly from the node.
*
* @param {Node} node - The AST node to be processed.
* @param {string} property - The property name to retrieve.
* @returns The property value from the node or its expression.
*/
function getChainProp(node, property) {
if (node.type === "ChainExpression") {
return node.expression[property];
}
return node[property];
}

/**
*
* @param {any} node
@@ -740,6 +724,10 @@ function isSimpleCallArgument(node, depth = 2) {
return false;
}

if (node.type === "ChainExpression" || node.type === "TSNonNullExpression") {
return isSimpleCallArgument(node.expression, depth);
}

const isChildSimple = (child) => isSimpleCallArgument(child, depth - 1);

if (isRegExpLiteral(node)) {
@@ -775,7 +763,7 @@ function isSimpleCallArgument(node, depth = 2) {
if (isCallLikeExpression(node)) {
if (
node.type === "ImportExpression" ||
isSimpleCallArgument(getChainProp(node, "callee"), depth)
isSimpleCallArgument(node.callee, depth)
) {
const args = getCallArguments(node);
return args.length <= depth && args.every(isChildSimple);
@@ -785,8 +773,8 @@ function isSimpleCallArgument(node, depth = 2) {

if (isMemberExpression(node)) {
return (
isSimpleCallArgument(getChainProp(node, "object"), depth) &&
isSimpleCallArgument(getChainProp(node, "property"), depth)
isSimpleCallArgument(node.object, depth) &&
isSimpleCallArgument(node.property, depth)
);
}

@@ -798,10 +786,6 @@ function isSimpleCallArgument(node, depth = 2) {
return isSimpleCallArgument(node.argument, depth);
}

if (node.type === "TSNonNullExpression") {
return isSimpleCallArgument(node.expression, depth);
}

return false;
}

@@ -1238,7 +1222,6 @@ export {
createTypeCheckFunction,
getCallArguments,
getCallArgumentSelector,
getChainProp,
getComments,
getFunctionParameters,
getLeftSide,
10 changes: 0 additions & 10 deletions src/language-json/parser-json.js
Original file line number Diff line number Diff line change
@@ -18,16 +18,6 @@ function createJsonParse(options = {}) {
attachComment: false,
});
} catch (/** @type {any} */ error) {
if (
error?.reasonCode === "MissingPlugin" ||
error?.reasonCode === "MissingOneOfPlugins"
) {
throw createBabelParseError({
message: "Unexpected token",
loc: error.loc,
});
}

throw createBabelParseError(error);
}

19 changes: 11 additions & 8 deletions src/utils/infer-parser.js
Original file line number Diff line number Diff line change
@@ -11,14 +11,17 @@ function getLanguageByFileName(languages, file) {

const basename = getFileBasename(file).toLowerCase();

return languages.find(
(language) =>
language.extensions?.some((extension) => basename.endsWith(extension)) ||
language.filenames?.some((name) => name.toLowerCase() === basename),
return (
languages.find(({ filenames }) =>
filenames?.some((name) => name.toLowerCase() === basename),
) ??
languages.find(({ extensions }) =>
extensions?.some((extension) => basename.endsWith(extension)),
)
);
}

function getLanguageByName(languages, languageName) {
function getLanguageByLanguageName(languages, languageName) {
if (!languageName) {
return;
}
@@ -45,8 +48,8 @@ function getLanguageByInterpreter(languages, file) {
return;
}

return languages.find((language) =>
language.interpreters?.includes(interpreter),
return languages.find(({ interpreters }) =>
interpreters?.includes(interpreter),
);
}

@@ -66,7 +69,7 @@ function inferParser(options, fileInfo) {
// interpreter in the shebang line, if any; but since this requires FS access,
// do it last.
const language =
getLanguageByName(languages, fileInfo.language) ??
getLanguageByLanguageName(languages, fileInfo.language) ??
getLanguageByFileName(languages, fileInfo.physicalFile) ??
getLanguageByFileName(languages, fileInfo.file) ??
getLanguageByInterpreter(languages, fileInfo.physicalFile);
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`snippet: #0 [babel] format 1`] = `
"Unexpected token. (1:8)
> 1 | export type Foo = number;
| ^"
`;
10 changes: 10 additions & 0 deletions tests/format/misc/errors/babel-missing-plugins/jsfmt.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
run_spec(
{
importMeta: import.meta,
snippets: [
// https://github.com/babel/babel/commit/a466f9c310ace91484d4087f077ee6d6c8cd8789
"export type Foo = number;",
],
},
["babel"],
);
34 changes: 17 additions & 17 deletions tests/format/misc/errors/json/__snapshots__/jsfmt.spec.js.snap
Original file line number Diff line number Diff line change
@@ -82,7 +82,7 @@ exports[`snippet: #3 [json] format 1`] = `
`;

exports[`snippet: #3 [json] format 2`] = `
"Unexpected token (1:2)
"Unexpected token. (1:2)
> 1 | [do {}]
| ^"
`;
@@ -184,7 +184,7 @@ exports[`snippet: #7 [json] format 1`] = `
`;

exports[`snippet: #7 [json] format 2`] = `
"Unexpected token (1:24)
"Unexpected token. (1:24)
> 1 | [function*() {function.sent}]
| ^"
`;
@@ -208,7 +208,7 @@ exports[`snippet: #8 [json] format 1`] = `
`;

exports[`snippet: #8 [json] format 2`] = `
"Unexpected token (1:2)
"Unexpected token. (1:2)
> 1 | [throw {}]
| ^"
`;
@@ -232,7 +232,7 @@ exports[`snippet: #9 [json] format 1`] = `
`;

exports[`snippet: #9 [json] format 2`] = `
"Unexpected token (1:6)
"Unexpected token. (1:6)
> 1 | [foo(?)]
| ^"
`;
@@ -256,7 +256,7 @@ exports[`snippet: #10 [json] format 1`] = `
`;

exports[`snippet: #10 [json] format 2`] = `
"Unexpected token (1:2)
"Unexpected token. (1:2)
> 1 | [@decorator class {}]
| ^"
`;
@@ -280,7 +280,7 @@ exports[`snippet: #11 [json] format 1`] = `
`;

exports[`snippet: #11 [json] format 2`] = `
"Unexpected token (1:28)
"Unexpected token. (1:28)
> 1 | [import('a', {type:'json'})]
| ^"
`;
@@ -304,7 +304,7 @@ exports[`snippet: #12 [json] format 1`] = `
`;

exports[`snippet: #12 [json] format 2`] = `
"Unexpected token (1:3)
"Unexpected token. (1:3)
> 1 | [1m]
| ^"
`;
@@ -328,7 +328,7 @@ exports[`snippet: #13 [json] format 1`] = `
`;

exports[`snippet: #13 [json] format 2`] = `
"Unexpected token (1:2)
"Unexpected token. (1:2)
> 1 | [module {}]
| ^"
`;
@@ -352,7 +352,7 @@ exports[`snippet: #14 [json] format 1`] = `
`;

exports[`snippet: #14 [json] format 2`] = `
"Unexpected token (1:8)
"Unexpected token. (1:8)
> 1 | [async do {}]
| ^"
`;
@@ -400,7 +400,7 @@ exports[`snippet: #16 [json] format 1`] = `
`;

exports[`snippet: #16 [json] format 2`] = `
"Unexpected token (1:28)
"Unexpected token. (1:28)
> 1 | [class {#foo;bar() {const {#foo: foo} = this;}}]
| ^"
`;
@@ -424,7 +424,7 @@ exports[`snippet: #17 [json] format 1`] = `
`;

exports[`snippet: #17 [json] format 2`] = `
"Unexpected token (1:18)
"Unexpected token. (1:18)
> 1 | [class {accessor foo = 1}]
| ^"
`;
@@ -448,7 +448,7 @@ exports[`snippet: #18 [json] format 1`] = `
`;

exports[`snippet: #18 [json] format 2`] = `
"Unexpected token (1:34)
"Unexpected token. (1:34)
> 1 | [import('a', {reflect: 'module'})]
| ^"
`;
@@ -497,7 +497,7 @@ exports[`snippet: #20 [json] format 1`] = `
`;

exports[`snippet: #20 [json] format 2`] = `
"Unexpected token (1:16)
"Unexpected token. (1:16)
> 1 | [function() { {using a = b} }]
| ^"
`;
@@ -584,7 +584,7 @@ Cause: Unexpected token (1:13)"
`;

exports[`snippet: #23 [json] format 2`] = `
"Unexpected token (1:2)
"Unexpected token. (1:2)
> 1 | [#{}]
| ^"
`;
@@ -637,7 +637,7 @@ exports[`snippet: #25 [json] format 1`] = `
`;

exports[`snippet: #25 [json] format 2`] = `
"Unexpected token (1:8)
"Unexpected token. (1:8)
> 1 | ['foo' |> bar]
| ^"
`;
@@ -661,7 +661,7 @@ exports[`snippet: #26 [json] format 1`] = `
`;

exports[`snippet: #26 [json] format 2`] = `
"Unexpected token (1:8)
"Unexpected token. (1:8)
> 1 | ['foo' |> bar(%)]
| ^"
`;
@@ -685,7 +685,7 @@ exports[`snippet: #27 [json] format 1`] = `
`;

exports[`snippet: #27 [json] format 2`] = `
"Unexpected token (1:2)
"Unexpected token. (1:2)
> 1 | [<foo></foo>]
| ^"
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`catch-clause-with-initializer.ts [babel-ts] format 1`] = `
"Unexpected token, expected ")" (3:10)
1 | try {
2 | }
> 3 | catch (e = 1) {
| ^
4 | }
5 |
Cause: Unexpected token, expected ")" (3:9)"
`;

exports[`catch-clause-with-initializer.ts [typescript] format 1`] = `
"Catch clause variable cannot have an initializer. (3:12)
1 | try {
2 | }
> 3 | catch (e = 1) {
| ^
4 | }
5 |
Cause: Catch clause variable cannot have an initializer."
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
try {
}
catch (e = 1) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
run_spec(import.meta, ["babel-ts", "typescript"]);
Original file line number Diff line number Diff line change
@@ -0,0 +1,253 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`snippet: #0 [babel-ts] format 1`] = `
"Invalid left-hand side in postfix operation. (1:1)
> 1 | 1 ++
| ^
Cause: Invalid left-hand side in postfix operation. (1:0)"
`;

exports[`snippet: #0 [typescript] format 1`] = `
"Invalid left-hand side expression in unary operation (1:1)
> 1 | 1 ++
| ^
Cause: Invalid left-hand side expression in unary operation"
`;

exports[`snippet: #1 [babel-ts] format 1`] = `
"Invalid left-hand side in postfix operation. (1:2)
> 1 | (1)++
| ^
Cause: Invalid left-hand side in postfix operation. (1:1)"
`;

exports[`snippet: #1 [typescript] format 1`] = `
"Invalid left-hand side expression in unary operation (1:1)
> 1 | (1)++
| ^^^
Cause: Invalid left-hand side expression in unary operation"
`;

exports[`snippet: #2 [babel-ts] format 1`] = `
"Invalid left-hand side in postfix operation. (1:2)
> 1 | (1)--
| ^
Cause: Invalid left-hand side in postfix operation. (1:1)"
`;

exports[`snippet: #2 [typescript] format 1`] = `
"Invalid left-hand side expression in unary operation (1:1)
> 1 | (1)--
| ^^^
Cause: Invalid left-hand side expression in unary operation"
`;

exports[`snippet: #3 [babel-ts] format 1`] = `
"Invalid left-hand side in prefix operation. (1:4)
> 1 | ++(1)
| ^
Cause: Invalid left-hand side in prefix operation. (1:3)"
`;

exports[`snippet: #3 [typescript] format 1`] = `
"Invalid left-hand side expression in unary operation (1:3)
> 1 | ++(1)
| ^^^
Cause: Invalid left-hand side expression in unary operation"
`;

exports[`snippet: #4 [babel-ts] format 1`] = `
"Invalid left-hand side in prefix operation. (1:4)
> 1 | --(1)
| ^
Cause: Invalid left-hand side in prefix operation. (1:3)"
`;

exports[`snippet: #4 [typescript] format 1`] = `
"Invalid left-hand side expression in unary operation (1:3)
> 1 | --(1)
| ^^^
Cause: Invalid left-hand side expression in unary operation"
`;

exports[`snippet: #5 [babel-ts] format 1`] = `
"Invalid left-hand side in postfix operation. (1:2)
> 1 | (1 + 2)++
| ^
Cause: Invalid left-hand side in postfix operation. (1:1)"
`;

exports[`snippet: #5 [typescript] format 1`] = `
"Invalid left-hand side expression in unary operation (1:1)
> 1 | (1 + 2)++
| ^^^^^^^
Cause: Invalid left-hand side expression in unary operation"
`;

exports[`snippet: #6 [babel-ts] format 1`] = `
"Invalid left-hand side in postfix operation. (1:2)
> 1 | (1 + 2)--
| ^
Cause: Invalid left-hand side in postfix operation. (1:1)"
`;

exports[`snippet: #6 [typescript] format 1`] = `
"Invalid left-hand side expression in unary operation (1:1)
> 1 | (1 + 2)--
| ^^^^^^^
Cause: Invalid left-hand side expression in unary operation"
`;

exports[`snippet: #7 [babel-ts] format 1`] = `
"Invalid left-hand side in prefix operation. (1:4)
> 1 | ++(1 + 2)
| ^
Cause: Invalid left-hand side in prefix operation. (1:3)"
`;

exports[`snippet: #7 [typescript] format 1`] = `
"Invalid left-hand side expression in unary operation (1:3)
> 1 | ++(1 + 2)
| ^^^^^^^
Cause: Invalid left-hand side expression in unary operation"
`;

exports[`snippet: #8 [babel-ts] format 1`] = `
"Invalid left-hand side in prefix operation. (1:4)
> 1 | --(1 + 2)
| ^
Cause: Invalid left-hand side in prefix operation. (1:3)"
`;

exports[`snippet: #8 [typescript] format 1`] = `
"Invalid left-hand side expression in unary operation (1:3)
> 1 | --(1 + 2)
| ^^^^^^^
Cause: Invalid left-hand side expression in unary operation"
`;

exports[`snippet: #9 [babel-ts] format 1`] = `
"Invalid left-hand side in postfix operation. (1:2)
> 1 | (x + x)++
| ^
Cause: Invalid left-hand side in postfix operation. (1:1)"
`;

exports[`snippet: #9 [typescript] format 1`] = `
"Invalid left-hand side expression in unary operation (1:1)
> 1 | (x + x)++
| ^^^^^^^
Cause: Invalid left-hand side expression in unary operation"
`;

exports[`snippet: #10 [babel-ts] format 1`] = `
"Invalid left-hand side in postfix operation. (1:2)
> 1 | (x + x)--
| ^
Cause: Invalid left-hand side in postfix operation. (1:1)"
`;

exports[`snippet: #10 [typescript] format 1`] = `
"Invalid left-hand side expression in unary operation (1:1)
> 1 | (x + x)--
| ^^^^^^^
Cause: Invalid left-hand side expression in unary operation"
`;

exports[`snippet: #11 [babel-ts] format 1`] = `
"Invalid left-hand side in prefix operation. (1:4)
> 1 | ++(x + x)
| ^
Cause: Invalid left-hand side in prefix operation. (1:3)"
`;

exports[`snippet: #11 [typescript] format 1`] = `
"Invalid left-hand side expression in unary operation (1:3)
> 1 | ++(x + x)
| ^^^^^^^
Cause: Invalid left-hand side expression in unary operation"
`;

exports[`snippet: #12 [babel-ts] format 1`] = `
"Invalid left-hand side in prefix operation. (1:4)
> 1 | --(x + x)
| ^
Cause: Invalid left-hand side in prefix operation. (1:3)"
`;

exports[`snippet: #12 [typescript] format 1`] = `
"Invalid left-hand side expression in unary operation (1:3)
> 1 | --(x + x)
| ^^^^^^^
Cause: Invalid left-hand side expression in unary operation"
`;

exports[`snippet: #13 [babel-ts] format 1`] = `
"Invalid left-hand side in postfix operation. (1:1)
> 1 | a()++
| ^
Cause: Invalid left-hand side in postfix operation. (1:0)"
`;

exports[`snippet: #13 [typescript] format 1`] = `
"Invalid left-hand side expression in unary operation (1:1)
> 1 | a()++
| ^^^
Cause: Invalid left-hand side expression in unary operation"
`;

exports[`snippet: #14 [babel-ts] format 1`] = `
"Invalid optional chaining in the left-hand side of postfix operation. (1:1)
> 1 | x?.y++
| ^
Cause: Invalid optional chaining in the left-hand side of postfix operation. (1:0)"
`;

exports[`snippet: #14 [typescript] format 1`] = `
"Invalid left-hand side expression in unary operation (1:1)
> 1 | x?.y++
| ^^^^
Cause: Invalid left-hand side expression in unary operation"
`;

exports[`snippet: #15 [babel-ts] format 1`] = `
"Invalid optional chaining in the left-hand side of postfix operation. (1:1)
> 1 | x?.y.z++
| ^
Cause: Invalid optional chaining in the left-hand side of postfix operation. (1:0)"
`;

exports[`snippet: #15 [typescript] format 1`] = `
"Invalid left-hand side expression in unary operation (1:1)
> 1 | x?.y.z++
| ^^^^^^
Cause: Invalid left-hand side expression in unary operation"
`;

exports[`snippet: #16 [babel-ts] format 1`] = `
"Invalid optional chaining in the left-hand side of postfix operation. (1:1)
> 1 | x?.y().z++
| ^
Cause: Invalid optional chaining in the left-hand side of postfix operation. (1:0)"
`;

exports[`snippet: #16 [typescript] format 1`] = `
"Invalid left-hand side expression in unary operation (1:1)
> 1 | x?.y().z++
| ^^^^^^^^
Cause: Invalid left-hand side expression in unary operation"
`;

exports[`snippet: #17 [babel-ts] format 1`] = `
"Invalid left-hand side in postfix operation. (1:2)
> 1 | (a())++
| ^
Cause: Invalid left-hand side in postfix operation. (1:1)"
`;

exports[`snippet: #17 [typescript] format 1`] = `
"Invalid left-hand side expression in unary operation (1:1)
> 1 | (a())++
| ^^^^^
Cause: Invalid left-hand side expression in unary operation"
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
run_spec(
{
importMeta: import.meta,
snippets: [
"1 ++",

"(1)++",
"(1)--",

"++(1)",
"--(1)",

"(1 + 2)++",
"(1 + 2)--",

"++(1 + 2)",
"--(1 + 2)",

"(x + x)++",
"(x + x)--",

"++(x + x)",
"--(x + x)",

"a()++",
"x?.y++",
"x?.y.z++",
"x?.y().z++",
"(a())++",
],
},
["babel-ts", "typescript"],
);
56 changes: 0 additions & 56 deletions tests/format/typescript/compiler/__snapshots__/jsfmt.spec.js.snap
Original file line number Diff line number Diff line change
@@ -325,18 +325,6 @@ module T.U {
================================================================================
`;
exports[`decrementAndIncrementOperators.ts [babel-ts] format 1`] = `
"Invalid left-hand side in postfix operation. (4:1)
2 |
3 | // errors
> 4 | 1 ++;
| ^
5 |
6 | (1)++;
7 | (1)--;
Cause: Invalid left-hand side in postfix operation. (4:0)"
`;
exports[`decrementAndIncrementOperators.ts format 1`] = `
====================================options=====================================
parsers: ["typescript"]
@@ -345,28 +333,6 @@ printWidth: 80
=====================================input======================================
var x = 0;
// errors
1 ++;
(1)++;
(1)--;
++(1);
--(1);
(1 + 2)++;
(1 + 2)--;
++(1 + 2);
--(1 + 2);
(x + x)++;
(x + x)--;
++(x + x);
--(x + x);
//OK
x++;
x--;
@@ -384,28 +350,6 @@ x[x++]++;
=====================================output=====================================
var x = 0;
// errors
1++;
1++;
1--;
++1;
--1;
(1 + 2)++;
(1 + 2)--;
++(1 + 2);
--(1 + 2);
(x + x)++;
(x + x)--;
++(x + x);
--(x + x);
//OK
x++;
x--;
22 changes: 0 additions & 22 deletions tests/format/typescript/compiler/decrementAndIncrementOperators.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,5 @@
var x = 0;

// errors
1 ++;

(1)++;
(1)--;

++(1);
--(1);

(1 + 2)++;
(1 + 2)--;

++(1 + 2);
--(1 + 2);

(x + x)++;
(x + x)--;

++(x + x);
--(x + x);

//OK
x++;
x--;

6 changes: 1 addition & 5 deletions tests/format/typescript/compiler/jsfmt.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
run_spec(import.meta, ["typescript"], {
errors: {
"babel-ts": ["decrementAndIncrementOperators.ts"],
},
});
run_spec(import.meta, ["typescript"]);
Original file line number Diff line number Diff line change
@@ -80,6 +80,10 @@ namespace X {
}
}
namespace /* module */ X {}
module /* namespace */ X {}
module /* namespace */ "x" {}
=====================================output=====================================
module X {}
@@ -113,6 +117,10 @@ namespace X {
}
}
namespace /* module */ X {}
module /* namespace */ X {}
module /* namespace */ "x" {}
================================================================================
`;

4 changes: 4 additions & 0 deletions tests/format/typescript/module/keyword.ts
Original file line number Diff line number Diff line change
@@ -29,3 +29,7 @@ namespace X {
const x = 1;
}
}

namespace /* module */ X {}
module /* namespace */ X {}
module /* namespace */ "x" {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`update-expressions.ts format 1`] = `
====================================options=====================================
parsers: ["typescript"]
printWidth: 80
| printWidth
=====================================input======================================
// https://github.com/typescript-eslint/typescript-eslint/blob/c3767edf65716be08df25723d7dbb770de0e7037/packages/ast-spec/src/expression/UpdateExpression/fixtures/valid-assignment/fixture.ts
class F {
#a;
m() {
this.#a++;
this.m().a++;
this[1] = 1;
F++;
(this.#a)++;
(<number>this.#a)++;
(this.#a satisfies number)++;
(this.#a as number)++;
this.#a!++;
}
}
=====================================output=====================================
// https://github.com/typescript-eslint/typescript-eslint/blob/c3767edf65716be08df25723d7dbb770de0e7037/packages/ast-spec/src/expression/UpdateExpression/fixtures/valid-assignment/fixture.ts
class F {
#a;
m() {
this.#a++;
this.m().a++;
this[1] = 1;
F++;
this.#a++;
(<number>this.#a)++;
(this.#a satisfies number)++;
(this.#a as number)++;
this.#a!++;
}
}
================================================================================
`;
1 change: 1 addition & 0 deletions tests/format/typescript/update-expression/jsfmt.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
run_spec(import.meta, ["typescript"]);
16 changes: 16 additions & 0 deletions tests/format/typescript/update-expression/update-expressions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// https://github.com/typescript-eslint/typescript-eslint/blob/c3767edf65716be08df25723d7dbb770de0e7037/packages/ast-spec/src/expression/UpdateExpression/fixtures/valid-assignment/fixture.ts
class F {
#a;

m() {
this.#a++;
this.m().a++;
this[1] = 1;
F++;
(this.#a)++;
(<number>this.#a)++;
(this.#a satisfies number)++;
(this.#a as number)++;
this.#a!++;
}
}
4 changes: 4 additions & 0 deletions tests/integration/__tests__/file-info.js
Original file line number Diff line number Diff line change
@@ -130,6 +130,10 @@ test("API getFileInfo with filepath only", async () => {
ignored: false,
inferredParser: "markdown",
});
await expect(prettier.getFileInfo("tsconfig.json")).resolves.toEqual({
ignored: false,
inferredParser: "jsonc",
});
});

describe("API getFileInfo resolveConfig", () => {
2 changes: 1 addition & 1 deletion website/versioned_docs/version-stable/api.md
Original file line number Diff line number Diff line change
@@ -36,7 +36,7 @@ await prettier.formatWithCursor(" 1", { cursorOffset: 2, parser: "babel" });

## `prettier.resolveConfig(fileUrlOrPath [, options])`

`resolveConfig` can be used to resolve configuration for a given source file, passing its path or url as the first argument. The config search will start at the file location and continue to search up the directory (you can use `process.cwd()` to start searching from the current directory). Or you can pass directly the path of the config file as `options.config` if you don’t wish to search for it. A promise is returned which will resolve to:
`resolveConfig` can be used to resolve configuration for a given source file, passing its path or url as the first argument. The config search will start at the directory of the file location and continue to search up the directory. Or you can pass directly the path of the config file as `options.config` if you don’t wish to search for it. A promise is returned which will resolve to:

- An options object, providing a [config file](configuration.md) was found.
- `null`, if no file was found.
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.2/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.3/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.2/standalone.js"></script>
<script src="https://unpkg.com/prettier@3.2.2/plugins/graphql.js"></script>
<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>
(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.2/standalone.mjs";
import prettierPluginGraphql from "https://unpkg.com/prettier@3.2.2/plugins/graphql.mjs";
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";
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.2/standalone.js",
"https://unpkg.com/prettier@3.2.2/plugins/graphql.js",
"https://unpkg.com/prettier@3.2.3/standalone.js",
"https://unpkg.com/prettier@3.2.3/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.2/standalone.js");
importScripts("https://unpkg.com/prettier@3.2.2/plugins/graphql.js");
importScripts("https://unpkg.com/prettier@3.2.3/standalone.js");
importScripts("https://unpkg.com/prettier@3.2.3/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.2/standalone.mjs";
import prettierPluginBabel from "https://unpkg.com/prettier@3.2.2/plugins/babel.mjs";
import prettierPluginEstree from "https://unpkg.com/prettier@3.2.2/plugins/estree.mjs";
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";
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.2/standalone.mjs";
import prettierPluginBabel from "https://unpkg.com/prettier@3.2.2/plugins/babel.mjs";
import prettierPluginEstree from "https://unpkg.com/prettier@3.2.2/plugins/estree.mjs";
import prettierPluginHtml from "https://unpkg.com/prettier@3.2.2/plugins/html.mjs";
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";
console.log(
await prettier.format("const html=/* HTML */ `<DIV> </DIV>`", {
120 changes: 60 additions & 60 deletions yarn.lock
Original file line number Diff line number Diff line change
@@ -1966,15 +1966,15 @@ __metadata:
languageName: node
linkType: hard

"@typescript-eslint/eslint-plugin@npm:6.17.0":
version: 6.17.0
resolution: "@typescript-eslint/eslint-plugin@npm:6.17.0"
"@typescript-eslint/eslint-plugin@npm:6.19.0":
version: 6.19.0
resolution: "@typescript-eslint/eslint-plugin@npm:6.19.0"
dependencies:
"@eslint-community/regexpp": "npm:^4.5.1"
"@typescript-eslint/scope-manager": "npm:6.17.0"
"@typescript-eslint/type-utils": "npm:6.17.0"
"@typescript-eslint/utils": "npm:6.17.0"
"@typescript-eslint/visitor-keys": "npm:6.17.0"
"@typescript-eslint/scope-manager": "npm:6.19.0"
"@typescript-eslint/type-utils": "npm:6.19.0"
"@typescript-eslint/utils": "npm:6.19.0"
"@typescript-eslint/visitor-keys": "npm:6.19.0"
debug: "npm:^4.3.4"
graphemer: "npm:^1.4.0"
ignore: "npm:^5.2.4"
@@ -1987,7 +1987,7 @@ __metadata:
peerDependenciesMeta:
typescript:
optional: true
checksum: f2a5774e9cc03e491a5a488501e5622c7eebd766f5a4fc2c30642864a3b89b0807946bde33a678f326ba7032f3f6a51aa0bf9c2d10adc823804fc9fb47db55a6
checksum: 5ed8483d792c4bc6ed697159c84a47ba5c35cd124949883813f2053b972537de3900a7ae26d4d6f370194f2cc7929baa2d09268e0b90118f20ed961cf6c176b9
languageName: node
linkType: hard

@@ -2001,30 +2001,30 @@ __metadata:
languageName: node
linkType: hard

"@typescript-eslint/scope-manager@npm:6.17.0":
version: 6.17.0
resolution: "@typescript-eslint/scope-manager@npm:6.17.0"
"@typescript-eslint/scope-manager@npm:6.19.0":
version: 6.19.0
resolution: "@typescript-eslint/scope-manager@npm:6.19.0"
dependencies:
"@typescript-eslint/types": "npm:6.17.0"
"@typescript-eslint/visitor-keys": "npm:6.17.0"
checksum: fe09c628553c9336e6a36d32c1d34e78ebd20aa02130a6bf535329621ba5a98aaac171f607bc6e4d17b3478c42e7de6476376636897ce3f227c754eb99acd07e
"@typescript-eslint/types": "npm:6.19.0"
"@typescript-eslint/visitor-keys": "npm:6.19.0"
checksum: d36c51c05e14c51ce13181120eeea46d1edd59ed1ff16dc4ec1f5532a975b5faec5c10a373aaa90545f82a12330c6cba18ecedc734e18288f5874855c48ba808
languageName: node
linkType: hard

"@typescript-eslint/type-utils@npm:6.17.0":
version: 6.17.0
resolution: "@typescript-eslint/type-utils@npm:6.17.0"
"@typescript-eslint/type-utils@npm:6.19.0":
version: 6.19.0
resolution: "@typescript-eslint/type-utils@npm:6.19.0"
dependencies:
"@typescript-eslint/typescript-estree": "npm:6.17.0"
"@typescript-eslint/utils": "npm:6.17.0"
"@typescript-eslint/typescript-estree": "npm:6.19.0"
"@typescript-eslint/utils": "npm:6.19.0"
debug: "npm:^4.3.4"
ts-api-utils: "npm:^1.0.1"
peerDependencies:
eslint: ^7.0.0 || ^8.0.0
peerDependenciesMeta:
typescript:
optional: true
checksum: dc7938429193acfda61b7282197ec046039e2c4da41cdcddf4daaf300d10229e4e23bb0fcf0503b19c0b99a874849c8a9f5bb35ce106260f56a14106d2b41d8c
checksum: f1f20ac28c03dd18546050b63ec0b0fd8c67780265ccb9ef566f16441c3de5deb2607a6046fefdebe8a43ac11fecdf0b009f8e5f70a3d15916d855be74b0f3bb
languageName: node
linkType: hard

@@ -2035,10 +2035,10 @@ __metadata:
languageName: node
linkType: hard

"@typescript-eslint/types@npm:6.17.0":
version: 6.17.0
resolution: "@typescript-eslint/types@npm:6.17.0"
checksum: 87ab1b5a3270ab34b917c22a2fb90a9ad7d9f3b19d73a337bc9efbe65f924da13482c97e8ccbe3bd3d081aa96039eeff50de41c1da2a2128066429b931cdb21d
"@typescript-eslint/types@npm:6.19.0":
version: 6.19.0
resolution: "@typescript-eslint/types@npm:6.19.0"
checksum: 396ad2ad9f2d759dd87bc880a1ffc9d11fda04db8af9402abb4e8eccd58c01fa2d26e38b186526d0b457012f7c912e7afdab2a3798a73aa0ae34abaf50d617ae
languageName: node
linkType: hard

@@ -2060,12 +2060,12 @@ __metadata:
languageName: node
linkType: hard

"@typescript-eslint/typescript-estree@npm:6.17.0":
version: 6.17.0
resolution: "@typescript-eslint/typescript-estree@npm:6.17.0"
"@typescript-eslint/typescript-estree@npm:6.19.0":
version: 6.19.0
resolution: "@typescript-eslint/typescript-estree@npm:6.19.0"
dependencies:
"@typescript-eslint/types": "npm:6.17.0"
"@typescript-eslint/visitor-keys": "npm:6.17.0"
"@typescript-eslint/types": "npm:6.19.0"
"@typescript-eslint/visitor-keys": "npm:6.19.0"
debug: "npm:^4.3.4"
globby: "npm:^11.1.0"
is-glob: "npm:^4.0.3"
@@ -2075,24 +2075,24 @@ __metadata:
peerDependenciesMeta:
typescript:
optional: true
checksum: 1671b0d2f2fdf07074fb1e2524d61935cec173bd8db6e482cc5b2dcc77aed3ffa831396736ffa0ee2fdbddd8585ae9ca8d6c97bcaea1385b23907a1ec0508f83
checksum: 06e24bb145a302299a6cf86b36652bd4d7080c4e88517ebc24bdc137c57425a68db256ba628ce16b568bfec8020ae2a748ccee93e304efeded329cb3292b17bf
languageName: node
linkType: hard

"@typescript-eslint/utils@npm:6.17.0":
version: 6.17.0
resolution: "@typescript-eslint/utils@npm:6.17.0"
"@typescript-eslint/utils@npm:6.19.0":
version: 6.19.0
resolution: "@typescript-eslint/utils@npm:6.19.0"
dependencies:
"@eslint-community/eslint-utils": "npm:^4.4.0"
"@types/json-schema": "npm:^7.0.12"
"@types/semver": "npm:^7.5.0"
"@typescript-eslint/scope-manager": "npm:6.17.0"
"@typescript-eslint/types": "npm:6.17.0"
"@typescript-eslint/typescript-estree": "npm:6.17.0"
"@typescript-eslint/scope-manager": "npm:6.19.0"
"@typescript-eslint/types": "npm:6.19.0"
"@typescript-eslint/typescript-estree": "npm:6.19.0"
semver: "npm:^7.5.4"
peerDependencies:
eslint: ^7.0.0 || ^8.0.0
checksum: 37c63afcf66124bf84808699997953b8c84a378aa2c490a771b611d82cdac8499c58fac8eeb8378528e97660b59563d99297bfec4b982cd68760b0ffe54aa714
checksum: 4080c36331204ffef9f218e29f43da767f17551fa4d3877c3d3b49194f7c7382dd9ae2124e7b5ebd47d5556946bb6ad195b47d7d215553efabacdebf81b9e74d
languageName: node
linkType: hard

@@ -2124,13 +2124,13 @@ __metadata:
languageName: node
linkType: hard

"@typescript-eslint/visitor-keys@npm:6.17.0":
version: 6.17.0
resolution: "@typescript-eslint/visitor-keys@npm:6.17.0"
"@typescript-eslint/visitor-keys@npm:6.19.0":
version: 6.19.0
resolution: "@typescript-eslint/visitor-keys@npm:6.19.0"
dependencies:
"@typescript-eslint/types": "npm:6.17.0"
"@typescript-eslint/types": "npm:6.19.0"
eslint-visitor-keys: "npm:^3.4.1"
checksum: a2aed0e1437fdab8858ab9c7c8e355f8b72a5fa4b0adc54f28b8a2bbc29d4bb93214968ee940f83d013d0a4b83d00cd4eeeb05fb4c2c7d0ead324c6793f7d6d4
checksum: 8d51c0b8d94c5df044fde958f62741cef55be97c6a3a16c47e4df9af7b2ff13aa1ee03ca5240777481dca53f3b7a9b00b329e50aff5e3ad829d96bc5f63ca2c3
languageName: node
linkType: hard

@@ -2599,16 +2599,16 @@ __metadata:
languageName: node
linkType: hard

"browserslist-to-esbuild@npm:2.1.0":
version: 2.1.0
resolution: "browserslist-to-esbuild@npm:2.1.0"
"browserslist-to-esbuild@npm:2.1.1":
version: 2.1.1
resolution: "browserslist-to-esbuild@npm:2.1.1"
dependencies:
meow: "npm:^13.0.0"
peerDependencies:
browserslist: "*"
bin:
browserslist-to-esbuild: cli/index.js
checksum: 67a710fb24c44540e46507a41278617be7d848d1fc4a815ce5dc025e2cd113af63cf117784a74df24e019f9d1c64190498853813e0259cd89b6ab517214f1c60
checksum: 5e91b23ba5ac47412b7456bbb74ee11b35d1083163e9e8e001e48f3a975c65758a4559ab532812d8518877a1d8f68c5b649b88a08722b9543b38e633e6943f7d
languageName: node
linkType: hard

@@ -4375,10 +4375,10 @@ __metadata:
languageName: node
linkType: hard

"flow-parser@npm:0.225.1":
version: 0.225.1
resolution: "flow-parser@npm:0.225.1"
checksum: 9de425b5f97bf25b632eafce5af5398fe04411d9f6247236801fd1a3709ba28b00c12d123e79fdb183952be135009f2594278cc3b7aea6d0b673397c7f4bfb26
"flow-parser@npm:0.226.0":
version: 0.226.0
resolution: "flow-parser@npm:0.226.0"
checksum: d92248658fbf963131d98a2b8438b948391d2e6bfe23243ef81a2017adb080257072e21fc69f060189f0bae57b4d6abcbf2b118a76c3ef626c4712917c2e9010
languageName: node
linkType: hard

@@ -7317,12 +7317,12 @@ __metadata:
languageName: node
linkType: hard

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

@@ -7348,16 +7348,16 @@ __metadata:
"@types/file-entry-cache": "npm:5.0.4"
"@types/find-cache-dir": "npm:3.2.1"
"@types/jest": "npm:29.5.8"
"@typescript-eslint/eslint-plugin": "npm:6.17.0"
"@typescript-eslint/typescript-estree": "npm:6.17.0"
"@typescript-eslint/visitor-keys": "npm:6.17.0"
"@typescript-eslint/eslint-plugin": "npm:6.19.0"
"@typescript-eslint/typescript-estree": "npm:6.19.0"
"@typescript-eslint/visitor-keys": "npm:6.19.0"
acorn: "npm:8.11.3"
acorn-jsx: "npm:5.3.2"
angular-estree-parser: "npm:9.0.0"
angular-html-parser: "npm:5.2.0"
benchmark: "npm:2.1.4"
browserslist: "npm:4.22.2"
browserslist-to-esbuild: "npm:2.1.0"
browserslist-to-esbuild: "npm:2.1.1"
c8: "npm:9.0.0"
camelcase: "npm:8.0.0"
chalk: "npm:5.3.0"
@@ -7394,7 +7394,7 @@ __metadata:
fast-json-stable-stringify: "npm:2.1.0"
file-entry-cache: "npm:7.0.2"
find-cache-dir: "npm:5.0.0"
flow-parser: "npm:0.225.1"
flow-parser: "npm:0.226.0"
get-east-asian-width: "npm:1.2.0"
get-stdin: "npm:9.0.0"
graphql: "npm:16.8.1"
@@ -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.1"
prettier: "npm:3.2.2"
pretty-bytes: "npm:6.1.1"
regexp-util: "npm:2.0.0"
remark-footnotes: "npm:2.0.0"