@@ -12,10 +12,10 @@ declare var process: any;
12
12
declare var console: any;
13
13
>console : any
14
14
15
- declare var fs : any;
16
- >fs : any
15
+ declare var readFileSync : any;
16
+ >readFileSync : any
17
17
18
- import ts = require( "typescript") ;
18
+ import * as ts from "typescript";
19
19
>ts : typeof ts
20
20
21
21
export function delint(sourceFile: ts.SourceFile) {
@@ -91,14 +91,15 @@ export function delint(sourceFile: ts.SourceFile) {
91
91
>node : ts.Node
92
92
}
93
93
break;
94
+
94
95
case ts.SyntaxKind.IfStatement:
95
96
>ts.SyntaxKind.IfStatement : ts.SyntaxKind
96
97
>ts.SyntaxKind : typeof ts.SyntaxKind
97
98
>ts : typeof ts
98
99
>SyntaxKind : typeof ts.SyntaxKind
99
100
>IfStatement : ts.SyntaxKind
100
101
101
- var ifStatement = (<ts.IfStatement>node);
102
+ let ifStatement = (<ts.IfStatement>node);
102
103
>ifStatement : ts.IfStatement
103
104
>(<ts.IfStatement>node) : ts.IfStatement
104
105
><ts.IfStatement>node : ts.IfStatement
@@ -127,13 +128,13 @@ export function delint(sourceFile: ts.SourceFile) {
127
128
>thenStatement : ts.Statement
128
129
}
129
130
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
131
132
>ifStatement.elseStatement && ifStatement.elseStatement.kind !== ts.SyntaxKind.Block : boolean
132
133
>ifStatement.elseStatement : ts.Statement
133
134
>ifStatement : ts.IfStatement
134
135
>elseStatement : ts.Statement
135
136
136
- ifStatement.elseStatement.kind !== ts.SyntaxKind.Block && ifStatement.elseStatement.kind !== ts.SyntaxKind.IfStatement) {
137
+ ifStatement.elseStatement.kind !== ts.SyntaxKind.Block &&
137
138
>ifStatement.elseStatement.kind !== ts.SyntaxKind.Block : boolean
138
139
>ifStatement.elseStatement.kind : ts.SyntaxKind
139
140
>ifStatement.elseStatement : ts.Statement
@@ -145,6 +146,8 @@ export function delint(sourceFile: ts.SourceFile) {
145
146
>ts : typeof ts
146
147
>SyntaxKind : typeof ts.SyntaxKind
147
148
>Block : ts.SyntaxKind
149
+
150
+ ifStatement.elseStatement.kind !== ts.SyntaxKind.IfStatement) {
148
151
>ifStatement.elseStatement.kind !== ts.SyntaxKind.IfStatement : boolean
149
152
>ifStatement.elseStatement.kind : ts.SyntaxKind
150
153
>ifStatement.elseStatement : ts.Statement
@@ -173,7 +176,7 @@ export function delint(sourceFile: ts.SourceFile) {
173
176
>SyntaxKind : typeof ts.SyntaxKind
174
177
>BinaryExpression : ts.SyntaxKind
175
178
176
- var op = (<ts.BinaryExpression>node).operatorToken.kind;
179
+ let op = (<ts.BinaryExpression>node).operatorToken.kind;
177
180
>op : ts.SyntaxKind
178
181
>(<ts.BinaryExpression>node).operatorToken.kind : ts.SyntaxKind
179
182
>(<ts.BinaryExpression>node).operatorToken : ts.Node
@@ -185,16 +188,16 @@ export function delint(sourceFile: ts.SourceFile) {
185
188
>operatorToken : ts.Node
186
189
>kind : ts.SyntaxKind
187
190
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
190
193
>op === ts.SyntaxKind.EqualsEqualsToken : boolean
191
194
>op : ts.SyntaxKind
192
195
>ts.SyntaxKind.EqualsEqualsToken : ts.SyntaxKind
193
196
>ts.SyntaxKind : typeof ts.SyntaxKind
194
197
>ts : typeof ts
195
198
>SyntaxKind : typeof ts.SyntaxKind
196
199
>EqualsEqualsToken : ts.SyntaxKind
197
- >op === ts.SyntaxKind.ExclamationEqualsToken : boolean
200
+ >op == ts.SyntaxKind.ExclamationEqualsToken : boolean
198
201
>op : ts.SyntaxKind
199
202
>ts.SyntaxKind.ExclamationEqualsToken : ts.SyntaxKind
200
203
>ts.SyntaxKind : typeof ts.SyntaxKind
@@ -226,8 +229,9 @@ export function delint(sourceFile: ts.SourceFile) {
226
229
>Node : ts.Node
227
230
>message : string
228
231
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
231
235
>sourceFile.getLineAndCharacterOfPosition(node.getStart()) : ts.LineAndCharacter
232
236
>sourceFile.getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter
233
237
>sourceFile : ts.SourceFile
@@ -237,27 +241,23 @@ export function delint(sourceFile: ts.SourceFile) {
237
241
>node : ts.Node
238
242
>getStart : (sourceFile?: ts.SourceFile) => number
239
243
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
242
246
>console.log : any
243
247
>console : any
244
248
>log : any
245
249
>sourceFile.fileName : string
246
250
>sourceFile : ts.SourceFile
247
251
>fileName : string
248
- >lineChar.line + 1 : number
249
- >lineChar.line : number
250
- >lineChar : ts.LineAndCharacter
252
+ >line + 1 : number
251
253
>line : number
252
- >lineChar.character + 1 : number
253
- >lineChar.character : number
254
- >lineChar : ts.LineAndCharacter
254
+ >character + 1 : number
255
255
>character : number
256
256
>message : string
257
257
}
258
258
}
259
259
260
- var fileNames = process.argv.slice(2);
260
+ const fileNames = process.argv.slice(2);
261
261
>fileNames : any
262
262
>process.argv.slice(2) : any
263
263
>process.argv.slice : any
@@ -267,26 +267,24 @@ var fileNames = process.argv.slice(2);
267
267
>slice : any
268
268
269
269
fileNames.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
271
271
>fileNames.forEach : any
272
272
>fileNames : any
273
273
>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
275
275
>fileName : any
276
276
277
277
// 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);
279
279
>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
281
281
>ts.createSourceFile : (fileName: string, sourceText: string, languageVersion: ts.ScriptTarget, setParentNodes?: boolean) => ts.SourceFile
282
282
>ts : typeof ts
283
283
>createSourceFile : (fileName: string, sourceText: string, languageVersion: ts.ScriptTarget, setParentNodes?: boolean) => ts.SourceFile
284
284
>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
290
288
>readFileSync : any
291
289
>fileName : any
292
290
>toString : any
@@ -303,7 +301,6 @@ fileNames.forEach(fileName => {
303
301
>sourceFile : ts.SourceFile
304
302
305
303
});
306
-
307
304
=== typescript.d.ts ===
308
305
/*! *****************************************************************************
309
306
Copyright (c) Microsoft Corporation. All rights reserved.
0 commit comments