-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
79 lines (74 loc) · 2.05 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
'use strict';
var gulp = require('gulp');
var htmlhint = require('gulp-htmlhint');
var eslint = require('gulp-eslint');
var csslint = require('gulp-csslint');
gulp.task('htmlhint', function() {
return gulp.src(['src/index.html'])
.pipe(htmlhint({
// https://github.com/yaniswang/HTMLHint/wiki/Rules
// Standard
'tagname-lowercase': true,
'attr-lowercase': true,
'attr-value-double-quotes': true,
'attr-value-not-empty': true,
'attr-no-duplication': true,
'doctype-first': true,
'tag-pair': true,
'tag-self-close': true,
'spec-char-escape': true,
'id-unique': true,
'src-not-empty': true,
'title-require': true,
// Performance
'head-script-disabled': false,
// Accessibility
'alt-require': false,
// Specification
'doctype-html5': true,
'id-class-value': 'dash',
'style-disabled': true,
'inline-style-disabled': true,
'inline-script-disabled': true,
'space-tab-mixed-disabled': 'tab',
'id-class-ad-disabled': true,
'href-abs-or-rel': false,
'attr-unsafe-chars': true
}))
.pipe(htmlhint.reporter())
.pipe(htmlhint.reporter('fail'));
});
gulp.task('csslint', function () {
return gulp.src(['src/css/**/*.css'])
.pipe(csslint({
'adjoining-classes': false,
// FIXME: 警告が多すぎるため、一旦無視
'fallback-colors': false,
'qualified-headings': false,
'unique-headings': false
}))
.pipe(csslint.reporter())
.pipe(csslint.reporter('fail'));
});
gulp.task('eslint', function () {
return gulp.src(['src/js/**/*.js'])
.pipe(eslint({
extends: 'xo/browser',
envs: [
'browser',
'jquery'
],
globals: {
'$$': true
},
rules: {
'new-cap': [2, {'capIsNewExceptions': ['$.Deferred']}],
'quote-props': [2, 'as-needed', { 'keywords': true, 'unnecessary': false }],
'no-unused-expressions': [2, { allowShortCircuit: true, allowTernary: true }],
'operator-linebreak': [2, 'before', {'overrides': {'=': 'after'}}]
}
}))
.pipe(eslint.format())
.pipe(eslint.failOnError());
});
gulp.task('lint', ['htmlhint', 'csslint', 'eslint']);