Removed .jshintrc and added eslint instead of jshint

I added the same jshint configuration/rules in package.json and I replaced some old function with arrow function to improve legibility
This commit is contained in:
Daniel Panero 2018-05-14 20:01:59 +02:00
parent fb5f4c034a
commit 4818acbaf0
3 changed files with 49 additions and 44 deletions

View File

@ -1,22 +0,0 @@
{
"curly": false,
"eqeqeq": true,
"immed": true,
"esnext": true,
"latedef": "nofunc",
"newcap": true,
"noarg": true,
"sub": true,
"undef": true,
"eqnull": true,
"browser": true,
"expr": true,
"globals": {
"head": false,
"module": false,
"console": false,
"unescape": false,
"define": false,
"exports": false
}
}

View File

@ -1,5 +1,5 @@
const gulp = require('gulp') const gulp = require('gulp')
const jshint = require('gulp-jshint') const eslint = require('gulp-eslint')
const uglify = require('gulp-uglify') const uglify = require('gulp-uglify')
const rename = require('gulp-rename') const rename = require('gulp-rename')
const sass = require('gulp-sass') const sass = require('gulp-sass')
@ -9,34 +9,28 @@ const qunit = require('gulp-qunit')
const zip = require('gulp-zip') const zip = require('gulp-zip')
const connect = require('gulp-connect') const connect = require('gulp-connect')
gulp.task('js', function () { gulp.task('js', () => gulp.src(['./js/reveal.js']).pipe(uglify()).pipe(rename('reveal.min.js')).pipe(gulp.dest('./js')))
return gulp.src(['./js/reveal.js']).pipe(uglify()).pipe(rename('reveal.min.js')).pipe(gulp.dest('./js'))
})
gulp.task('css-themes', function () { gulp.task('css-themes', () => gulp.src(['./css/theme/source/*.{sass,scss}']).pipe(sass()).pipe(gulp.dest('./css/theme')))
return gulp.src(['./css/theme/source/*.{sass,scss}']).pipe(sass()).pipe(gulp.dest('./css/theme'))
})
gulp.task('css-core', gulp.series(function () { gulp.task('css-core', gulp.series(
return gulp.src(['css/reveal.scss']).pipe(sass()).pipe(autoprefixer()).pipe(gulp.dest('./css')) () => gulp.src(['css/reveal.scss']).pipe(sass()).pipe(autoprefixer()).pipe(gulp.dest('./css')),
}, function () { () => gulp.src(['css/reveal.css']).pipe(minify({
return gulp.src(['css/reveal.css']).pipe(minify({
compatibility: 'ie9' compatibility: 'ie9'
})).pipe(rename('reveal.min.css')).pipe(gulp.dest('./css')) })).pipe(rename('reveal.min.css')).pipe(gulp.dest('./css'))
})) ))
gulp.task('css', gulp.parallel('css-themes', 'css-core')) gulp.task('css', gulp.parallel('css-themes', 'css-core'))
gulp.task('test', gulp.parallel(function () { gulp.task('test', gulp.series(
return gulp.src(['./js/reveal.js']).pipe(jshint()).pipe(jshint.reporter('default')).pipe(jshint.reporter('fail')); () => gulp.src(['./js/reveal.js']).pipe(eslint({useEslintrc: true})).pipe(eslint.format()),
}, function () { () => gulp.src(['./test/*.html']).pipe(qunit())
return gulp.src(['./test/*.html']).pipe(qunit()) ))
}))
gulp.task('default', gulp.series(gulp.parallel('js', 'css'), 'test')) gulp.task('default', gulp.series(gulp.parallel('js', 'css'), 'test'))
gulp.task('package', gulp.series('default', function () { gulp.task('package', gulp.series('default', () =>
return gulp.src([ gulp.src([
'./index.html', './index.html',
'./css/**', './css/**',
'./js/**', './js/**',
@ -45,9 +39,9 @@ gulp.task('package', gulp.series('default', function () {
'./plugin/**', './plugin/**',
'./**.md' './**.md'
]).pipe(zip('reveal-js-presentation.zip')).pipe(gulp.dest('./')) ]).pipe(zip('reveal-js-presentation.zip')).pipe(gulp.dest('./'))
})) ))
gulp.task('serve', function () { gulp.task('serve', () => {
connect.server({ connect.server({
root: '.', root: '.',
livereload: true, livereload: true,

View File

@ -40,7 +40,7 @@
"gulp-autoprefixer": "^5.0.0", "gulp-autoprefixer": "^5.0.0",
"gulp-clean-css": "^3.9.3", "gulp-clean-css": "^3.9.3",
"gulp-connect": "^5.5.0", "gulp-connect": "^5.5.0",
"gulp-jshint": "^2.1.0", "gulp-eslint": "^4.0.2",
"gulp-qunit": "^2.0.1", "gulp-qunit": "^2.0.1",
"gulp-rename": "^1.2.2", "gulp-rename": "^1.2.2",
"gulp-sass": "^3.1.0", "gulp-sass": "^3.1.0",
@ -53,5 +53,38 @@
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"npm": "^5.7.1" "npm": "^5.7.1"
},
"eslintConfig": {
"env": {
"browser": true
},
"globals": {
"head": false,
"module": false,
"console": false,
"unescape": false,
"define": false,
"exports": false
},
"rules": {
"curly": 0,
"eqeqeq": 2,
"wrap-iife": [
2,
"any"
],
"no-use-before-define": [
2,
{
"functions": false
}
],
"new-cap": 2,
"no-caller": 2,
"dot-notation": 0,
"no-undef": 2,
"no-eq-null": 2,
"no-unused-expressions": 2
}
} }
} }