-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
141 lines (125 loc) · 3.26 KB
/
gulpfile.js
File metadata and controls
141 lines (125 loc) · 3.26 KB
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
var gulp = require('gulp');
var baseSrc = 'sample-files/';
/**
Favorites:
- htmllint
- eslint
- stylelint
- phpcs
*/
function lint_htmlhint(){
var htmlhint = require('gulp-htmlhint');
// return gulp.src([baseSrc + '**/*.html', baseSrc + '**/*.htm', '!./node_modules/**'])
return gulp.src([baseSrc + '**/*.html', baseSrc + '**/*.htm'])
.pipe(htmlhint({
htmlhintrc: './.htmlhintrc'
}))
.pipe(htmlhint.reporter())
.pipe(htmlhint.failReporter({ suppress: true }));
}
gulp.task('lint:htmlhint', lint_htmlhint);
function lint_htmllint(){
var htmllint = require('gulp-htmllint');
return gulp.src(baseSrc + '**/*.html')
.pipe(htmllint());
}
gulp.task('lint:htmllint', lint_htmllint);
function lint_eslint(){
var eslint = require('gulp-eslint');
return gulp.src(baseSrc + '**/*.js')
.pipe(eslint({
configFile: './.eslintrc.js'
}))
.pipe(eslint.format())
.pipe(eslint.failAfterError());
}
gulp.task('lint:eslint', lint_eslint);
function lint_jshint(){
var jshint = require('gulp-jshint');
return gulp.src(baseSrc + '**/*.js')
.pipe(jshint())
.pipe(jshint.reporter('default'));
}
gulp.task('lint:jshint', lint_jshint);
function lint_jslint(){
var jslint = require('gulp-jslint');
return gulp.src(baseSrc + '**/*.js')
.pipe(jslint())
.pipe(jslint.reporter('default'));
}
gulp.task('lint:jslint', lint_jslint);
function lint_csslint(){
var csslint = require('gulp-csslint');
return gulp.src(baseSrc + '**/*.css')
.pipe(csslint())
.pipe(csslint.formatter());
}
gulp.task('lint:csslint', lint_csslint);
function lint_stylelint(){
var stylelint = require('gulp-stylelint');
return gulp.src(baseSrc + '**/*.css')
.pipe(stylelint({
configFile: '.stylelintrc.json',
reporters: [
{
formatter: 'string',
save: 'output/stylelint.txt',
console: true
},
{
formatter: 'json',
save: 'output/stylelint.json',
console: false
}
]
}));
}
gulp.task('lint:stylelint', lint_stylelint);
function lint_phplint(callback){
var phplint = require('phplint').lint;
return phplint([baseSrc + '**/*.php'], {}, function (err) {
if (err) {
callback(err);
} else {
callback();
}
});
}
gulp.task('lint:phplint', lint_phplint);
function lint_phpcs(){
var phpcs = require('gulp-phpcs');
return gulp.src([baseSrc + '**/*.php'])
.pipe(phpcs({
// standard: 'Zend', // MySource, PEAR, PSR1, PSR12, PSR2, Squiz and Zend
standard: './phpcs.xml',
warningSeverity: 0
}))
.pipe(phpcs.reporter('log'));
}
gulp.task('lint:phpcs', lint_phpcs);
function lint_remark(){
var remark = require('gulp-remark');
var html = require('remark-html');
var lint = require('remark-preset-lint-markdown-style-guide');
return gulp.src(baseSrc + '**/*.md')
.pipe(remark().use(html).use(lint));
}
gulp.task('lint:remark', lint_remark);
function lint_markdownlint(){
var through2 = require('through2');
var markdownlint = require('markdownlint');
return gulp.src('*.md', { 'read': false })
.pipe(through2.obj(function obj(file, enc, next) {
markdownlint(
{ 'files': [ file.relative ] },
function callback(err, result) {
var resultString = (result || '').toString();
if (resultString) {
console.log(resultString);
}
next(err, file);
}
);
}));
}
gulp.task('lint:markdownlint', lint_markdownlint);