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

Refactor to a consistent syntax #5

Closed
owenvoke opened this issue Jan 24, 2018 · 6 comments
Closed

Refactor to a consistent syntax #5

owenvoke opened this issue Jan 24, 2018 · 6 comments

Comments

@owenvoke
Copy link
Contributor

A couple of things for this, but mainly picking which type of JavaScript syntax to use.

I noticed that there is a use of let at the top, which is ES2015 and then var throughout the script, which is standard JavaScript.

Which syntax would you prefer to use?

@hill
Copy link
Owner

hill commented Jan 24, 2018

Haha - can you tell I'm just starting to learn Javascript development? 😉. Lets go with ES2015 (as long as that won't have too many compatibility issues??). Happy to hear your thoughts on what would be more appropriate though.

I must of been thinking let was actually const. Oops!

@owenvoke
Copy link
Contributor Author

owenvoke commented Jan 24, 2018

Personally I've had more experience with standard JavaScript. But I think ES2015 has a nicer(?) syntax and more functionality.

As far as I know though, ES2015/16 has to be transpiled to ES5 for browser compatibility. (I'm not sure what the support is in Chrome).

As this uses the new web extension format, it depends if you want to also support Firefox too as they can use most of the same content for extensions.

I guess to be honest it's what you're comfortable, as the primary contributor. 👍

owenvoke added a commit to owenvoke/tldr-chrome that referenced this issue Jan 24, 2018
This change alters some ES2015 syntax:
- Use backticks for string concatenation containing variables
- Move uses of `let` onto one line per definition
- Change to use arrow function

See: GitHub issue hill#5
See: https://goo.gl/8ZeEdS
@owenvoke
Copy link
Contributor Author

owenvoke commented Jan 24, 2018

I've had a go over here in a feature branch: feature/es2015-refactor

It looks like it doesn't need transpiling so far.

sigh Interestingly, although it doesn't need semicolons, it still seems to be recommended by linters, just not by Google standards.

@owenvoke
Copy link
Contributor Author

@hill, also, this is unrelated to the issue, will you be adding tags for each release?

i.e.

git tag v0.1.0 5f2eb00d4ee415e243efdd8a9df6c364d03fd1e2
git tag v0.2.0 676ae08986a66cbde9c32807ac4b6ecc940e3585

@hill
Copy link
Owner

hill commented Jan 24, 2018

@pxgamer yep that branch looks much cleaner! If it doesn't need transpiling then let's go with that.

I haven't used tags before - I'll certainly look into it. Is there a particular benefit it provides?

@owenvoke
Copy link
Contributor Author

owenvoke commented Jan 24, 2018

@hill, if you're happy with it, I'll create a pull request 👍

And regarding tags, the only reason was that if there is a stable version, it allows you to see what changes were made per version, and also download a .zip or .tar.gz of that exact version (example). The other good thing about it is that anyone can see what versions there are using git tag.

@owenvoke owenvoke mentioned this issue Jan 26, 2018
@hill hill closed this as completed in #6 Jan 26, 2018
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