Skip to content

Commit c728178

Browse files
authored
Adding tslint and gulp (#1403)
* Adding Gulp and tslint Adding tslint and the associated changes that it complains about. Adding gulp to do tests, tslint, and more. Including package-lock.json that it keeps complaining about. * Adding back license that was accidently deleted. * Updating package-lock.json and missing import * Sorting and fixing commands for npm run Added npm run test, watch, and tslint. * Adding rules for whitespace and types for tslint * Updating .gitignore rules * Adding more rules and sorting tslint.json new-parens for forcing all constructor calls to have parenthesis. no more than 1 consecutive blank lines no useage of String(), Boolean(), or Number(), use native type. * Adding rule to force brance on the same line * tslint rule to add function return types * Adding tslint as part of travisci
1 parent ab5ff3c commit c728178

29 files changed

+5930
-649
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ addons:
1313
script:
1414
- cd Extension
1515
- npm install
16+
- npm run tslint
1617
- npm run pretest
1718
- npm run test
1819

Extension/.gitignore

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
1+
# ignore dependency packages
2+
node_modules
3+
4+
# ignore compliled typescript
15
out
6+
7+
# ignore downloaded extension files and folders
28
server
3-
node_modules
49
debugAdapters
10+
LLVM
11+
bin/Microsoft.VSCode.CPP.*
12+
13+
# ignore lock files
14+
install.lock
15+
16+
# ignore generated packages
517
*.vsix

Extension/gulpfile.js

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
'use strict';
7+
8+
const gulp = require('gulp');
9+
const tslint = require('gulp-tslint');
10+
const mocha = require('gulp-mocha');
11+
12+
gulp.task('unitTest', () => {
13+
gulp.src('./out/test/unitTests', {read: false}).pipe(
14+
mocha({
15+
ui: "tdd"
16+
})
17+
);
18+
});
19+
20+
/// Misc Tasks
21+
const allTypeScript = [
22+
'src/**/*.ts',
23+
'!**/*.d.ts',
24+
'!**/typings**'
25+
];
26+
27+
const lintReporter = (output, file, options) => {
28+
//emits: src/helloWorld.c:5:3: warning: implicit declaration of function ‘prinft’
29+
var relativeBase = file.base.substring(file.cwd.length + 1).replace('\\', '/');
30+
output.forEach(e => {
31+
var message = relativeBase + e.name + ':' + (e.startPosition.line + 1) + ':' + (e.startPosition.character + 1) + ': ' + e.failure;
32+
console.log('[tslint] ' + message);
33+
});
34+
};
35+
36+
gulp.task('tslint', () => {
37+
gulp.src(allTypeScript)
38+
.pipe(tslint({
39+
program: require('tslint').Linter.createProgram("./tsconfig.json"),
40+
configuration: "./tslint.json"
41+
}))
42+
.pipe(tslint.report(lintReporter, {
43+
summarizeFailureOutput: false,
44+
emitError: false
45+
}))
46+
});

0 commit comments

Comments
 (0)