-
Notifications
You must be signed in to change notification settings - Fork 5.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[fmt] Option to remove semicolons #13616
Comments
Agree with this suggestion -- Prettier started the fmt revolution with a strict philosophy on being opinionated with few options. And yet, even they have the option to turn off semicolons. Please consider 🙏 |
I think this would be a great addition! I'm not sure how to implement it, having no experience with the deno source, but hopefully someone who is familiar would like to take a look. |
+1 here. Not an annoyance right now, but it would prevent having to bring in Prettier into my project, which is a Node.js tool and not Deno. Does the Deno team have a hard stance on semi-colons? Similar to how the Go team treats formatting? |
+1 here. Not necessary anymore. |
Would really love to see this added. |
Dprint allows asi semicolons. |
Do you know how to make dprint start formatting Deno files in VSCode? I have this setup now:
I assume |
Actually https://dprint.dev/config/ doesn't have |
I am actually super confused. dprint says it does have |
This is my Dprint config ( {
"incremental": true,
"typescript": {
"arrowFunction.useParentheses": "force",
"binaryExpression.operatorPosition": "sameLine",
"bracePosition": "sameLineUnlessHanging",
"commentLine.forceSpaceAfterSlashes": true,
"enumDeclaration.memberSpacing": "newLine",
"functionDeclaration.spaceBeforeParentheses": true,
"functionExpression.spaceBeforeParentheses": false,
"ifStatement.singleBodyPosition": "nextLine",
"ifStatement.spaceAfterIfKeyword": true,
"ifStatement.useBraces": "always",
"importDeclaration.spaceSurroundingNamedImports": true,
"indentWidth": 2,
"lineWidth": 80,
"locked": true,
"newLineKind": "lf",
"operatorPosition": "nextLine",
"preferHanging": false,
"quoteStyle": "preferDouble",
"semiColons": "asi",
"spaceSurroundingProperties": true,
"trailingCommas": "onlyMultiLine",
"typeAnnotation.spaceBeforeColon": false,
"typeAssertion.spaceBeforeExpression": true,
"useTabs": true
},
"json": {
"indentWidth": 2,
"lineWidth": 80,
"locked": true,
"newLineKind": "lf",
"useTabs": true
},
"markdown": {
"emphasisKind": "underscores",
"lineWidth": 80,
"locked": true,
"newLineKind": "lf",
"strongKind": "asterisks",
"textWrap": "always"
},
"toml": {
"cargo.applyConventions": true,
"comment.forceLeadingSpace": true,
"indentWidth": 2,
"lineWidth": 80,
"locked": true,
"newLineKind": "lf",
"useTabs": true
},
"includes": ["**/*.{ts,tsx,js,jsx,json,jsonc,md,toml}"],
"excludes": [".history/**"],
"plugins": [
"https://plugins.dprint.dev/json-0.15.2.wasm",
"https://plugins.dprint.dev/markdown-0.13.2.wasm",
"https://plugins.dprint.dev/toml-0.5.4.wasm",
"https://plugins.dprint.dev/typescript-0.68.2.wasm"
]
} I have Dprint installed globally and I run the above with |
What do people do nowadays to use StandardJS with Deno projects? What's the recommended way to do it? Is there a community config for it? |
+1 to this FR, and to mirror dprint's semicolon options. Plenty of js/ts coding standards actively discourage routine use of semicolons and As a side note, if deno uses dprint under the hood, why not expose dprint's complete config via deno's config file. Maybe a |
I am using Dprint directly precisely because Deno appears to be hiding options. Not clear why Deno would do that. Is it just out of sync? Or is it deliberate? |
(That said, I also use Dprint instead of Prettier on Node apps.) |
Deno's philosophy is that having 1 way to do things is better than multiple ways to do the same thing. So that includes formatting and deno has the opinion there that it is better to be explicit about semi's rather than relying on ASI |
|
If that's true, it's sad. It means that they've chosen to lock in their own biases rather than trusting their users to make their own decisions. And over something as trivial as ASI, too. I really hope that's not the case. It would lower my opinion of Deno and Dahl quite significantly. |
I am currently using dprint to achieve this. But the issue still stands, the majority 99.9 % of the Deno code that's published now has not needed visual noise semicolons. Simply because it's not trivial to avoid adding them. Hope Deno team considers adding this option. |
Thus, other options such as I agree that the number of options should be "minimal". However, there exists endless debates in the community (single vs double quotes, tab vs space indentation, and semicolon vs no semicolon). In these case options should be provided. |
This discussion is the perfect example why we will not be introducing additional options to the built in formatter. All source code written for Deno should use the same formatting options for consistency, and to reduce this kind of discussion. In our eyes ecosystem consistency is much more important than opinions of individuals. This is also why we limit configuration options of the runtime and type checker as much as we do. Thank you for all the comments on the issue. |
Since people felt so strongly about this, Deno 1.30 has semicolon configuration https://deno.com/blog/v1.30#deno-fmt-supports-configuring-semicolons |
Woohooo!!!!! Thank you guys so much!! |
It should never have been removed in the first place, but thanks for the correction. |
@chasm It was never removed because it was never added. This is the first time this functionality is available. |
@dsherret My understanding was that Deno used Dprint under the covers. It was always in Dprint, which is why I have used Dprint directly instead of Deno for formatting. If that's correct, then in that sense it was "removed". In short, the Deno folks, as explained by Luca Casonato above, decided to leave it out, consciously and deliberately. But it's awesome that it's in there now, so all this is water under the bridge. |
@chasm don't be a d*ck just be glad they fixed it :P |
Hi!
A lot of JavaScript and TypeScript projects don't use semicolons. Some famous style conventions such as StandardJS prohibit their use (except when needed).
I suggest to add an option
useSemicolon
that defaults totrue
and can be turned off in order to remove automatically insertable semicolons. When turned off this option set dprint's semicolon option toasi
.I think it is an option in the same vein as
useTabs
andindentWidth
: for some people this improves code readability.The text was updated successfully, but these errors were encountered: