Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

enable tslint #39

Merged
merged 1 commit into from
Jan 18, 2016
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
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Place your settings in this file to overwrite default and user settings.
{
"explorer.workingFiles.maxVisible": 30
"explorer.workingFiles.maxVisible": 30,
"tslint.rulesDirectory": "node_modules/tslint-microsoft-contrib"
}
23 changes: 21 additions & 2 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"version": "0.1.0",
"command": "gulp",
"isShellCommand": true,
"isShellCommand": true,
"tasks": [
{
"taskName": "ts-watch",
Expand All @@ -20,6 +20,25 @@
"watchedTaskBeginsRegExp": "^\\*\\*\\* Starting\\.\\.\\.$",
"watchedTaskEndsRegExp": "^\\*\\*\\* Finished with \\d+ errors\\.$"
}
}
},
{
"taskName": "tslint",
"args": [],
"problemMatcher": {
"owner": "tslint",
"fileLocation": [
"relative",
"${workspaceRoot}"
],
"severity": "warning",
"pattern": {
"regexp": "^\\[tslint\\] (.*):(\\d+):(\\d+):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"message": 4
}
}
}
]
}
33 changes: 33 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ var gulp = require('gulp');
var path = require('path');
var tsb = require('gulp-tsb');
var log = require('gulp-util').log;
var tslint = require("gulp-tslint");
var filter = require('gulp-filter');
var azure = require('gulp-azure-storage');
var git = require('git-rev-sync');
var del = require('del');
Expand Down Expand Up @@ -79,3 +81,34 @@ gulp.task('internal-upload', function() {
container: 'debuggers'
}));
});

var allTypeScript = [
'src/**/*.ts'
];

var tslintFilter = [
'**',
'!**/*.d.ts',
'!**/typings/**'
];

var lintReporter = function (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('\\', '/');
output.forEach(function(e) {
var message = relativeBase + e.name + ':' + (e.startPosition.line + 1) + ':' + (e.startPosition.character + 1) + ': ' + e.failure;
console.log('[tslint] ' + message);
});
};

gulp.task('tslint', function () {
gulp.src(allTypeScript)
.pipe(filter(tslintFilter))
.pipe(tslint({
rulesDirectory: "node_modules/tslint-microsoft-contrib"
}))
.pipe(tslint.report(lintReporter, {
summarizeFailureOutput: false,
emitError: false
}))
});
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@
"gulp": "^3.9.0",
"gulp-util": "^3.0.5",
"gulp-tsb": "*",
"gulp-filter": "^3.0.1",
"gulp-azure-storage": "*",
"gulp-tslint": "^4.3.0",
"tslint-microsoft-contrib": "^2.0.0",
"git-rev-sync": "*",
"del": "*",
"run-sequence": "*",
Expand Down
10 changes: 10 additions & 0 deletions tslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"rules": {
"no-unused-expression": true,
"no-unused-variable": true,
"no-unreachable": true,
"no-duplicate-variable": true,
"promise-must-complete": true
}
}