Skip to content

Commit 97f0bfc

Browse files
author
Yui T
committed
apply tslint rule to scripts\tslint
1 parent c94dcbd commit 97f0bfc

2 files changed

Lines changed: 14 additions & 4 deletions

File tree

Jakefile.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,16 @@ var serverCoreSources = [
106106
return path.join(serverDirectory, f);
107107
});
108108

109+
var scriptSources = [
110+
"tslint/booleanTriviaRule.ts",
111+
"tslint/nextLineRule.ts",
112+
"tslint/noNullRule.ts",
113+
"tslint/preferConstRule.ts",
114+
"tslint/typeOperatorSpacingRule.ts"
115+
].map(function (f) {
116+
return path.join(scriptsDirectory, f);
117+
});
118+
109119
var serverSources = serverCoreSources.concat(servicesSources);
110120

111121
var languageServiceLibrarySources = [
@@ -365,7 +375,6 @@ file(builtGeneratedDiagnosticMessagesJSON,[generatedDiagnosticMessagesJSON], fun
365375
desc("Generates a diagnostic file in TypeScript based on an input JSON file");
366376
task("generate-diagnostics", [diagnosticInfoMapTs]);
367377

368-
369378
// Publish nightly
370379
var configureNightlyJs = path.join(scriptsDirectory, "configureNightly.js");
371380
var configureNightlyTs = path.join(scriptsDirectory, "configureNightly.ts");
@@ -909,7 +918,8 @@ function lintFileAsync(options, path, cb) {
909918

910919
var lintTargets = compilerSources
911920
.concat(harnessCoreSources)
912-
.concat(serverCoreSources);
921+
.concat(serverCoreSources)
922+
.concat(scriptSources);
913923

914924
desc("Runs tslint on the compiler sources");
915925
task("lint", ["build-rules"], function() {

scripts/tslint/typeOperatorSpacingRule.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ export class Rule extends Lint.Rules.AbstractRule {
1313
class TypeOperatorSpacingWalker extends Lint.RuleWalker {
1414
public visitNode(node: ts.Node) {
1515
if (node.kind === ts.SyntaxKind.UnionType || node.kind === ts.SyntaxKind.IntersectionType) {
16-
let types = (<ts.UnionOrIntersectionTypeNode>node).types;
16+
const types = (<ts.UnionOrIntersectionTypeNode>node).types;
1717
let expectedStart = types[0].end + 2; // space, | or &
1818
for (let i = 1; i < types.length; i++) {
19-
let currentType = types[i];
19+
const currentType = types[i];
2020
if (expectedStart !== currentType.pos || currentType.getLeadingTriviaWidth() !== 1) {
2121
const failure = this.createFailure(currentType.pos, currentType.getWidth(), Rule.FAILURE_STRING);
2222
this.addFailure(failure);

0 commit comments

Comments
 (0)