Update dependencies, switch to eslint
This commit is contained in:
16
.eslintrc
Normal file
16
.eslintrc
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"root": true,
|
||||||
|
"extends": "eslint:recommended",
|
||||||
|
"globals": {
|
||||||
|
"wp": true,
|
||||||
|
},
|
||||||
|
"env": {
|
||||||
|
"browser": true,
|
||||||
|
"jquery": true,
|
||||||
|
"node": true,
|
||||||
|
"amd": true
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"no-console": 0
|
||||||
|
}
|
||||||
|
}
|
||||||
95
.jscsrc
95
.jscsrc
@@ -1,95 +0,0 @@
|
|||||||
{
|
|
||||||
"requireCurlyBraces": [
|
|
||||||
"if",
|
|
||||||
"else",
|
|
||||||
"for",
|
|
||||||
"while",
|
|
||||||
"do",
|
|
||||||
"try",
|
|
||||||
"catch"
|
|
||||||
],
|
|
||||||
"requireOperatorBeforeLineBreak": true,
|
|
||||||
"requireCamelCaseOrUpperCaseIdentifiers": true,
|
|
||||||
"maximumLineLength": {
|
|
||||||
"value": 80,
|
|
||||||
"allowComments": true,
|
|
||||||
"allowRegex": true
|
|
||||||
},
|
|
||||||
"validateIndentation": 2,
|
|
||||||
"validateQuoteMarks": "'",
|
|
||||||
"disallowMultipleLineStrings": true,
|
|
||||||
"disallowMixedSpacesAndTabs": true,
|
|
||||||
"disallowTrailingWhitespace": true,
|
|
||||||
"disallowSpaceAfterPrefixUnaryOperators": true,
|
|
||||||
"disallowMultipleVarDecl": true,
|
|
||||||
"disallowKeywordsOnNewLine": [
|
|
||||||
"else"
|
|
||||||
],
|
|
||||||
"requireSpaceAfterKeywords": [
|
|
||||||
"if",
|
|
||||||
"else",
|
|
||||||
"for",
|
|
||||||
"while",
|
|
||||||
"do",
|
|
||||||
"switch",
|
|
||||||
"return",
|
|
||||||
"try",
|
|
||||||
"catch"
|
|
||||||
],
|
|
||||||
"requireSpaceBeforeBinaryOperators": [
|
|
||||||
"=",
|
|
||||||
"+=",
|
|
||||||
"-=",
|
|
||||||
"*=",
|
|
||||||
"/=",
|
|
||||||
"%=",
|
|
||||||
"<<=",
|
|
||||||
">>=",
|
|
||||||
">>>=",
|
|
||||||
"&=",
|
|
||||||
"|=",
|
|
||||||
"^=",
|
|
||||||
"+=",
|
|
||||||
"+",
|
|
||||||
"-",
|
|
||||||
"*",
|
|
||||||
"/",
|
|
||||||
"%",
|
|
||||||
"<<",
|
|
||||||
">>",
|
|
||||||
">>>",
|
|
||||||
"&",
|
|
||||||
"|",
|
|
||||||
"^",
|
|
||||||
"&&",
|
|
||||||
"||",
|
|
||||||
"===",
|
|
||||||
"==",
|
|
||||||
">=",
|
|
||||||
"<=",
|
|
||||||
"<",
|
|
||||||
">",
|
|
||||||
"!=",
|
|
||||||
"!=="
|
|
||||||
],
|
|
||||||
"requireSpaceAfterBinaryOperators": true,
|
|
||||||
"requireSpacesInConditionalExpression": true,
|
|
||||||
"requireSpaceBeforeBlockStatements": true,
|
|
||||||
"requireSpacesInForStatement": true,
|
|
||||||
"requireLineFeedAtFileEnd": true,
|
|
||||||
"requireSpacesInFunctionExpression": {
|
|
||||||
"beforeOpeningCurlyBrace": true
|
|
||||||
},
|
|
||||||
"disallowSpacesInAnonymousFunctionExpression": {
|
|
||||||
"beforeOpeningRoundBrace": true
|
|
||||||
},
|
|
||||||
"disallowSpacesInsideObjectBrackets": "all",
|
|
||||||
"disallowSpacesInsideArrayBrackets": "all",
|
|
||||||
"disallowSpacesInsideParentheses": true,
|
|
||||||
"jsDoc": {
|
|
||||||
"checkParamNames": true,
|
|
||||||
"requireParamTypes": true
|
|
||||||
},
|
|
||||||
"disallowMultipleLineBreaks": true,
|
|
||||||
"disallowNewlineBeforeBlockStatements": true
|
|
||||||
}
|
|
||||||
15
.jshintrc
15
.jshintrc
@@ -1,15 +0,0 @@
|
|||||||
{
|
|
||||||
"bitwise": true,
|
|
||||||
"browser": true,
|
|
||||||
"curly": true,
|
|
||||||
"eqeqeq": true,
|
|
||||||
"eqnull": true,
|
|
||||||
"esnext": true,
|
|
||||||
"immed": true,
|
|
||||||
"jquery": true,
|
|
||||||
"latedef": true,
|
|
||||||
"newcap": true,
|
|
||||||
"noarg": true,
|
|
||||||
"node": true,
|
|
||||||
"strict": false
|
|
||||||
}
|
|
||||||
@@ -18,7 +18,7 @@ cache:
|
|||||||
|
|
||||||
install:
|
install:
|
||||||
- npm install -g npm@latest
|
- npm install -g npm@latest
|
||||||
- npm install -g bower gulp jscs
|
- npm install -g bower gulp eslint
|
||||||
- npm install
|
- npm install
|
||||||
- composer self-update && composer --version
|
- composer self-update && composer --version
|
||||||
- export PATH="$HOME/.composer/vendor/bin:$PATH"
|
- export PATH="$HOME/.composer/vendor/bin:$PATH"
|
||||||
@@ -28,7 +28,6 @@ install:
|
|||||||
|
|
||||||
script:
|
script:
|
||||||
- npm run build
|
- npm run build
|
||||||
- npm run jshint
|
- npm run lint
|
||||||
- npm run jscs
|
|
||||||
- phpcs --standard=ruleset.xml --extensions=php --ignore=node_modules,bower_components,vendor -n -s .
|
- phpcs --standard=ruleset.xml --extensions=php --ignore=node_modules,bower_components,vendor -n -s .
|
||||||
- phpmd src text cleancode,codesize,controversial,design,naming,unusedcode
|
- phpmd src text cleancode,codesize,controversial,design,naming,unusedcode
|
||||||
|
|||||||
26
gulpfile.js
26
gulpfile.js
@@ -8,7 +8,7 @@ var flatten = require('gulp-flatten');
|
|||||||
var gulp = require('gulp');
|
var gulp = require('gulp');
|
||||||
var gulpif = require('gulp-if');
|
var gulpif = require('gulp-if');
|
||||||
var imagemin = require('gulp-imagemin');
|
var imagemin = require('gulp-imagemin');
|
||||||
var jshint = require('gulp-jshint');
|
var eslint = require('gulp-eslint');
|
||||||
var lazypipe = require('lazypipe');
|
var lazypipe = require('lazypipe');
|
||||||
var less = require('gulp-less');
|
var less = require('gulp-less');
|
||||||
var merge = require('merge-stream');
|
var merge = require('merge-stream');
|
||||||
@@ -58,8 +58,8 @@ var enabled = {
|
|||||||
maps: !argv.production,
|
maps: !argv.production,
|
||||||
// Fail styles task on error when `--production`
|
// Fail styles task on error when `--production`
|
||||||
failStyleTask: argv.production,
|
failStyleTask: argv.production,
|
||||||
// Fail due to JSHint warnings only when `--production`
|
// Fail due to ESLint warnings only when `--production`
|
||||||
failJSHint: argv.production,
|
failESLint: argv.production,
|
||||||
// Strip debug statments from javascript when `--production`
|
// Strip debug statments from javascript when `--production`
|
||||||
stripJSDebug: argv.production
|
stripJSDebug: argv.production
|
||||||
};
|
};
|
||||||
@@ -184,9 +184,9 @@ gulp.task('styles', ['wiredep'], function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// ### Scripts
|
// ### Scripts
|
||||||
// `gulp scripts` - Runs JSHint then compiles, combines, and optimizes Bower JS
|
// `gulp scripts` - Runs ESLint then compiles, combines, and optimizes Bower JS
|
||||||
// and project JS.
|
// and project JS.
|
||||||
gulp.task('scripts', ['jshint'], function() {
|
gulp.task('scripts', ['lint'], function() {
|
||||||
var merged = merge();
|
var merged = merge();
|
||||||
manifest.forEachDependency('js', function(dep) {
|
manifest.forEachDependency('js', function(dep) {
|
||||||
merged.add(
|
merged.add(
|
||||||
@@ -221,15 +221,15 @@ gulp.task('images', function() {
|
|||||||
.pipe(browserSync.stream());
|
.pipe(browserSync.stream());
|
||||||
});
|
});
|
||||||
|
|
||||||
// ### JSHint
|
// ### ESLint
|
||||||
// `gulp jshint` - Lints configuration JSON and project JS.
|
// `gulp lint` - Lints configuration JSON and project JS.
|
||||||
gulp.task('jshint', function() {
|
gulp.task('lint', function() {
|
||||||
return gulp.src([
|
return gulp.src([
|
||||||
'bower.json', 'gulpfile.js'
|
'gulpfile.js'
|
||||||
].concat(project.js))
|
].concat(project.js))
|
||||||
.pipe(jshint())
|
.pipe(eslint())
|
||||||
.pipe(jshint.reporter('jshint-stylish'))
|
.pipe(eslint.format())
|
||||||
.pipe(gulpif(enabled.failJSHint, jshint.reporter('fail')));
|
.pipe(gulpif(enabled.failESLint, eslint.failAfterError()));
|
||||||
});
|
});
|
||||||
|
|
||||||
// ### Clean
|
// ### Clean
|
||||||
@@ -252,7 +252,7 @@ gulp.task('watch', function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
gulp.watch([path.source + 'styles/**/*'], ['styles']);
|
gulp.watch([path.source + 'styles/**/*'], ['styles']);
|
||||||
gulp.watch([path.source + 'scripts/**/*'], ['jshint', 'scripts']);
|
gulp.watch([path.source + 'scripts/**/*'], ['lint', 'scripts']);
|
||||||
gulp.watch([path.source + 'fonts/**/*'], ['fonts']);
|
gulp.watch([path.source + 'fonts/**/*'], ['fonts']);
|
||||||
gulp.watch([path.source + 'images/**/*'], ['images']);
|
gulp.watch([path.source + 'images/**/*'], ['images']);
|
||||||
gulp.watch(['bower.json', 'assets/manifest.json'], ['build']);
|
gulp.watch(['bower.json', 'assets/manifest.json'], ['build']);
|
||||||
|
|||||||
34
package.json
34
package.json
@@ -19,8 +19,7 @@
|
|||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "bower install && gulp",
|
"build": "bower install && gulp",
|
||||||
"jshint": "gulp jshint",
|
"lint": "gulp lint"
|
||||||
"jscs": "jscs gulpfile.js assets/scripts/*.js"
|
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 0.12.0",
|
"node": ">= 0.12.0",
|
||||||
@@ -28,31 +27,30 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"asset-builder": "^1.1.0",
|
"asset-builder": "^1.1.0",
|
||||||
"browser-sync": "^2.8.2",
|
"browser-sync": "^2.10.1",
|
||||||
"del": "^1.2.1",
|
"del": "^2.2.0",
|
||||||
"gulp": "^3.9.0",
|
"gulp": "^3.9.0",
|
||||||
"gulp-autoprefixer": "^2.3.1",
|
"gulp-autoprefixer": "^3.1.0",
|
||||||
"gulp-changed": "^1.3.0",
|
"gulp-changed": "^1.3.0",
|
||||||
"gulp-concat": "^2.6.0",
|
"gulp-concat": "^2.6.0",
|
||||||
"gulp-cssnano": "^2.1.0",
|
"gulp-cssnano": "^2.1.0",
|
||||||
"gulp-flatten": "0.1.1",
|
"gulp-eslint": "^1.1.1",
|
||||||
"gulp-if": "^1.2.5",
|
"gulp-flatten": "0.2.0",
|
||||||
"gulp-imagemin": "^2.3.0",
|
"gulp-if": "^2.0.0",
|
||||||
"gulp-jshint": "^1.11.2",
|
"gulp-imagemin": "^2.4.0",
|
||||||
"gulp-less": "^3.0.3",
|
"gulp-less": "^3.0.5",
|
||||||
"gulp-plumber": "^1.0.1",
|
"gulp-plumber": "^1.0.1",
|
||||||
"gulp-rename": "^1.2.2",
|
"gulp-rename": "^1.2.2",
|
||||||
"gulp-rev": "^6.0.0",
|
"gulp-rev": "^6.0.1",
|
||||||
"gulp-sass": "^2.0.1",
|
"gulp-sass": "^2.1.1",
|
||||||
"gulp-sourcemaps": "^1.5.2",
|
"gulp-sourcemaps": "^1.6.0",
|
||||||
"gulp-uglify": "^1.2.0",
|
"gulp-uglify": "^1.5.1",
|
||||||
"imagemin-pngcrush": "^4.1.0",
|
"imagemin-pngcrush": "^4.1.0",
|
||||||
"jshint-stylish": "^2.0.1",
|
|
||||||
"lazypipe": "^1.0.1",
|
"lazypipe": "^1.0.1",
|
||||||
"merge-stream": "^1.0.0",
|
"merge-stream": "^1.0.0",
|
||||||
"minimist": "^1.1.3",
|
"minimist": "^1.2.0",
|
||||||
"run-sequence": "^1.1.2",
|
"run-sequence": "^1.1.5",
|
||||||
"traverse": "^0.6.6",
|
"traverse": "^0.6.6",
|
||||||
"wiredep": "^2.2.2"
|
"wiredep": "^3.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user