Merge pull request #12376 from Microsoft/vladima/update-tslint

update to tslint@next
This commit is contained in:
Vladimir Matveev 2016-11-19 10:58:36 -08:00 committed by GitHub
commit f2a7434fa3
9 changed files with 21 additions and 17 deletions

View file

@ -1,26 +1,29 @@
var Linter = require("tslint");
var tslint = require("tslint");
var fs = require("fs");
function getLinterOptions() {
return {
configuration: require("../tslint.json"),
formatter: "prose",
formattersDirectory: undefined,
rulesDirectory: "built/local/tslint"
};
}
function lintFileContents(options, path, contents) {
var ll = new Linter(path, contents, options);
return ll.lint();
function getLinterConfiguration() {
return require("../tslint.json");
}
function lintFileAsync(options, path, cb) {
function lintFileContents(options, configuration, path, contents) {
var ll = new tslint.Linter(options);
ll.lint(path, contents, configuration);
return ll.getResult();
}
function lintFileAsync(options, configuration, path, cb) {
fs.readFile(path, "utf8", function (err, contents) {
if (err) {
return cb(err);
}
var result = lintFileContents(options, path, contents);
var result = lintFileContents(options, configuration, path, contents);
cb(undefined, result);
});
}
@ -30,7 +33,8 @@ process.on("message", function (data) {
case "file":
var target = data.name;
var lintOptions = getLinterOptions();
lintFileAsync(lintOptions, target, function (err, result) {
var lintConfiguration = getLinterConfiguration();
lintFileAsync(lintOptions, lintConfiguration, target, function (err, result) {
if (err) {
process.send({ kind: "error", error: err.toString() });
return;

View file

@ -1,4 +1,4 @@
import * as Lint from "tslint/lib/lint";
import * as Lint from "tslint/lib";
import * as ts from "typescript";
export class Rule extends Lint.Rules.AbstractRule {

View file

@ -1,4 +1,4 @@
import * as Lint from "tslint/lib/lint";
import * as Lint from "tslint/lib";
import * as ts from "typescript";
const OPTION_CATCH = "check-catch";

View file

@ -1,4 +1,4 @@
import * as Lint from "tslint/lib/lint";
import * as Lint from "tslint/lib";
import * as ts from "typescript";

View file

@ -1,4 +1,4 @@
import * as Lint from "tslint/lib/lint";
import * as Lint from "tslint/lib";
import * as ts from "typescript";

View file

@ -1,4 +1,4 @@
import * as Lint from "tslint/lib/lint";
import * as Lint from "tslint/lib";
import * as ts from "typescript";

View file

@ -1,4 +1,4 @@
import * as Lint from "tslint/lib/lint";
import * as Lint from "tslint/lib";
import * as ts from "typescript";

View file

@ -1,4 +1,4 @@
import * as Lint from "tslint/lib/lint";
import * as Lint from "tslint/lib";
import * as ts from "typescript";
export class Rule extends Lint.Rules.AbstractRule {

View file

@ -1,4 +1,4 @@
import * as Lint from "tslint/lib/lint";
import * as Lint from "tslint/lib";
import * as ts from "typescript";