Skip to content

Adding tslint and gulp #1403

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jan 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ addons:
script:
- cd Extension
- npm install
- npm run tslint
- npm run pretest
- npm run test

Expand Down
14 changes: 13 additions & 1 deletion Extension/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# ignore dependency packages
node_modules

# ignore compliled typescript
out

# ignore downloaded extension files and folders
server
node_modules
debugAdapters
LLVM
bin/Microsoft.VSCode.CPP.*

# ignore lock files
install.lock

# ignore generated packages
*.vsix
46 changes: 46 additions & 0 deletions Extension/gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

'use strict';

const gulp = require('gulp');
const tslint = require('gulp-tslint');
const mocha = require('gulp-mocha');

gulp.task('unitTest', () => {
gulp.src('./out/test/unitTests', {read: false}).pipe(
mocha({
ui: "tdd"
})
);
});

/// Misc Tasks
const allTypeScript = [
'src/**/*.ts',
'!**/*.d.ts',
'!**/typings**'
];

const lintReporter = (output, file, options) => {
//emits: src/helloWorld.c:5:3: warning: implicit declaration of function ‘prinft’
var relativeBase = file.base.substring(file.cwd.length + 1).replace('\\', '/');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see if you could get source navigation from the lint output to code, from vscode build output.

output.forEach(e => {
var message = relativeBase + e.name + ':' + (e.startPosition.line + 1) + ':' + (e.startPosition.character + 1) + ': ' + e.failure;
console.log('[tslint] ' + message);
});
};

gulp.task('tslint', () => {
gulp.src(allTypeScript)
.pipe(tslint({
program: require('tslint').Linter.createProgram("./tsconfig.json"),
configuration: "./tslint.json"
}))
.pipe(tslint.report(lintReporter, {
summarizeFailureOutput: false,
emitError: false
}))
});
Loading