Merge pull request #5742 from Microsoft/applylinteronscripts
Apply Tslint on scripts
This commit is contained in:
commit
fecf99cf75
2 changed files with 14 additions and 4 deletions
14
Jakefile.js
14
Jakefile.js
|
@ -106,6 +106,16 @@ var serverCoreSources = [
|
|||
return path.join(serverDirectory, f);
|
||||
});
|
||||
|
||||
var scriptSources = [
|
||||
"tslint/booleanTriviaRule.ts",
|
||||
"tslint/nextLineRule.ts",
|
||||
"tslint/noNullRule.ts",
|
||||
"tslint/preferConstRule.ts",
|
||||
"tslint/typeOperatorSpacingRule.ts"
|
||||
].map(function (f) {
|
||||
return path.join(scriptsDirectory, f);
|
||||
});
|
||||
|
||||
var serverSources = serverCoreSources.concat(servicesSources);
|
||||
|
||||
var languageServiceLibrarySources = [
|
||||
|
@ -365,7 +375,6 @@ file(builtGeneratedDiagnosticMessagesJSON,[generatedDiagnosticMessagesJSON], fun
|
|||
desc("Generates a diagnostic file in TypeScript based on an input JSON file");
|
||||
task("generate-diagnostics", [diagnosticInfoMapTs]);
|
||||
|
||||
|
||||
// Publish nightly
|
||||
var configureNightlyJs = path.join(scriptsDirectory, "configureNightly.js");
|
||||
var configureNightlyTs = path.join(scriptsDirectory, "configureNightly.ts");
|
||||
|
@ -909,7 +918,8 @@ function lintFileAsync(options, path, cb) {
|
|||
|
||||
var lintTargets = compilerSources
|
||||
.concat(harnessCoreSources)
|
||||
.concat(serverCoreSources);
|
||||
.concat(serverCoreSources)
|
||||
.concat(scriptSources);
|
||||
|
||||
desc("Runs tslint on the compiler sources");
|
||||
task("lint", ["build-rules"], function() {
|
||||
|
|
|
@ -13,10 +13,10 @@ export class Rule extends Lint.Rules.AbstractRule {
|
|||
class TypeOperatorSpacingWalker extends Lint.RuleWalker {
|
||||
public visitNode(node: ts.Node) {
|
||||
if (node.kind === ts.SyntaxKind.UnionType || node.kind === ts.SyntaxKind.IntersectionType) {
|
||||
let types = (<ts.UnionOrIntersectionTypeNode>node).types;
|
||||
const types = (<ts.UnionOrIntersectionTypeNode>node).types;
|
||||
let expectedStart = types[0].end + 2; // space, | or &
|
||||
for (let i = 1; i < types.length; i++) {
|
||||
let currentType = types[i];
|
||||
const currentType = types[i];
|
||||
if (expectedStart !== currentType.pos || currentType.getLeadingTriviaWidth() !== 1) {
|
||||
const failure = this.createFailure(currentType.pos, currentType.getWidth(), Rule.FAILURE_STRING);
|
||||
this.addFailure(failure);
|
||||
|
|
Loading…
Reference in a new issue