FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
TypeScript/scripts/errorCheck.ts at master · cspotcode/TypeScript · GitHub
cspotcode
/
TypeScript
Public
forked from
microsoft/TypeScript
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
TypeScript
/
scripts
/
errorCheck.ts
Copy path
More file actions
More file actions
Latest commit
History
History
History
86 lines (73 loc) · 2.78 KB
Breadcrumbs
TypeScript
/
scripts
/
errorCheck.ts
Copy path
File metadata and controls
86 lines (73 loc) · 2.78 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
declare
var
require
:
any
;
let
fs
=
require
(
'fs'
)
;
let
async
=
require
(
'async'
)
;
let
glob
=
require
(
'glob'
)
;
fs
.
readFile
(
'src/compiler/diagnosticMessages.json'
,
'utf-8'
,
(
err
,
data
)
=>
{
if
(
err
)
{
throw
err
;
}
let
messages
=
JSON
.
parse
(
data
)
;
let
keys
=
Object
.
keys
(
messages
)
;
console
.
log
(
'Loaded '
+
keys
.
length
+
' errors'
)
;
for
(
let
k
of
keys
)
{
messages
[
k
]
[
'seen'
]
=
false
;
}
let
errRegex
=
/
\(
\d
+
,
\d
+
\)
:
e
r
r
o
r
T
S
(
[
^
:
]
+
)
:
/
g
;
let
baseDir
=
'tests/baselines/reference/'
;
fs
.
readdir
(
baseDir
,
(
err
,
files
)
=>
{
files
=
files
.
filter
(
f
=>
f
.
indexOf
(
'.errors.txt'
)
>
0
)
;
let
tasks
:
Array
<
(
callback
:
(
)
=>
void
)
=>
void
>
=
[
]
;
files
.
forEach
(
f
=>
tasks
.
push
(
done
=>
{
fs
.
readFile
(
baseDir
+
f
,
'utf-8'
,
(
err
,
baseline
)
=>
{
if
(
err
)
throw
err
;
let
g
:
string
[
]
;
while
(
g
=
errRegex
.
exec
(
baseline
)
)
{
var
errCode
=
+
g
[
1
]
;
let
msg
=
keys
.
filter
(
k
=>
messages
[
k
]
.
code
===
errCode
)
[
0
]
;
messages
[
msg
]
[
'seen'
]
=
true
;
}
done
(
)
;
}
)
;
}
)
)
;
async
.
parallelLimit
(
tasks
,
25
,
done
=>
{
console
.
log
(
'== List of errors not present in baselines =='
)
;
let
count
=
0
;
for
(
let
k
of
keys
)
{
if
(
messages
[
k
]
[
'seen'
]
!==
true
)
{
console
.
log
(
k
)
;
count
++
;
}
}
console
.
log
(
count
+
' of '
+
keys
.
length
+
' errors are not in baselines'
)
;
}
)
;
}
)
;
}
)
;
fs
.
readFile
(
'src/compiler/diagnosticInformationMap.generated.ts'
,
'utf-8'
,
(
err
,
data
)
=>
{
let
errorRegexp
=
/
\s
(
\w
+
)
:
\{
c
o
d
e
/
g
;
let
errorNames
:
string
[
]
=
[
]
;
let
errMatch
:
string
[
]
;
while
(
errMatch
=
errorRegexp
.
exec
(
data
)
)
{
errorNames
.
push
(
errMatch
[
1
]
)
;
}
let
allSrc
:
string
=
''
;
glob
(
'./src/**/*.ts'
,
{
}
,
(
err
,
files
)
=>
{
console
.
log
(
'Reading '
+
files
.
length
+
' source files'
)
;
for
(
let
file
of
files
)
{
if
(
file
.
indexOf
(
'diagnosticInformationMap.generated.ts'
)
>
0
)
{
continue
;
}
let
src
=
fs
.
readFileSync
(
file
,
'utf-8'
)
;
allSrc
=
allSrc
+
src
;
}
console
.
log
(
'Consumed '
+
allSrc
.
length
+
' characters of source'
)
;
let
count
=
0
;
console
.
log
(
'== List of errors not used in source =='
)
;
for
(
let
errName
of
errorNames
)
{
if
(
allSrc
.
indexOf
(
errName
)
<
0
)
{
console
.
log
(
errName
)
;
count
++
;
}
}
console
.
log
(
count
+
' of '
+
errorNames
.
length
+
' errors are not used in source'
)
;
}
)
;
}
)
;
Back
|
FazBrowse Home
|
New Git URL