fix: format all created project files so fresh projects pass lint#1170
fix: format all created project files so fresh projects pass lint#1170mvanhorn wants to merge 2 commits into
Conversation
|
Install the latest version of pnpm add https://pkg.svelte.dev/sv/c/1de33685a2aaef3a235e11bdd155c95cae761bd4Open in Note This PR is from a fork. A maintainer must approve approve each commit before it can be built and installed. |
🦋 Changeset detectedLatest commit: 1de3368 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
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 |
|
should wait for #1138, it also has formatting logic. |
|
Makes sense, happy to wait for #1138. Once it lands I'll rebase this on top and adapt it to use its formatting logic so there's a single code path. |
|
It's merged! |
|
We should bring this to |
|
Brought it to It's a port rather than a cherry-pick — Happy to leave this one open for the |
Closes #1134
Description
sv createnow formats all files of the generated project, not just the add-on-modified ones, sonpm run lintpasses immediately on a fresh project. Previously a SvelteKit demo + TypeScript + prettier/eslint project failed lint out of the box becausesrc/routes/sverdle/+page.sveltewas left unformatted.The root cause (per the maintainer on the issue): the ts / js-doc / js template variants are generated from one shared source by stripping types and JSDoc, which leaves formatting artifacts, and this is "not properly solvable" at the template-source level. The agreed fix is to format all created project files after creation rather than only the add-on-modified files. Dropping
prettier --checkfrom the lint script was rejected because CI users rely onlint.After project creation, the formatter now runs over the full generated project (when prettier is part of the selected add-ons) instead of only the files the add-ons touched, so stripping-induced formatting artifacts are cleaned up before the user's first
lint. Generated the reported combination (SvelteKit demo template + TypeScript + prettier + eslint) and confirmednpm run lintpasses; a project without prettier is unaffected.Checklist