console.log
throughout this book. Also, you will probably want to turn off the
"quotes"
rule. I’ll leave it as a reader’s exercise to disable these rules.
ESLint has a lot of configuration options; they’re all thoroughly documented on the
Now that we can write ES6, transcompile it to portable ES5, and lint our code to
improve it, we’re ready to dive into ES6!
Conclusion
In this chapter, we learned that ES6 support is not widespread yet, but it shouldn’t
stop you from enjoying the benefits of ES6 today, as you can transcompile your ES6
to portable ES5.
When you’re setting up a new development machine, you’ll want:
• A good editor (see
)
for installation instructions)
• Gulp (
npm install -g gulp
)
• ESLint (
npm install -g eslint
)
When you start a new project (whether it be a scratch project to run the examples in
this book, or a real project), you’ll want the following components:
• A dedicated directory for your project; we call this the project root
• A Git repository (
git init
)
• A package.json file (
npm init
)
• A Gulpfile (gulpfile.js; use the one from this chapter)
• Gulp and Babel local packages (
npm install --save-dev gulp gulp-babel
babel-preset-es2015
)
• A .babelrc file (contents:
{ "presets": ["es2015"] }
)
• An .eslintrc file (use
eslint --init
to create it, and edit to your preferences)
• A subdirectory for Node source (es6)
• A subdirectory for browser source (public/es6)
Once you have everything set up, your basic workflow will look like this:
1. Make logically consistent, related changes.
2. Run Gulp to test and lint your code.
30 | Chapter 2: JavaScript Development Tools