-
-
Notifications
You must be signed in to change notification settings - Fork 509
added support for typescript config files #3840
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import * as assert from "node:assert"; | ||
| import { format, getText } from "./format.test"; | ||
|
|
||
| describe("TypeScript Config File Support", () => { | ||
| // This test validates TypeScript config file support added in Prettier 3.5.0 | ||
| // Should use Prettier to read TypeScript config files like prettier.config.ts | ||
| it("it formats with TypeScript prettier.config.ts", async () => { | ||
| const { actual } = await format( | ||
| "ts-config", | ||
| "index.js", | ||
| /* shouldRetry */ true, | ||
| ); | ||
| const expected = await getText("ts-config", "index.result.js"); | ||
| assert.equal(actual, expected); | ||
| }); | ||
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -53,6 +53,9 @@ | |
| }, | ||
| { | ||
| "path": "esm-config" | ||
| }, | ||
| { | ||
| "path": "ts-config" | ||
| } | ||
| ], | ||
| "settings": { | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,6 @@ | ||||||||||||
| // Test file for TypeScript config | ||||||||||||
| const example = {foo: "bar", baz: 123, qux: true}; | ||||||||||||
|
||||||||||||
| const example = {foo: "bar", baz: 123, qux: true}; |
ntotten marked this conversation as resolved.
Dismissed
Show dismissed
Hide dismissed
Copilot
AI
Nov 28, 2025
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.
Unused function hello.
| } | |
| } | |
| // Use the hello function to avoid unused function warning | |
| console.log(hello("world")); |
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,6 @@ | ||||||||
| // Test file for TypeScript config | ||||||||
| const example = { foo: 'bar', baz: 123, qux: true }; | ||||||||
ntotten marked this conversation as resolved.
Dismissed
Show dismissed
Hide dismissed
|
||||||||
| const example = { foo: 'bar', baz: 123, qux: true }; |
ntotten marked this conversation as resolved.
Dismissed
Show dismissed
Hide dismissed
Copilot
AI
Nov 28, 2025
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.
Unused function hello.
| function hello(name) { | |
| return 'Hello, ' + name + '!'; | |
| } |
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,16 @@ | ||||||||
| { | ||||||||
| "name": "ts-config", | ||||||||
| "version": "1.0.0", | ||||||||
| "description": "Test folder for TypeScript config files (Prettier 3.5.0+)", | ||||||||
| "type": "module", | ||||||||
| "private": true, | ||||||||
| "scripts": { | ||||||||
| "test": "echo \"Error: no test specified\" && exit 1" | ||||||||
| }, | ||||||||
| "author": "Prettier", | ||||||||
| "license": "MIT", | ||||||||
| "devDependencies": { | ||||||||
| "prettier": "^3.5.0" | ||||||||
| }, | ||||||||
| "dependencies": {} | ||||||||
|
Comment on lines
+14
to
+15
|
||||||||
| }, | |
| "dependencies": {} | |
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| // TypeScript config file - requires Prettier 3.5.0+ to parse | ||
| import type { Config } from "prettier"; | ||
|
|
||
| const config: Config = { | ||
| tabWidth: 4, | ||
| singleQuote: true, | ||
| trailingComma: "es5", | ||
| }; | ||
|
|
||
| export default config; |
Uh oh!
There was an error while loading. Please reload this page.