-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
69 lines (61 loc) · 1.46 KB
/
index.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
#!/usr/bin/env node
const meta = require('./package.json');
// Dependencies
const debug = require('gulp-debug');
const gulp = require('gulp');
const jsonLint = require('@prantlf/gulp-jsonlint');
const process = require('process');
const program = require('commander');
const tsLint = require('gulp-tslint');
const xmlValidator = require('gulp-xml-validator');
program
.version(meta.version)
.description('Lints common file-types used in VSCode extensions')
.arguments('[directory]')
.usage('[directory]')
.parse(process.argv);
// Gulp options
const options = {
allowEmpty: true,
cwd: program.args && program.args.length ? program.args[0] : process.cwd()
};
const src = {
json: [
'package.json',
'snippets/**/*.json',
'tsconfig.json',
'tslint.json',
'!bower_components/**/*',
'!node_modules/**/*'
],
ts: [
'src/**/*.ts',
'!bower_components/**/*',
'!node_modules/**/*'
],
xml: [
'**/*.svg',
'**/*.tmLanguage',
'**/*.tmTheme',
'!bower_components/**/*',
'!node_modules/**/*'
],
};
// Lint JSON
gulp.src(src.json, options)
.pipe(debug({title: 'Lint JSON:'}))
.pipe(jsonLint({
ignoreComments: true,
}))
.pipe(jsonLint.failOnError());
// Lint TypeScript
gulp.src(src.ts, options)
.pipe(debug({title: 'Lint TypeScript:'}))
.pipe(tsLint({
formatter: 'prose'
}))
.pipe(tsLint.report());
// Validate XML
gulp.src(src.xml, options)
.pipe(debug({title: 'Lint XML:'}))
.pipe(xmlValidator());