Skip to content
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

Enable tslint #1

Merged
merged 3 commits into from
Jan 18, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
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: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"tslint.rulesDirectory": "node_modules/tslint-microsoft-contrib"
}
26 changes: 26 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"version": "0.1.0",
"command": "gulp",
"isShellCommand": true,
"tasks": [
{
"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
}
}
}
]
}
35 changes: 35 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
var gulp = require('gulp');
var decompress = require('gulp-decompress');
var tslint = require("gulp-tslint");
var filter = require('gulp-filter');
var es = require('event-stream');
Copy link
Contributor

Choose a reason for hiding this comment

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

unused

var GitHub = require('github-releases');
var tmp = require('tmp');
Expand Down Expand Up @@ -57,6 +59,39 @@ gulp.task('omnisharp:fetch', ['omnisharp:clean'], function () {
.pipe(gulp.dest('bin'));
});

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

var tslintFilter = [
'**',
'!**/*.d.ts',
'!**/typings/**',
'!**/*.test.ts',
'!src/vs/editor/standalone-languages/test/**'
];

Copy link
Contributor

Choose a reason for hiding this comment

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

unused

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))
Copy link
Contributor

Choose a reason for hiding this comment

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

@egamma To my knowledge you don't need the filter but you can invoke src like so gulp.src(['src/**/*.ts', '!**/*.d.ts', '!**/typings**',etc]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, this works and it is simpler, updated the PR.

.pipe(tslint({
rulesDirectory: "node_modules/tslint-microsoft-contrib"
}))
.pipe(tslint.report(lintReporter, {
summarizeFailureOutput: false,
emitError: false
}))
});

gulp.task('omnisharp:fixscripts', ['omnisharp:fetch'], function () {

var _fixes = Object.create(null);
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@
"github-releases": "^0.3.0",
"gulp": "^3.8.9",
"gulp-decompress": "^1.2.0",
"gulp-filter": "^3.0.1",
"tmp": "0.0.28",
"vinyl-fs": "^2.2.1",
"typescript": "^1.7.3"
"typescript": "^1.7.3",
"gulp-tslint": "^4.3.0",
"tslint-microsoft-contrib": "^2.0.0"
},
"engines": {
"vscode": "^0.10.1"
Expand Down
12 changes: 12 additions & 0 deletions tslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"rules": {
"no-unused-expression": true,
"no-unused-variable": true,
"no-unreachable": true,
"no-duplicate-variable": true,
"no-var-keyword": true,
"promise-must-complete": true,
"curly": true,
"semicolon": true
}
}