Skip to content
This repository has been archived by the owner on Jan 22, 2022. It is now read-only.

semistandard linter #4

Closed
fernandojsg opened this issue Feb 13, 2018 · 17 comments · Fixed by #13
Closed

semistandard linter #4

fernandojsg opened this issue Feb 13, 2018 · 17 comments · Fixed by #13

Comments

@fernandojsg
Copy link
Contributor

I would love to keep using https://github.com/Flet/semistandard as we do on aframe, what do you think?

@TrevorFSmith
Copy link
Contributor

Looks pretty good to me. I was worried that I'd have to go back to using semicolons, but no!

@TrevorFSmith
Copy link
Contributor

Oh, wait. Semistandard does require semicolons. Hmmm, are you sure that you want those?

@TrevorFSmith
Copy link
Contributor

I'm fine with the rest of StandardJS, though.

@TrevorFSmith
Copy link
Contributor

TrevorFSmith commented Feb 13, 2018

Dang, I should have read through the whole thing. I know that tabs v spaces is religious, but I have a lot of muscle memory for tabs.

I'm for having a linter and I won't fight consensus decisions, but I don't personally care for semicolons and space indentation.

@cvan
Copy link

cvan commented Feb 13, 2018

FWIW: I use two spaces, but I always press Tab key; I don’t ever press the space bar. Editors like Atom and Sublime have the Tab key convert to soft spaces.

@fernandojsg
Copy link
Contributor Author

I believe every single line of code I see and work with every day uses semicolons so I'm 100% for it. Regarding tabs vs spaces it's just up to us, but we should follow the one on the linter, and as @cvan said we could just config the editor to convert then to spaces or tabs without any problem.
Regarding semicolons, if we look also at most of the frameworks we're targeting: aframe, threejs, babylonjs, playcanvas, reactvr... are using semicolons so it could be handy for us while working with integrations and for framework's devs while contributing to it too

@robertlong
Copy link

The Social MR team is using Prettier 🤷‍♂️

I like both Standard and Prettier. Semistandard looks less maintained than Standard, but still compatible with the same tooling?

@netpro2k
Copy link

+1 for Prettier, it has largely eliminated any sort of thinking any of us have to do about style (apart from making sure everyone gets their environment set up correctly)

@fernandojsg
Copy link
Contributor Author

@robertlong @robertlong I didn't know prettier but it looks cool!, although regarding standard vs semistandard, from what I've seen from social you're still using semicolons anyway right?

@cvan
Copy link

cvan commented Feb 14, 2018

Semistandard is just Standard with ;. There's not much to maintain there, heh.

And, yeah, Prettier (brought to you by former Mozillian, James Long) is a good way to end the style conversation and just write code.

From Prettier's docs:

By far the biggest reason for adopting Prettier is to stop all the ongoing [sic] debates over styles.

@TrevorFSmith
Copy link
Contributor

I hear you that lots of code uses semicolons, but lots of new code doesn't use semicolons. At the end of the day, like indentation, it's a personal preference.

So, how about we split the middle and go with two space indentation but no semicolons? I'll learn to live with spaces and you'll learn to live without semicolons?

Prettier seems nice and has the options we need. If I don't hear objections by end of day Weds I'll go ahead and integrate it into the project.

@fernandojsg
Copy link
Contributor Author

When I said lots of code uses semicolons I was refering also to the codebase generated and maintained by the team, I didn't see yet any code without semicolons.

If I need to choose between one of these two, I could go for tabs + semicolons :D

I know it's going to be a dead end road so what about just making a poll with everyone on the team and just vote! :)

my vote (basically semistandard):
indentation: spaces
semicolons: yes

@cvan
Copy link

cvan commented Feb 14, 2018

  • tabs can be changed from an editor.
  • semicolons cannot be magically added or removed (unless there's some new voodoo, besides Prettier)

let's just be consistent with the other projects (including the ones being added to https://github.com/immersive-web).

can we just commit to following the Google style guide, if we're working with community folks who have similarly styled code.

for example with three.js, it makes me chuckle every time I see a contributor introduce a PR but have to make a ton of changes to meet Mr.doob Coding Style. I agree that's where things like Prettier come in, but IMO semistandard has been serving us well for years+ (and even Brendan Eich once said he likes semistandard too).

consistency over personal preference, can we agree to that?

@fernandojsg
Copy link
Contributor Author

@cvan Yeah that was my main point, I also remember when I started using semistandard to work with aframe that I didn't like many of the rules, and I completely agree with you that mrdoob coding style is one of the awful things you could deal with, but at the end we need to choose something that is widely used instead of a custom made standard (like mrdoob's). That's why based on our code base I believe we're more close to semistandard

@TrevorFSmith
Copy link
Contributor

@cvan From the docs, it looks like Prettier will add and remove end of line semicolons, so it's just a flag like indentation.

@TrevorFSmith
Copy link
Contributor

TrevorFSmith commented Feb 14, 2018

I'm 💯 on board with staying consistent when contributing to an existing code base. I'm also annoyed/amused when people submit PRs to a long-running project and don't stay in style, even when the style is as weird as three.js's. 😄 But, since this is a new code base, it's worth considering where we are as a coding community.

My personal story: After decades of writing old-school JS syntax, when I finally had a chance to create a project that used ES'15 it felt so completely different from old JS. Classes, modules, rest and spread syntax, getters and setters, string formatting, thin functions... it's like a completely different syntax!

So, at that point I also reconsidered a lot of my base assumptions like what editor to use, indentation, spacing, and semicolons. I landed on hard tabs because it's a single character per level of indentation. I stopped using semicolons because they serve no purpose for well written code and also for most poorly written code.

At the end of the day Prettier will sooth any muscle memory problems and I'll live with whatever consensus we reach, but I do ask you all to reconsider your base assumptions about why you believe what you believe and whether an emerging tech group like ours could lead the way toward more modern habits.

@netpro2k
Copy link

Yeah I vote for prettier and I also vote for not changing any of its defaults (I don't even know what they are, and that's the point).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants