Skip to content
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

Change semi to false by default in JavaScript #13059

Closed
FossPrime opened this issue Jul 1, 2022 · 5 comments
Closed

Change semi to false by default in JavaScript #13059

FossPrime opened this issue Jul 1, 2022 · 5 comments

Comments

@FossPrime
Copy link

FossPrime commented Jul 1, 2022

I used semicolons most of my life, but https://slides.com/evanyou/semicolons converted me. I now look at them as useless extra clutter. It's only really a problem in self executing functions, which are trivial to avoid.

They also make the code less i18n, as many layouts don't prioritize them specially on mobile. I code on my phone for fun, but lots of folk in India/Africa/Apac only have a good phone as their main computer, not only due to the cost, but also blackouts, lack of sim cards and the cost of powering them.

It's easy to change them, if you know how, but it slows down the people who have the hardest time programming, the ones Using StackBlitz on a big cheap Android phone. I make about a 100 sandboxes a month, I have a macro for creating the file, only for the friction #4102 and semis cause. Vite got it right, the most highly rated Dev tool in the State of Js 2022 survey.

Related

@alexander-akait
Copy link
Member

Sorry, we don't want to change it, it was discussed a lot before

@FossPrime
Copy link
Author

FossPrime commented Jul 1, 2022

I should have clarified that the default should only apply to JavaScript/Typescript. You discussed it before when there was no consensus. I searched thoroughly for the record of that discussion and found nothing... Care to link it?

State of Js 2022 S tier libraries:
Screenshot_20220701-115156

  • Vite, no semis
  • esbuild, no semis
  • Testing Library (React), no semis
  • Typescript, no semis
  • Jest, semi
  • Cypress, no semis
  • Next.js, no semis

Jest's preference for semis is not consistent with Facebook's own React.

The choice should be made by the people who use the language, not by the preferences of unrelated languages. Otherwise, Prettier risks irrelevance when all Js libraries choose a fork with per language defaults that match their users preferences and what makes the most sense in that language.

@alexander-akait
Copy link
Member

It doesn't mean anything at all, it's preference of developers these tools, not more.

Otherwise, Prettier risks irrelevance when all Js libraries choose a fork with per language defaults that match their users preferences and what makes the most sense in that language.

I don't mean to be rude, but I've heard this many times already.

ASI is not simple for new developers and often decrease readable, so we don't want to change it.

In your list, you select tools that do not use semi, If you make a more honest selection, you will see a different picture.

Also: typescript with semi - https://github.com/microsoft/TypeScript/blob/main/src/tsc/tsc.ts

@FossPrime
Copy link
Author

FossPrime commented Jul 1, 2022

Typescript might have changed their mind 14 days ago and that file hasn't been updated... New commits with semis are set to cause an error: https://github.com/microsoft/TypeScript/blob/f8aa570b23bd094798a98cef307038b1da9101a7/.eslintrc.json#L58

Look at the slides... In practice AST is only an issue with anonymous self-executing functions, which is not a trick new developers use, and are easy and more intuitive to avoid by just calling functions normally.

The list of libraries I mentioned wasn't picked by me... But by the most popular JavaScript survey, that was taken by 16,000 JavaScript/Typescript developers.

Would you at least open it for discussion if I found that 90%+ of active JavaScript only GitHub repos with a linting configuration file use single quotes with no semis?

@FossPrime FossPrime changed the title Change semi to false by default Change semi to false by default in JavaScript Jul 1, 2022
@alexander-akait
Copy link
Member

Typescript might have changed their mind 14 days ago and that file hasn't been updated... New commits with semis are set to cause an error: https://github.com/microsoft/TypeScript/blob/f8aa570b23bd094798a98cef307038b1da9101a7/.eslintrc.json#L58

They disabled semi rule because adopted prettier and prettier insert semi.

Look at the slides... In practice AST is only an issue with anonymous self-executing functions, which is not a trick new developers use, and are easy and more intuitive to avoid by just calling functions normally.

not only, example

let array = [1, 2, 3]

[1, 2 ,3].map((x) => call(x))

And more, and more

The list of libraries I mentioned wasn't picked by me... But by the most popular JavaScript survey, that was taken by 16,000 JavaScript/Typescript developers.

As I said before, it is a personal choice

Sorry, I don't see reasons to open it and I respect your option, but we don't change it, we have the option to change it, please use if you don't want to have semi

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants