Skip to content

Commit

Permalink
Merge pull request #3 from leapfrogtechnology/eslint
Browse files Browse the repository at this point in the history
Eslint the source
  • Loading branch information
mesaugat committed Feb 22, 2016
2 parents 874ffb6 + a151c77 commit 8e61d85
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 3 deletions.
16 changes: 16 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"parser": "babel-eslint",
"rules": {
"strict": 0,
"quotes": [2, "single"]
},
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"env": {
"browser": true,
"node": true,
"es6": true
}
}
22 changes: 19 additions & 3 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,42 @@
var gulp = require('gulp');
var babelify = require('babelify');
var uglify = require('gulp-uglify');
var eslint = require('gulp-eslint');
var rename = require('gulp-rename');
var browserify = require('browserify');
var source = require('vinyl-source-stream');

gulp.task('compile', function() {
// Lint using eslint
gulp.task('lint', function() {
return gulp.src([
'**/*.js',
'!dist/**',
'!coverage/**',
'!node_modules/**'
])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});

// Compile ES6
gulp.task('compile', ['lint'], function() {
return browserify({ entries: './src/H.js', debug: true })
.transform(babelify)
.bundle()
.pipe(source('h.js'))
.pipe(gulp.dest('dist'));
});

// Uglify
gulp.task('uglify', ['compile'], function() {
gulp.src('dist/h.js')
return gulp.src('dist/h.js')
.pipe(rename({suffix: '.min'}))
.pipe(uglify())
.pipe(gulp.dest('dist'));
});

gulp.task('default', ['compile', 'uglify']);
gulp.task('default', ['lint', 'compile', 'uglify']);

gulp.task('watch', function() {
gulp.watch('./src/**/*.js', ['default']);
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@
"handlebars": "^4.*"
},
"devDependencies": {
"babel-eslint": "^5.0.0",
"babel-preset-es2015": "^6.5.0",
"babelify": "^7.2.0",
"browserify": "^13.0.0",
"browserify-istanbul": "^0.2.1",
"eslint": "^2.2.0",
"gulp": "^3.9.1",
"gulp-eslint": "^2.0.0",
"gulp-rename": "^1.2.2",
"gulp-uglify": "^1.5.2",
"isparta": "^4.0.0",
Expand Down

0 comments on commit 8e61d85

Please sign in to comment.