-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Allow const without initializer in babel-ts
parser
#17650
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fisker
commented
Jun 23, 2025
src/language-js/parse/babel.js
Outdated
appendPlugins(["jsx", "typescript"]), | ||
appendPlugins(["typescript"]), | ||
appendPlugins(["jsx", ["typescript", { dts: true }]]), | ||
appendPlugins([["typescript", { dts: true }]]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is required for babelTSExpression
parser bellow.
commit: |
✅ Deploy Preview for prettier ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
dts: true
to babel's typescript
pluginbabel-ts
parser
sosukesuzuki
approved these changes
Jun 23, 2025
apricote
pushed a commit
to hetznercloud/fleeting-plugin-hetzner
that referenced
this pull request
Jul 4, 2025
…fleeting-plugin-hetzner!256) This MR contains the following updates: | Package | Change | Age | Confidence | |---|---|---|---| | [prettier](https://prettier.io) ([source](https://github.com/prettier/prettier)) | `3.3.3` -> `3.6.2` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | Note: The `pre-commit` manager in Renovate is not supported by the `pre-commit` maintainers or community. Please do not report any problems there, instead [create a Discussion in the Renovate repository](https://github.com/renovatebot/renovate/discussions/new) if you have any questions. --- ### Release Notes <details> <summary>prettier/prettier (prettier)</summary> ### [`v3.6.2`](https://github.com/prettier/prettier/blob/HEAD/CHANGELOG.md#362) [Compare Source](prettier/prettier@3.6.1...3.6.2) [diff](prettier/prettier@3.6.1...3.6.2) ##### Markdown: Add missing blank line around code block ([#​17675](prettier/prettier#17675) by [@​fisker](https://github.com/fisker)) <!-- prettier-ignore --> ````md <!-- Input --> 1. Some text, and code block below, with newline after code block ```yaml --- foo: bar ``` 1. Another 2. List <!-- Prettier 3.6.1 --> 1. Some text, and code block below, with newline after code block ```yaml --- foo: bar ``` 1. Another 2. List <!-- Prettier 3.6.2 --> 1. Some text, and code block below, with newline after code block ```yaml --- foo: bar ``` 1. Another 2. List ```` ### [`v3.6.1`](https://github.com/prettier/prettier/blob/HEAD/CHANGELOG.md#361) [Compare Source](prettier/prettier@3.6.0...3.6.1) [diff](prettier/prettier@3.6.0...3.6.1) ##### TypeScript: Allow const without initializer ([#​17650](prettier/prettier#17650), [#​17654](prettier/prettier#17654) by [@​fisker](https://github.com/fisker)) <!-- prettier-ignore --> ```jsx // Input export const version: string; // Prettier 3.6.0 (--parser=babel-ts) SyntaxError: Unexpected token (1:21) > 1 | export const version: string; | ^ // Prettier 3.6.0 (--parser=oxc-ts) SyntaxError: Missing initializer in const declaration (1:14) > 1 | export const version: string; | ^^^^^^^^^^^^^^^ // Prettier 3.6.1 export const version: string; ``` ##### Miscellaneous: Avoid closing files multiple times ([#​17665](prettier/prettier#17665) by [@​43081j](https://github.com/43081j)) When reading a file to infer the interpreter from a shebang, we use the `n-readlines` library to read the first line in order to get the shebang. This library closes files when it reaches EOF, and we later try close the same files again. We now close files only if `n-readlines` did not already close them. ### [`v3.6.0`](https://github.com/prettier/prettier/blob/HEAD/CHANGELOG.md#360) [Compare Source](prettier/prettier@3.5.3...3.6.0) [diff](prettier/prettier@3.5.3...3.6.0) 🔗 [Release Notes](https://prettier.io/blog/2025/06/23/3.6.0) ### [`v3.5.3`](https://github.com/prettier/prettier/blob/HEAD/CHANGELOG.md#353) [Compare Source](prettier/prettier@3.5.2...3.5.3) [diff](prettier/prettier@3.5.2...3.5.3) ##### Flow: Fix missing parentheses in `ConditionalTypeAnnotation` ([#​17196](prettier/prettier#17196) by [@​fisker](https://github.com/fisker)) <!-- prettier-ignore --> ```jsx // Input type T<U> = 'a' | ('b' extends U ? 'c' : empty); type T<U> = 'a' & ('b' extends U ? 'c' : empty); // Prettier 3.5.2 type T<U> = "a" | "b" extends U ? "c" : empty; type T<U> = "a" & "b" extends U ? "c" : empty; // Prettier 3.5.3 type T<U> = "a" | ("b" extends U ? "c" : empty); type T<U> = "a" & ("b" extends U ? "c" : empty); ``` ### [`v3.5.2`](https://github.com/prettier/prettier/blob/HEAD/CHANGELOG.md#352) [Compare Source](prettier/prettier@3.5.1...3.5.2) [diff](prettier/prettier@3.5.1...3.5.2) ##### Remove `module-sync` condition ([#​17156](prettier/prettier#17156) by [@​fisker](https://github.com/fisker)) In Prettier 3.5.0, [we added `module-sync` condition to `package.json`](https://prettier.io/blog/2025/02/09/3.5.0#use-esm-entrypoint-for-requireesm-16958-by-tats-u), so that `require("prettier")` can use ESM version, but turns out it doesn't work if CommonJS and ESM plugins both imports builtin plugins. To solve this problem, we decide simply remove the `module-sync` condition, so `require("prettier")` will still use the CommonJS version, we'll revisit until `require(ESM)` feature is more stable. ### [`v3.5.1`](https://github.com/prettier/prettier/blob/HEAD/CHANGELOG.md#351) [Compare Source](prettier/prettier@3.5.0...3.5.1) [diff](prettier/prettier@3.5.0...3.5.1) ##### Fix CLI crash when cache for old version exists ([#​17100](prettier/prettier#17100) by [@​sosukesuzuki](https://github.com/sosukesuzuki)) Prettier 3.5 uses a different cache format than previous versions, Prettier 3.5.0 crashes when reading existing cache file, Prettier 3.5.1 fixed the problem. ##### Support dockercompose and github-actions-workflow in VSCode ([#​17101](prettier/prettier#17101) by [@​remcohaszing](https://github.com/remcohaszing)) Prettier now supports the `dockercompose` and `github-actions-workflow` languages in Visual Studio Code. ### [`v3.5.0`](https://github.com/prettier/prettier/blob/HEAD/CHANGELOG.md#350) [Compare Source](prettier/prettier@3.4.2...3.5.0) [diff](prettier/prettier@3.4.2...3.5.0) 🔗 [Release Notes](https://prettier.io/blog/2025/02/09/3.5.0.html) ### [`v3.4.2`](https://github.com/prettier/prettier/blob/HEAD/CHANGELOG.md#342) [Compare Source](prettier/prettier@3.4.1...3.4.2) [diff](prettier/prettier@3.4.1...3.4.2) ##### Treat U+30A0 & U+30FB in Katakana Block as CJK ([#​16796](prettier/prettier#16796) by [@​tats-u](https://github.com/tats-u)) Prettier doesn't treat U+30A0 & U+30FB as Japanese. U+30FB is commonly used in Japanese to represent the delimitation of first and last names of non-Japanese people or “and”. The following “C言語・C++・Go・Rust” means “C language & C++ & Go & Rust” in Japanese. <!-- prettier-ignore --> ```md <!-- Input (--prose-wrap=never) --> C言 語 ・ C++ ・ Go ・ Rust <!-- Prettier 3.4.1 --> C言語・ C++ ・ Go ・ Rust <!-- Prettier 3.4.2 --> C言語・C++・Go・Rust ``` U+30A0 can be used as the replacement of the `-` in non-Japanese names (e.g. “Saint-Saëns” (Charles Camille Saint-Saëns) can be represented as “サン゠サーンス” in Japanese), but substituted by ASCII hyphen (U+002D) or U+FF1D (full width hyphen) in many cases (e.g. “サン=サーンス” or “サン=サーンス”). ##### Fix comments print on class methods with decorators ([#​16891](prettier/prettier#16891) by [@​fisker](https://github.com/fisker)) <!-- prettier-ignore --> ```jsx // Input class A { @​decorator /** * The method description * */ async method(foo: Foo, bar: Bar) { console.log(foo); } } // Prettier 3.4.1 class A { @​decorator async /** * The method description * */ method(foo: Foo, bar: Bar) { console.log(foo); } } // Prettier 3.4.2 class A { @​decorator /** * The method description * */ async method(foo: Foo, bar: Bar) { console.log(foo); } } ``` ##### Fix non-idempotent formatting ([#​16899](prettier/prettier#16899) by [@​seiyab](https://github.com/seiyab)) This bug fix is not language-specific. You may see similar change in any languages. This fixes regression in 3.4.0 so change caused by it should yield same formatting as 3.3.3. <!-- prettier-ignore --> ```jsx // Input <div> foo <span>longlonglonglonglonglonglonglonglonglonglonglonglonglonglongl foo</span> , abc </div>; // Prettier 3.4.1 (first) <div> foo <span> longlonglonglonglonglonglonglonglonglonglonglonglonglonglongl foo </span>, abc </div>; // Prettier 3.4.1 (second) <div> foo <span>longlonglonglonglonglonglonglonglonglonglonglonglonglonglongl foo</span> , abc </div>; // Prettier 3.4.2 <div> foo <span>longlonglonglonglonglonglonglonglonglonglonglonglonglonglongl foo</span> , abc </div>; ``` ### [`v3.4.1`](https://github.com/prettier/prettier/blob/HEAD/CHANGELOG.md#341) [Compare Source](prettier/prettier@3.4.0...3.4.1) [diff](prettier/prettier@3.4.0...3.4.1) ##### Remove unnecessary parentheses around assignment in `v-on` ([#​16887](prettier/prettier#16887) by [@​fisker](https://github.com/fisker)) <!-- prettier-ignore --> ```vue <!-- Input --> <template> <button @​click="foo += 2">Click</button> </template> <!-- Prettier 3.4.0 --> <template> <button @​click="(foo += 2)">Click</button> </template> <!-- Prettier 3.4.1 --> <template> <button @​click="foo += 2">Click</button> </template> ``` ### [`v3.4.0`](https://github.com/prettier/prettier/blob/HEAD/CHANGELOG.md#340) [Compare Source](prettier/prettier@3.3.3...3.4.0) [diff](prettier/prettier@3.3.3...3.4.0) 🔗 [Release Notes](https://prettier.io/blog/2024/11/26/3.4.0.html) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever MR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xOS4wIiwidXBkYXRlZEluVmVyIjoiNDEuMTkuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->
renovate bot
added a commit
to andrei-picus-tink/auto-renovate
that referenced
this pull request
Jul 13, 2025
| datasource | package | from | to | | ---------- | -------- | ----- | ----- | | npm | prettier | 3.5.3 | 3.6.2 | ## [v3.6.2](https://github.com/prettier/prettier/blob/HEAD/CHANGELOG.md#362) [diff](prettier/prettier@3.6.1...3.6.2) ##### Markdown: Add missing blank line around code block ([#17675](prettier/prettier#17675) by [@fisker](https://github.com/fisker)) <!-- prettier-ignore --> ````md <!-- Input --> 1. Some text, and code block below, with newline after code block ```yaml --- foo: bar ``` 1. Another 2. List <!-- Prettier 3.6.1 --> 1. Some text, and code block below, with newline after code block ```yaml --- foo: bar ``` 1. Another 2. List <!-- Prettier 3.6.2 --> 1. Some text, and code block below, with newline after code block ```yaml --- foo: bar ``` 1. Another 2. List ```` ## [v3.6.1](https://github.com/prettier/prettier/blob/HEAD/CHANGELOG.md#361) [diff](prettier/prettier@3.6.0...3.6.1) ##### TypeScript: Allow const without initializer ([#17650](prettier/prettier#17650), [#17654](prettier/prettier#17654) by [@fisker](https://github.com/fisker)) <!-- prettier-ignore --> ```jsx // Input export const version: string; // Prettier 3.6.0 (--parser=babel-ts) SyntaxError: Unexpected token (1:21) > 1 | export const version: string; | ^ // Prettier 3.6.0 (--parser=oxc-ts) SyntaxError: Missing initializer in const declaration (1:14) > 1 | export const version: string; | ^^^^^^^^^^^^^^^ // Prettier 3.6.1 export const version: string; ``` ##### Miscellaneous: Avoid closing files multiple times ([#17665](prettier/prettier#17665) by [@43081j](https://github.com/43081j)) When reading a file to infer the interpreter from a shebang, we use the `n-readlines` library to read the first line in order to get the shebang. This library closes files when it reaches EOF, and we later try close the same files again. We now close files only if `n-readlines` did not already close them. ## [v3.6.0](https://github.com/prettier/prettier/blob/HEAD/CHANGELOG.md#360) [diff](prettier/prettier@3.5.3...3.6.0) 🔗 [Release Notes](https://prettier.io/blog/2025/06/23/3.6.0)
renovate bot
added a commit
to andrei-picus-tink/auto-renovate
that referenced
this pull request
Jul 27, 2025
| datasource | package | from | to | | ---------- | -------- | ----- | ----- | | npm | prettier | 3.5.3 | 3.6.2 | ## [v3.6.2](https://github.com/prettier/prettier/blob/HEAD/CHANGELOG.md#362) [diff](prettier/prettier@3.6.1...3.6.2) ##### Markdown: Add missing blank line around code block ([#17675](prettier/prettier#17675) by [@fisker](https://github.com/fisker)) <!-- prettier-ignore --> ````md <!-- Input --> 1. Some text, and code block below, with newline after code block ```yaml --- foo: bar ``` 1. Another 2. List <!-- Prettier 3.6.1 --> 1. Some text, and code block below, with newline after code block ```yaml --- foo: bar ``` 1. Another 2. List <!-- Prettier 3.6.2 --> 1. Some text, and code block below, with newline after code block ```yaml --- foo: bar ``` 1. Another 2. List ```` ## [v3.6.1](https://github.com/prettier/prettier/blob/HEAD/CHANGELOG.md#361) [diff](prettier/prettier@3.6.0...3.6.1) ##### TypeScript: Allow const without initializer ([#17650](prettier/prettier#17650), [#17654](prettier/prettier#17654) by [@fisker](https://github.com/fisker)) <!-- prettier-ignore --> ```jsx // Input export const version: string; // Prettier 3.6.0 (--parser=babel-ts) SyntaxError: Unexpected token (1:21) > 1 | export const version: string; | ^ // Prettier 3.6.0 (--parser=oxc-ts) SyntaxError: Missing initializer in const declaration (1:14) > 1 | export const version: string; | ^^^^^^^^^^^^^^^ // Prettier 3.6.1 export const version: string; ``` ##### Miscellaneous: Avoid closing files multiple times ([#17665](prettier/prettier#17665) by [@43081j](https://github.com/43081j)) When reading a file to infer the interpreter from a shebang, we use the `n-readlines` library to read the first line in order to get the shebang. This library closes files when it reaches EOF, and we later try close the same files again. We now close files only if `n-readlines` did not already close them. ## [v3.6.0](https://github.com/prettier/prettier/blob/HEAD/CHANGELOG.md#360) [diff](prettier/prettier@3.5.3...3.6.0) 🔗 [Release Notes](https://prettier.io/blog/2025/06/23/3.6.0)
renovate bot
added a commit
to andrei-picus-tink/auto-renovate
that referenced
this pull request
Aug 4, 2025
| datasource | package | from | to | | ---------- | -------- | ----- | ----- | | npm | prettier | 3.5.3 | 3.6.2 | ## [v3.6.2](https://github.com/prettier/prettier/blob/HEAD/CHANGELOG.md#362) [diff](prettier/prettier@3.6.1...3.6.2) ##### Markdown: Add missing blank line around code block ([#17675](prettier/prettier#17675) by [@fisker](https://github.com/fisker)) <!-- prettier-ignore --> ````md <!-- Input --> 1. Some text, and code block below, with newline after code block ```yaml --- foo: bar ``` 1. Another 2. List <!-- Prettier 3.6.1 --> 1. Some text, and code block below, with newline after code block ```yaml --- foo: bar ``` 1. Another 2. List <!-- Prettier 3.6.2 --> 1. Some text, and code block below, with newline after code block ```yaml --- foo: bar ``` 1. Another 2. List ```` ## [v3.6.1](https://github.com/prettier/prettier/blob/HEAD/CHANGELOG.md#361) [diff](prettier/prettier@3.6.0...3.6.1) ##### TypeScript: Allow const without initializer ([#17650](prettier/prettier#17650), [#17654](prettier/prettier#17654) by [@fisker](https://github.com/fisker)) <!-- prettier-ignore --> ```jsx // Input export const version: string; // Prettier 3.6.0 (--parser=babel-ts) SyntaxError: Unexpected token (1:21) > 1 | export const version: string; | ^ // Prettier 3.6.0 (--parser=oxc-ts) SyntaxError: Missing initializer in const declaration (1:14) > 1 | export const version: string; | ^^^^^^^^^^^^^^^ // Prettier 3.6.1 export const version: string; ``` ##### Miscellaneous: Avoid closing files multiple times ([#17665](prettier/prettier#17665) by [@43081j](https://github.com/43081j)) When reading a file to infer the interpreter from a shebang, we use the `n-readlines` library to read the first line in order to get the shebang. This library closes files when it reaches EOF, and we later try close the same files again. We now close files only if `n-readlines` did not already close them. ## [v3.6.0](https://github.com/prettier/prettier/blob/HEAD/CHANGELOG.md#360) [diff](prettier/prettier@3.5.3...3.6.0) 🔗 [Release Notes](https://prettier.io/blog/2025/06/23/3.6.0)
renovate bot
added a commit
to andrei-picus-tink/auto-renovate
that referenced
this pull request
Aug 5, 2025
| datasource | package | from | to | | ---------- | -------- | ----- | ----- | | npm | prettier | 3.5.3 | 3.6.2 | ## [v3.6.2](https://github.com/prettier/prettier/blob/HEAD/CHANGELOG.md#362) [diff](prettier/prettier@3.6.1...3.6.2) ##### Markdown: Add missing blank line around code block ([#17675](prettier/prettier#17675) by [@fisker](https://github.com/fisker)) <!-- prettier-ignore --> ````md <!-- Input --> 1. Some text, and code block below, with newline after code block ```yaml --- foo: bar ``` 1. Another 2. List <!-- Prettier 3.6.1 --> 1. Some text, and code block below, with newline after code block ```yaml --- foo: bar ``` 1. Another 2. List <!-- Prettier 3.6.2 --> 1. Some text, and code block below, with newline after code block ```yaml --- foo: bar ``` 1. Another 2. List ```` ## [v3.6.1](https://github.com/prettier/prettier/blob/HEAD/CHANGELOG.md#361) [diff](prettier/prettier@3.6.0...3.6.1) ##### TypeScript: Allow const without initializer ([#17650](prettier/prettier#17650), [#17654](prettier/prettier#17654) by [@fisker](https://github.com/fisker)) <!-- prettier-ignore --> ```jsx // Input export const version: string; // Prettier 3.6.0 (--parser=babel-ts) SyntaxError: Unexpected token (1:21) > 1 | export const version: string; | ^ // Prettier 3.6.0 (--parser=oxc-ts) SyntaxError: Missing initializer in const declaration (1:14) > 1 | export const version: string; | ^^^^^^^^^^^^^^^ // Prettier 3.6.1 export const version: string; ``` ##### Miscellaneous: Avoid closing files multiple times ([#17665](prettier/prettier#17665) by [@43081j](https://github.com/43081j)) When reading a file to infer the interpreter from a shebang, we use the `n-readlines` library to read the first line in order to get the shebang. This library closes files when it reaches EOF, and we later try close the same files again. We now close files only if `n-readlines` did not already close them. ## [v3.6.0](https://github.com/prettier/prettier/blob/HEAD/CHANGELOG.md#360) [diff](prettier/prettier@3.5.3...3.6.0) 🔗 [Release Notes](https://prettier.io/blog/2025/06/23/3.6.0)
renovate bot
added a commit
to andrei-picus-tink/auto-renovate
that referenced
this pull request
Aug 6, 2025
| datasource | package | from | to | | ---------- | -------- | ----- | ----- | | npm | prettier | 3.5.3 | 3.6.2 | ## [v3.6.2](https://github.com/prettier/prettier/blob/HEAD/CHANGELOG.md#362) [diff](prettier/prettier@3.6.1...3.6.2) ##### Markdown: Add missing blank line around code block ([#17675](prettier/prettier#17675) by [@fisker](https://github.com/fisker)) <!-- prettier-ignore --> ````md <!-- Input --> 1. Some text, and code block below, with newline after code block ```yaml --- foo: bar ``` 1. Another 2. List <!-- Prettier 3.6.1 --> 1. Some text, and code block below, with newline after code block ```yaml --- foo: bar ``` 1. Another 2. List <!-- Prettier 3.6.2 --> 1. Some text, and code block below, with newline after code block ```yaml --- foo: bar ``` 1. Another 2. List ```` ## [v3.6.1](https://github.com/prettier/prettier/blob/HEAD/CHANGELOG.md#361) [diff](prettier/prettier@3.6.0...3.6.1) ##### TypeScript: Allow const without initializer ([#17650](prettier/prettier#17650), [#17654](prettier/prettier#17654) by [@fisker](https://github.com/fisker)) <!-- prettier-ignore --> ```jsx // Input export const version: string; // Prettier 3.6.0 (--parser=babel-ts) SyntaxError: Unexpected token (1:21) > 1 | export const version: string; | ^ // Prettier 3.6.0 (--parser=oxc-ts) SyntaxError: Missing initializer in const declaration (1:14) > 1 | export const version: string; | ^^^^^^^^^^^^^^^ // Prettier 3.6.1 export const version: string; ``` ##### Miscellaneous: Avoid closing files multiple times ([#17665](prettier/prettier#17665) by [@43081j](https://github.com/43081j)) When reading a file to infer the interpreter from a shebang, we use the `n-readlines` library to read the first line in order to get the shebang. This library closes files when it reaches EOF, and we later try close the same files again. We now close files only if `n-readlines` did not already close them. ## [v3.6.0](https://github.com/prettier/prettier/blob/HEAD/CHANGELOG.md#360) [diff](prettier/prettier@3.5.3...3.6.0) 🔗 [Release Notes](https://prettier.io/blog/2025/06/23/3.6.0)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Part of #17649
Checklist
docs/
directory).changelog_unreleased/*/XXXX.md
file followingchangelog_unreleased/TEMPLATE.md
.