Skip to content

feat(prettier): generate prettier.config.{js,ts} instead of .prettierrc#1145

Draft
jycouet wants to merge 2 commits into
mainfrom
prettier-autocompletition
Draft

feat(prettier): generate prettier.config.{js,ts} instead of .prettierrc#1145
jycouet wants to merge 2 commits into
mainfrom
prettier-autocompletition

Conversation

@jycouet

@jycouet jycouet commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Closes #1095

Description

Replaces the .prettierrc JSON file with a generated prettier.config.js (with a JSDoc @type {import("prettier").Config}), giving editor autocompletion on the config.

  • Always .js, even for TS projects: a prettier.config.ts can't be loaded by the VSCode prettier extension unless its Electron Node is recent enough to strip types (see prettier/prettier-vscode#3989). A .js config resolves everywhere - CLI, CI and editors.
  • tailwindcss augments the config (plugin + tailwindStylesheet) when prettier was added first.

Checklist

  • Update snapshots (if applicable)
  • Add a changeset (if applicable)
  • Allow maintainers to edit this PR
  • I care about what I'm doing, no matter the tool I use (Notepad, Sublime, VSCode, AI...)

…`.prettierrc`, giving type-checked config and editor autocompletion
@changeset-bot

changeset-bot Bot commented Jun 20, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 93803ed

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
sv Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@svelte-docs-bot

Copy link
Copy Markdown

@manuel3108

Copy link
Copy Markdown
Member

This works as expected. Any reason this is still a draft? If not, please see this as an approval!

@jycouet

jycouet commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

In the past I had issues with vscode prettier plugin that couldn't figure out .js or .mjs or .cjs... I would like to test it more :p
I'll do that today 🤞

Drop the `.ts` config variant. A `prettier.config.ts` can't be loaded by the
VSCode prettier extension unless its Electron Node is recent enough to strip
types (see prettier/prettier-vscode#3989), so emit `.js` with a JSDoc `@type`
for every project - works in the CLI, CI and editors alike.
@jycouet

jycouet commented Jun 27, 2026

Copy link
Copy Markdown
Contributor Author

I think that .ts is have more issues, here is a test with only .js WDYT ? also @hyunbinseo ? @sacrosanctic ?

@hyunbinseo

Copy link
Copy Markdown
Contributor

I am fine as long as the config supports type checking.

I mean we've been limited to svelte.config.js until recently, and it was fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

prettier autocompletition

3 participants