@@ -12,10 +12,10 @@ declare var process: any;
1212declare var console: any;
1313>console : any
1414
15- declare var fs : any;
16- >fs : any
15+ declare var readFileSync : any;
16+ >readFileSync : any
1717
18- import ts = require( "typescript") ;
18+ import * as ts from "typescript";
1919>ts : typeof ts
2020
2121export function delint(sourceFile: ts.SourceFile) {
@@ -91,14 +91,15 @@ export function delint(sourceFile: ts.SourceFile) {
9191>node : ts.Node
9292 }
9393 break;
94+
9495 case ts.SyntaxKind.IfStatement:
9596>ts.SyntaxKind.IfStatement : ts.SyntaxKind
9697>ts.SyntaxKind : typeof ts.SyntaxKind
9798>ts : typeof ts
9899>SyntaxKind : typeof ts.SyntaxKind
99100>IfStatement : ts.SyntaxKind
100101
101- var ifStatement = (<ts.IfStatement>node);
102+ let ifStatement = (<ts.IfStatement>node);
102103>ifStatement : ts.IfStatement
103104>(<ts.IfStatement>node) : ts.IfStatement
104105><ts.IfStatement>node : ts.IfStatement
@@ -127,13 +128,13 @@ export function delint(sourceFile: ts.SourceFile) {
127128>thenStatement : ts.Statement
128129 }
129130 if (ifStatement.elseStatement &&
130- >ifStatement.elseStatement && ifStatement.elseStatement.kind !== ts.SyntaxKind.Block && ifStatement.elseStatement.kind !== ts.SyntaxKind.IfStatement : boolean
131+ >ifStatement.elseStatement && ifStatement.elseStatement.kind !== ts.SyntaxKind.Block && ifStatement.elseStatement.kind !== ts.SyntaxKind.IfStatement : boolean
131132>ifStatement.elseStatement && ifStatement.elseStatement.kind !== ts.SyntaxKind.Block : boolean
132133>ifStatement.elseStatement : ts.Statement
133134>ifStatement : ts.IfStatement
134135>elseStatement : ts.Statement
135136
136- ifStatement.elseStatement.kind !== ts.SyntaxKind.Block && ifStatement.elseStatement.kind !== ts.SyntaxKind.IfStatement) {
137+ ifStatement.elseStatement.kind !== ts.SyntaxKind.Block &&
137138>ifStatement.elseStatement.kind !== ts.SyntaxKind.Block : boolean
138139>ifStatement.elseStatement.kind : ts.SyntaxKind
139140>ifStatement.elseStatement : ts.Statement
@@ -145,6 +146,8 @@ export function delint(sourceFile: ts.SourceFile) {
145146>ts : typeof ts
146147>SyntaxKind : typeof ts.SyntaxKind
147148>Block : ts.SyntaxKind
149+
150+ ifStatement.elseStatement.kind !== ts.SyntaxKind.IfStatement) {
148151>ifStatement.elseStatement.kind !== ts.SyntaxKind.IfStatement : boolean
149152>ifStatement.elseStatement.kind : ts.SyntaxKind
150153>ifStatement.elseStatement : ts.Statement
@@ -173,7 +176,7 @@ export function delint(sourceFile: ts.SourceFile) {
173176>SyntaxKind : typeof ts.SyntaxKind
174177>BinaryExpression : ts.SyntaxKind
175178
176- var op = (<ts.BinaryExpression>node).operatorToken.kind;
179+ let op = (<ts.BinaryExpression>node).operatorToken.kind;
177180>op : ts.SyntaxKind
178181>(<ts.BinaryExpression>node).operatorToken.kind : ts.SyntaxKind
179182>(<ts.BinaryExpression>node).operatorToken : ts.Node
@@ -185,16 +188,16 @@ export function delint(sourceFile: ts.SourceFile) {
185188>operatorToken : ts.Node
186189>kind : ts.SyntaxKind
187190
188- if (op === ts.SyntaxKind.EqualsEqualsToken || op === ts.SyntaxKind.ExclamationEqualsToken) {
189- >op === ts.SyntaxKind.EqualsEqualsToken || op === ts.SyntaxKind.ExclamationEqualsToken : boolean
191+ if (op === ts.SyntaxKind.EqualsEqualsToken || op == ts.SyntaxKind.ExclamationEqualsToken) {
192+ >op === ts.SyntaxKind.EqualsEqualsToken || op == ts.SyntaxKind.ExclamationEqualsToken : boolean
190193>op === ts.SyntaxKind.EqualsEqualsToken : boolean
191194>op : ts.SyntaxKind
192195>ts.SyntaxKind.EqualsEqualsToken : ts.SyntaxKind
193196>ts.SyntaxKind : typeof ts.SyntaxKind
194197>ts : typeof ts
195198>SyntaxKind : typeof ts.SyntaxKind
196199>EqualsEqualsToken : ts.SyntaxKind
197- >op === ts.SyntaxKind.ExclamationEqualsToken : boolean
200+ >op == ts.SyntaxKind.ExclamationEqualsToken : boolean
198201>op : ts.SyntaxKind
199202>ts.SyntaxKind.ExclamationEqualsToken : ts.SyntaxKind
200203>ts.SyntaxKind : typeof ts.SyntaxKind
@@ -226,8 +229,9 @@ export function delint(sourceFile: ts.SourceFile) {
226229>Node : ts.Node
227230>message : string
228231
229- var lineChar = sourceFile.getLineAndCharacterOfPosition(node.getStart());
230- >lineChar : ts.LineAndCharacter
232+ let { line, character } = sourceFile.getLineAndCharacterOfPosition(node.getStart());
233+ >line : number
234+ >character : number
231235>sourceFile.getLineAndCharacterOfPosition(node.getStart()) : ts.LineAndCharacter
232236>sourceFile.getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter
233237>sourceFile : ts.SourceFile
@@ -237,27 +241,23 @@ export function delint(sourceFile: ts.SourceFile) {
237241>node : ts.Node
238242>getStart : (sourceFile?: ts.SourceFile) => number
239243
240- console.log(`${sourceFile.fileName} (${lineChar. line + 1},${lineChar. character + 1}): ${message}`)
241- >console.log(`${sourceFile.fileName} (${lineChar. line + 1},${lineChar. character + 1}): ${message}`) : any
244+ console.log(`${sourceFile.fileName} (${line + 1},${character + 1}): ${message}`);
245+ >console.log(`${sourceFile.fileName} (${line + 1},${character + 1}): ${message}`) : any
242246>console.log : any
243247>console : any
244248>log : any
245249>sourceFile.fileName : string
246250>sourceFile : ts.SourceFile
247251>fileName : string
248- >lineChar.line + 1 : number
249- >lineChar.line : number
250- >lineChar : ts.LineAndCharacter
252+ >line + 1 : number
251253>line : number
252- >lineChar.character + 1 : number
253- >lineChar.character : number
254- >lineChar : ts.LineAndCharacter
254+ >character + 1 : number
255255>character : number
256256>message : string
257257 }
258258}
259259
260- var fileNames = process.argv.slice(2);
260+ const fileNames = process.argv.slice(2);
261261>fileNames : any
262262>process.argv.slice(2) : any
263263>process.argv.slice : any
@@ -267,26 +267,24 @@ var fileNames = process.argv.slice(2);
267267>slice : any
268268
269269fileNames.forEach(fileName => {
270- >fileNames.forEach(fileName => { // Parse a file var sourceFile = ts.createSourceFile(fileName, fs. readFileSync(fileName).toString(), ts.ScriptTarget.ES6, /*setParentNodes */ true); // delint it delint(sourceFile);}) : any
270+ >fileNames.forEach(fileName => { // Parse a file let sourceFile = ts.createSourceFile(fileName, readFileSync(fileName).toString(), ts.ScriptTarget.ES6, /*setParentNodes */ true); // delint it delint(sourceFile);}) : any
271271>fileNames.forEach : any
272272>fileNames : any
273273>forEach : any
274- >fileName => { // Parse a file var sourceFile = ts.createSourceFile(fileName, fs. readFileSync(fileName).toString(), ts.ScriptTarget.ES6, /*setParentNodes */ true); // delint it delint(sourceFile);} : (fileName: any) => void
274+ >fileName => { // Parse a file let sourceFile = ts.createSourceFile(fileName, readFileSync(fileName).toString(), ts.ScriptTarget.ES6, /*setParentNodes */ true); // delint it delint(sourceFile);} : (fileName: any) => void
275275>fileName : any
276276
277277 // Parse a file
278- var sourceFile = ts.createSourceFile(fileName, fs. readFileSync(fileName).toString(), ts.ScriptTarget.ES6, /*setParentNodes */ true);
278+ let sourceFile = ts.createSourceFile(fileName, readFileSync(fileName).toString(), ts.ScriptTarget.ES6, /*setParentNodes */ true);
279279>sourceFile : ts.SourceFile
280- >ts.createSourceFile(fileName, fs. readFileSync(fileName).toString(), ts.ScriptTarget.ES6, /*setParentNodes */ true) : ts.SourceFile
280+ >ts.createSourceFile(fileName, readFileSync(fileName).toString(), ts.ScriptTarget.ES6, /*setParentNodes */ true) : ts.SourceFile
281281>ts.createSourceFile : (fileName: string, sourceText: string, languageVersion: ts.ScriptTarget, setParentNodes?: boolean) => ts.SourceFile
282282>ts : typeof ts
283283>createSourceFile : (fileName: string, sourceText: string, languageVersion: ts.ScriptTarget, setParentNodes?: boolean) => ts.SourceFile
284284>fileName : any
285- >fs.readFileSync(fileName).toString() : any
286- >fs.readFileSync(fileName).toString : any
287- >fs.readFileSync(fileName) : any
288- >fs.readFileSync : any
289- >fs : any
285+ >readFileSync(fileName).toString() : any
286+ >readFileSync(fileName).toString : any
287+ >readFileSync(fileName) : any
290288>readFileSync : any
291289>fileName : any
292290>toString : any
@@ -303,7 +301,6 @@ fileNames.forEach(fileName => {
303301>sourceFile : ts.SourceFile
304302
305303});
306-
307304=== typescript.d.ts ===
308305/*! *****************************************************************************
309306Copyright (c) Microsoft Corporation. All rights reserved.
0 commit comments