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

Update Tailor to use ES6 #102

Closed
addityasingh opened this issue Jan 11, 2017 · 4 comments
Closed

Update Tailor to use ES6 #102

addityasingh opened this issue Jan 11, 2017 · 4 comments

Comments

@addityasingh
Copy link
Contributor

addityasingh commented Jan 11, 2017

Even though NodeJS (along with --harmony flag in v4) provides a lot of ES6 features, the Tailor code doesn't use all of them. Update the code to refactor the Tailor code using ES6. E.g.

  1. Add destructuring to files
fragmentObj = Object.assign({}, { name: node.name, attributes: node.attribs});

to

const { name, attribs: attributes } = node;
fragmentObj = Object.assign({}, { name, attributes});
  1. Use () => to avoid some boilerplate
const stripUrl = (fileUrl) => {
    return path.normalize(fileUrl.replace('file://', ''));
};
const stripUrl = fileUrl => path.normalize(fileUrl.replace('file://', ''));
@vigneshshanmugam
Copy link
Collaborator

@Addi90 Thanks for the idea and yes indeed there are even lots of places where all the features are not utilised.

It would be even cool if we can get https://github.com/babel/babel-preset-env to work and ship to 4.4.x and major versions.

@fokusferit
Copy link

btw. you guys maybe consider looking into https://github.com/lebab/lebab ? As it does the opposite turns ES5 code into ES6/ES7 it might be interesting or worth checking out. Maybe it could save some time doing replacements manually ?

@addityasingh
Copy link
Contributor Author

@fokusferit Looks interesting. I will try it today to see if it is exhaustive in the ES5-ES6 conversion. Thanks a lot for sharing this

@dazld
Copy link
Contributor

dazld commented Jan 12, 2017

Node 4.x active LTS period is up until 2017-04-01, for reference.

vigneshshanmugam pushed a commit that referenced this issue Jan 18, 2017
* #99 Add codecov for integrating code coverage reports

* #102 Add destructuring, arrow functions to first few files

* #102 Remove lodash from package.json

* #111 Add ESLINT rule for consistent object curlybar spacing

* #111 Replace ESLINT error with 2
rikkert pushed a commit to rikkert/tailor that referenced this issue May 12, 2017
…alando#112)

* zalando#99 Add codecov for integrating code coverage reports

* zalando#102 Add destructuring, arrow functions to first few files

* zalando#102 Remove lodash from package.json

* zalando#111 Add ESLINT rule for consistent object curlybar spacing

* zalando#111 Replace ESLINT error with 2
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants