Skip to content

Commit 19fac09

Browse files
committed
Make ancillary files comply with ESLint
1 parent 75d6697 commit 19fac09

File tree

4 files changed

+48
-51
lines changed

4 files changed

+48
-51
lines changed

gulpfile.js

Lines changed: 42 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,62 @@
1-
var gulp = require('gulp');
2-
var eslint = require('gulp-eslint');
3-
var mocha = require('gulp-mocha-phantomjs');
4-
var header = require('gulp-header');
5-
var webpack = require('webpack-stream');
6-
var scsslint = require('gulp-scss-lint');
7-
var sass = require('gulp-sass');
8-
var pkg = require('./package.json');
9-
10-
var banner = '/*! <%= pkg.name %> - v<%= pkg.version %> | <%= new Date().getFullYear() %> */\n';
11-
12-
gulp.task('test-script-format', function () {
13-
return gulp.src(['./src/js/**/*.js'])
1+
const gulp = require('gulp');
2+
const eslint = require('gulp-eslint');
3+
const mocha = require('gulp-mocha-phantomjs');
4+
const header = require('gulp-header');
5+
const webpack = require('webpack-stream');
6+
const scsslint = require('gulp-scss-lint');
7+
const sass = require('gulp-sass');
8+
const pkg = require('./package.json');
9+
10+
const webpackConfig = require('./webpack.config');
11+
const testWebpackConfig = require('./webpack.test.config');
12+
13+
const banner = '/*! <%= pkg.name %> - v<%= pkg.version %> | <%= new Date().getFullYear() %> */\n';
14+
15+
gulp.task('test-script-format', () =>
16+
gulp.src(['./src/js/**/*.js'])
1417
.pipe(eslint())
1518
.pipe(eslint.format())
16-
.pipe(eslint.failOnError());
17-
});
19+
.pipe(eslint.failOnError())
20+
);
1821

19-
gulp.task('compile-test-script', function () {
20-
return gulp.src(['./test/index.js'])
22+
gulp.task('compile-test-script', () =>
23+
gulp.src(['./test/index.js'])
2124
.pipe(webpack(require('./webpack.config.js')))
22-
.pipe(gulp.dest('./test/compiled/'));
23-
});
25+
.pipe(gulp.dest('./test/compiled/'))
26+
);
2427

2528
// Disabled for now
26-
gulp.task('test-mocha', ['script-compile-test'], function () {
27-
return gulp.src(['test/test.html'])
28-
.pipe(mocha({ reporter: 'spec' }));
29-
});
29+
gulp.task('test-mocha', ['script-compile-test'], () =>
30+
gulp.src(['test/test.html'])
31+
.pipe(mocha({ reporter: 'spec' }))
32+
);
3033

3134
gulp.task('test-script', ['test-script-format']);
3235

33-
gulp.task('build-script', ['test-script'], function () {
34-
return gulp.src(['./src/index.js'])
35-
.pipe(webpack(require('./webpack.config.js')))
36-
.pipe(header(banner, {
37-
pkg: pkg,
38-
}))
39-
.pipe(gulp.dest('./lib/'));
40-
});
36+
gulp.task('build-script', ['test-script'], () =>
37+
gulp.src(['./src/index.js'])
38+
.pipe(webpack(webpackConfig))
39+
.pipe(header(banner, { pkg }))
40+
.pipe(gulp.dest('./lib/'))
41+
);
4142

42-
gulp.task('build-style', function () {
43-
return gulp.src('./src/sass/**/*.scss')
43+
gulp.task('build-style', () =>
44+
gulp.src('./src/sass/**/*.scss')
4445
.pipe(scsslint())
4546
.pipe(scsslint.failReporter())
4647
.pipe(sass({
4748
outputStyle: 'expanded',
4849
}).on('error', sass.logError))
49-
.pipe(gulp.dest('./lib'));
50-
});
50+
.pipe(gulp.dest('./lib'))
51+
);
5152

52-
gulp.task('build-examples', ['build-script', 'build-style'], function () {
53-
return gulp.src(['./examples/index.js'])
54-
.pipe(webpack(require('./webpack.test.config.js')))
55-
.pipe(gulp.dest('./examples/compiled/'));
56-
});
53+
gulp.task('build-examples', ['build-script', 'build-style'], () =>
54+
gulp.src(['./examples/index.js'])
55+
.pipe(webpack(testWebpackConfig))
56+
.pipe(gulp.dest('./examples/compiled/'))
57+
);
5758

58-
gulp.task('watch', function () {
59+
gulp.task('watch', () => {
5960
gulp.watch(['./src/js/**/*.js'], ['build-script']);
6061
gulp.watch(['./src/sass/**/*.scss'], ['build-style']);
6162
});

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
//
44
// See: https://github.com/webpack/webpack/issues/706
55

6-
module.exports = require('./js/Tree.js').default;
6+
module.exports = require('./js/Tree').default;

webpack.config.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* eslint-disable */
2-
31
module.exports = {
42
output: {
53
filename: 'index.js',
@@ -8,19 +6,19 @@ module.exports = {
86
},
97
externals: [
108
{
11-
'react': {
9+
react: {
1210
root: 'React',
1311
commonjs2: 'react',
1412
commonjs: 'react',
15-
amd: 'react'
13+
amd: 'react',
1614
},
1715
},
1816
{
1917
'react-dom': {
2018
root: 'ReactDOM',
2119
commonjs2: 'react-dom',
2220
commonjs: 'react-dom',
23-
amd: 'react-dom'
21+
amd: 'react-dom',
2422
},
2523
},
2624
],
@@ -31,7 +29,7 @@ module.exports = {
3129
exclude: /(node_modules|bower_components|vender_modules)/,
3230
loader: 'babel',
3331
query: {
34-
presets: ['react', 'es2015', 'stage-0']
32+
presets: ['react', 'es2015', 'stage-0'],
3533
},
3634
},
3735
],

webpack.test.config.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* eslint-disable */
2-
31
module.exports = {
42
output: {
53
filename: 'index.js',
@@ -13,7 +11,7 @@ module.exports = {
1311
exclude: /(node_modules|bower_components|vender_modules)/,
1412
loader: 'babel',
1513
query: {
16-
presets: ['react', 'es2015', 'stage-0']
14+
presets: ['react', 'es2015', 'stage-0'],
1715
},
1816
},
1917
],

0 commit comments

Comments
 (0)