Skip to content

Commit 82a486b

Browse files
authored
lint samples (#194)
* Upgrade gulp * lint samples
1 parent e5c0a3a commit 82a486b

File tree

12 files changed

+2587
-682
lines changed

12 files changed

+2587
-682
lines changed

.eslintrc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ parserOptions:
66
env:
77
browser: true
88
node: true
9+
10+
plugins: ['html']

.htmllintrc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"indent-style": "tabs",
3+
"line-end-style": false,
4+
"spec-char-escape": false,
5+
"attr-bans": [
6+
"align",
7+
"background",
8+
"bgcolor",
9+
"border",
10+
"frameborder",
11+
"longdesc",
12+
"marginwidth",
13+
"marginheight",
14+
"scrolling"
15+
],
16+
"tag-bans": [ "b", "i" ],
17+
"id-class-style": false
18+
}

gulpfile.js

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
var gulp = require('gulp'),
22
eslint = require('gulp-eslint'),
33
util = require('gulp-util'),
4+
htmllint = require('gulp-htmllint'),
45
inquirer = require('inquirer'),
56
semver = require('semver'),
67
fs = require('fs'),
@@ -20,11 +21,13 @@ function run(bin, args, done) {
2021
ps.on('close', () => done());
2122
}
2223

23-
gulp.task('default', ['lint', 'build', 'watch']);
2424
gulp.task('build', buildTask);
2525
gulp.task('bump', bumpTask);
26-
gulp.task('lint', lintTask);
26+
gulp.task('lint-html', lintHtmlTask);
27+
gulp.task('lint-js', lintJsTask);
28+
gulp.task('lint', gulp.parallel('lint-html', 'lint-js'));
2729
gulp.task('watch', watchTask);
30+
gulp.task('default', gulp.parallel('lint', 'build', 'watch'));
2831

2932
function buildTask(done) {
3033
run('rollup/bin/rollup', ['-c'], done);
@@ -59,10 +62,12 @@ function bumpTask(complete) {
5962
});
6063
}
6164

62-
function lintTask() {
65+
function lintJsTask() {
6366
var files = [
67+
'samples/**/*.html',
6468
'samples/**/*.js',
65-
'src/**/*.js'
69+
'src/**/*.js',
70+
'test/**/*.js'
6671
];
6772

6873
// NOTE(SB) codeclimate has 'complexity' and 'max-statements' eslint rules way too strict
@@ -81,6 +86,13 @@ function lintTask() {
8186
.pipe(eslint.failAfterError());
8287
}
8388

89+
function lintHtmlTask() {
90+
return gulp.src('samples/**/*.html')
91+
.pipe(htmllint({
92+
failOnError: true,
93+
}));
94+
}
95+
8496
function watchTask() {
85-
return gulp.watch(srcFiles, ['lint', 'build']);
97+
return gulp.watch(srcFiles, gulp.parallel('lint', 'build'));
8698
}

0 commit comments

Comments
 (0)