Skip to content

Commit 0a43ad1

Browse files
committed
ES2015ify
1 parent 90b1628 commit 0a43ad1

20 files changed

+286
-459
lines changed

.editorconfig

-3
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,5 @@ charset = utf-8
77
trim_trailing_whitespace = true
88
insert_final_newline = true
99

10-
[*.md]
11-
trim_trailing_whitespace = false
12-
1310
[Makefile]
1411
indent_style = tab

.eslintrc

-121
This file was deleted.

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
* text=auto
2+
*.js text eol=lf

.travis.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
sudo: false
22
language: node_js
33
node_js:
4-
- v6
5-
- v5
6-
- v4
4+
- '6'
5+
- '4'
76
before_script:
87
- export NODE_PATH="$NVM_PATH/../node_modules"
98
env:

benchmark/env.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
/*global suite, bench */
1+
/* global suite, bench */
22
'use strict';
3-
var yeoman = require('..');
3+
const yeoman = require('..');
44

5-
suite('Environment', function () {
6-
bench('#lookup()', function (done) {
5+
suite('Environment', () => {
6+
bench('#lookup()', done => {
77
yeoman.createEnv().lookup(done);
88
});
99
});

gulpfile.js

+20-36
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,34 @@
11
'use strict';
2-
var path = require('path');
3-
var gulp = require('gulp');
4-
var eslint = require('gulp-eslint');
5-
var excludeGitignore = require('gulp-exclude-gitignore');
6-
var mocha = require('gulp-mocha');
7-
var istanbul = require('gulp-istanbul');
8-
var nsp = require('gulp-nsp');
9-
var plumber = require('gulp-plumber');
10-
var coveralls = require('gulp-coveralls');
11-
12-
gulp.task('static', function () {
13-
return gulp.src('**/*.js')
14-
.pipe(excludeGitignore())
15-
.pipe(eslint())
16-
.pipe(eslint.format())
17-
.pipe(eslint.failAfterError());
18-
});
19-
20-
gulp.task('nsp', function (cb) {
2+
const path = require('path');
3+
const gulp = require('gulp');
4+
const mocha = require('gulp-mocha');
5+
const istanbul = require('gulp-istanbul');
6+
const nsp = require('gulp-nsp');
7+
const plumber = require('gulp-plumber');
8+
const coveralls = require('gulp-coveralls');
9+
10+
gulp.task('nsp', cb => {
2111
nsp({package: path.resolve('package.json')}, cb);
2212
});
2313

24-
gulp.task('pre-test', function () {
25-
return gulp.src('lib/**/*.js')
14+
gulp.task('pre-test', () =>
15+
gulp.src('lib/**/*.js')
2616
.pipe(istanbul({
2717
includeUntested: true
2818
}))
29-
.pipe(istanbul.hookRequire());
30-
});
31-
32-
gulp.task('test', ['pre-test'], function (cb) {
33-
var mochaErr;
19+
.pipe(istanbul.hookRequire())
20+
);
3421

22+
gulp.task('test', ['pre-test'], () =>
3523
gulp.src('test/*.js')
3624
.pipe(plumber())
37-
.pipe(mocha({reporter: 'spec'}))
38-
.on('error', function (err) {
39-
mochaErr = err;
40-
})
25+
.pipe(mocha({
26+
reporter: 'spec'
27+
}))
4128
.pipe(istanbul.writeReports())
42-
.on('end', function () {
43-
cb(mochaErr);
44-
});
45-
});
29+
);
4630

47-
gulp.task('coveralls', ['test'], function () {
31+
gulp.task('coveralls', ['test'], () => {
4832
if (!process.env.CI) {
4933
return;
5034
}
@@ -54,4 +38,4 @@ gulp.task('coveralls', ['test'], function () {
5438
});
5539

5640
gulp.task('prepublish', ['nsp']);
57-
gulp.task('default', ['static', 'test', 'coveralls']);
41+
gulp.task('default', ['test', 'coveralls']);

lib/adapter.js

+11-14
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
'use strict';
2-
3-
var _ = require('lodash');
4-
var inquirer = require('inquirer');
5-
var diff = require('diff');
6-
var chalk = require('chalk');
7-
var logger = require('./util/log');
2+
const _ = require('lodash');
3+
const inquirer = require('inquirer');
4+
const diff = require('diff');
5+
const chalk = require('chalk');
6+
const logger = require('./util/log');
87

98
/**
109
* `TerminalAdapter` is the default implementation of `Adapter`, an abstraction
@@ -14,16 +13,14 @@ var logger = require('./util/log');
1413
*
1514
* @constructor
1615
*/
17-
var TerminalAdapter = module.exports = function TerminalAdapter() {
16+
const TerminalAdapter = module.exports = function TerminalAdapter() {
1817
this.promptModule = inquirer.createPromptModule();
1918
};
2019

2120
TerminalAdapter.prototype._colorDiffAdded = chalk.black.bgGreen;
2221
TerminalAdapter.prototype._colorDiffRemoved = chalk.bgRed;
2322
TerminalAdapter.prototype._colorLines = function colorLines(name, str) {
24-
return str.split('\n').map(function (line) {
25-
return this['_colorDiff' + name](line);
26-
}, this).join('\n');
23+
return str.split('\n').map(line => this[`_colorDiff${name}`](line)).join('\n');
2724
};
2825

2926
/**
@@ -47,7 +44,7 @@ TerminalAdapter.prototype.prompt = function () {};
4744
* @param {string} expected
4845
*/
4946
TerminalAdapter.prototype.diff = function _diff(actual, expected) {
50-
var msg = diff.diffLines(actual, expected).map(function (str) {
47+
let msg = diff.diffLines(actual, expected).map(str => {
5148
if (str.added) {
5249
return this._colorLines('Added', str.value);
5350
}
@@ -57,9 +54,9 @@ TerminalAdapter.prototype.diff = function _diff(actual, expected) {
5754
}
5855

5956
return str.value;
60-
}, this).join('');
57+
}).join('');
6158

62-
// legend
59+
// Legend
6360
msg = '\n' +
6461
this._colorDiffRemoved('removed') +
6562
' ' +
@@ -79,7 +76,7 @@ TerminalAdapter.prototype.diff = function _diff(actual, expected) {
7976
TerminalAdapter.prototype.log = logger();
8077

8178
TerminalAdapter.prototype.prompt = function (questions, cb) {
82-
var promise = this.promptModule(questions);
79+
const promise = this.promptModule(questions);
8380
promise.then(cb || _.noop);
8481
return promise;
8582
};

0 commit comments

Comments
 (0)