Last 12 weeks · 0 commits
2 of 6 standards met
Summary was printed as . The compiler drops grouping parentheses from the each-block expression AST, and Prettier then omits them as unnecessary in JS, so the TypeScript is concatenated into the context keyword. Wrap expressions whose AST type is so the assertion stays parenthesized. Fixes #486. Decision Chose: wrap when . Alternative: preserve every user-written grouping parenthesis around each-block expressions (or also wrap / angle-bracket assertions). Why: same idea as , only wrap when 's would otherwise collide with TypeScript . Sequence expressions already get parens from Prettier; is the hole. Happy to widen the predicate if you want that. The case from the issue comment is already handled by the existing parentheses fix (#501 / #503); this PR does not change that path. Test plan [x] fails without the wrap and passes with it [x] Existing printer samples, , and still pass
example svelte project using the default template: https://github.com/theweekendgeek/svelte-prettier-example) This s happening in WebStorm, I could not yet reproduce this in Visual Studio Code. I would assume that other IDEs from Jetbrains behave the same. Not sure If I might need to be raising this issue with them, because of the way the IDE calls Prettier for example. How to reproduce: 1. open project in webstorm 2. in Settings -> Prettier: make sure prettier package is selected, add svelte extension to . Check and 3. open 4. select 5. type opening curly brace to surround with curly braces 6. prettier:content is inserted instead of reformatted code What I have found out so far: In General I can call the action without problems. I will format the code as expected, except when I have just done the sequence above and pressed . In this case the same result as above will shown. I can workaround the issue by disabling the option in the Prettier Settings.
Repository: sveltejs/prettier-plugin-svelte. Description: Format your svelte components using prettier. Stars: 817, Forks: 102. Primary language: TypeScript. Languages: TypeScript (63.7%), HTML (35.4%), JavaScript (0.9%). License: MIT. Latest release: prettier-plugin-svelte@4.1.1 (3mo ago). Open PRs: 11, open issues: 46. Last activity: 2mo ago. Community health: 50%. Top contributors: dummdidumm, jamesbirtles, Conduitry, dependabot[bot], jarrodldavis, ehrencrona, jrmajor, github-actions[bot], clebert, orlov-vo and others.