sveltejs / svelte

Cybernetically enhanced web apps
https://svelte.dev
MIT License
78.74k stars 4.13k forks source link

Proposal to include `prettier-plugin-svelte` #8101

Closed mislam closed 6 months ago

mislam commented 1 year ago

Proposal

Include a minimal VSCode settings snippet at project root or in the README:

My .vscode/settings.json looks like this:

{
  "editor.formatOnSave": true,
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "[svelte]": {
    "editor.defaultFormatter": "svelte.svelte-vscode"
  },
  "editor.wordWrap": "wordWrapColumn",
  "editor.rulers": [100],
  "editor.wordWrapColumn": 100
}

Since we are using prettier, most developers will have their default formatter set to use esbenp.prettier-vscode. We also need to specify to use svelte.svelte-vscode for .svelete files. It took me a while to figure this out. I hope having a small snippet with at least these 3 lines (line 4,5,6) would save a ton of minutes for many new developers who are starting with Svelete.

Severity

annoyance

MacFJA commented 1 year ago

I think it's the wrong repository to post this issue: This is the repository of the language/framework, not of the lib/project template. It should be on the template repositories or on the kit repository.

Secondly, Prettier is an option, not an obligation. In the templates, you are asked if you want it or not. (And in the SvelteKit template, the plugin prettier-plugin-svelte is already added)

Next, VSCode is popular, I know, but not everyone uses it. There are plenty of other tools/applications to write Svelte code (JetBrains IDE, Netbeans, Eclipse, Atom, TextMate, vi (and its derivatives like vim, neovim, etc.), emacs, CodeSandbox, CodePen, etc.) If configuration is done for VSCode, configuration for all others IDE/editor should also be added. In the end, the repo will have lots of boilerplate code/configuration not used.


But that only my opinion, I have no power here :sweat_smile:

stordahl commented 1 year ago

@mislam I think this info would be beneficial to have, but how about adding it to the README of the plugin itself? I'd love to see a section on IDE setups, including the VSCode snippet you've provided

Rich-Harris commented 6 months ago

Agree that this doesn't belong here — closing