Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds support for TypeScript configuration files introduced in Prettier 3.5.0, allowing the extension to recognize and watch .prettierrc.ts, .prettierrc.cts, .prettierrc.mts, prettier.config.ts, prettier.config.cts, and prettier.config.mts files. This extends the existing support for JavaScript config files to include their TypeScript equivalents.
Key Changes:
- Extended
PRETTIER_CONFIG_FILESarray to include all TypeScript config file variants - Added comprehensive test fixture and test case to validate TypeScript config file support
- Updated workspace configuration and documentation
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
src/PrettierEditService.ts |
Added six TypeScript config file extensions to PRETTIER_CONFIG_FILES array for file system watching, maintaining logical grouping with JavaScript variants |
src/test/suite/ts-config.test.ts |
New test file validating TypeScript config file support, following established test patterns with describe/it and format helper usage |
test-fixtures/ts-config/prettier.config.ts |
TypeScript config file test fixture using typed imports and ESM syntax, specifying formatting rules (tabWidth: 4, singleQuote: true, trailingComma: "es5") |
test-fixtures/ts-config/package.json |
Test fixture package configuration with "type": "module" and Prettier 3.5.0+ dependency to enable TypeScript config parsing |
test-fixtures/ts-config/index.js |
Unformatted input file for testing config application |
test-fixtures/ts-config/index.result.js |
Expected formatted output demonstrating proper application of TypeScript config settings |
test-fixtures/test.code-workspace |
Added ts-config workspace folder to enable test execution |
CHANGELOG.md |
Documented new feature with proper attribution to contributor |
| }, | ||
| "dependencies": {} |
There was a problem hiding this comment.
[nitpick] The empty dependencies object is unnecessary and can be removed. While this pattern also exists in the v3 test fixture (test-fixtures/v3/package.json:14), other fixtures like esm-config and v2-explicit omit this empty object entirely. Consider removing it to keep the package.json minimal and consistent with fixtures that don't use it.
| }, | |
| "dependencies": {} | |
| } |
| @@ -0,0 +1,6 @@ | |||
| // Test file for TypeScript config | |||
| const example = { foo: 'bar', baz: 123, qux: true }; | |||
There was a problem hiding this comment.
Unused variable example.
| const example = { foo: 'bar', baz: 123, qux: true }; |
| function hello(name) { | ||
| return 'Hello, ' + name + '!'; | ||
| } |
There was a problem hiding this comment.
Unused function hello.
| function hello(name) { | |
| return 'Hello, ' + name + '!'; | |
| } |
| @@ -0,0 +1,6 @@ | |||
| // Test file for TypeScript config | |||
| const example = {foo: "bar", baz: 123, qux: true}; | |||
There was a problem hiding this comment.
Unused variable example.
| const example = {foo: "bar", baz: 123, qux: true}; |
|
|
||
| function hello(name) { | ||
| return "Hello, " + name + "!"; | ||
| } |
There was a problem hiding this comment.
Unused function hello.
| } | |
| } | |
| // Use the hello function to avoid unused function warning | |
| console.log(hello("world")); |
Supersedes #3775