This repository has been archived by the owner on Mar 25, 2021. It is now read-only.
/
test.ts.lint
99 lines (79 loc) · 2.75 KB
/
test.ts.lint
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
87
88
89
90
91
92
93
94
95
96
97
98
99
"use strict"
import { Something } from "some-package"
export { SomethingElse } from "another-package"
enum Sides {
'<- Left',
'Right ->'
}
const octalEscapeSequence = '\1'
const octalEscapeSequence2 = '\7'
const octalEscapeSequence3 = '\77'
const octalEscapeSequence4 = '\377'
const octalEscapeSequence5 = '\123'
// Prefix (\47) is an octal escape sequence
const octalEscapeSequence6 = '\477'
const octalEscapeSequence7 = '\\77 \77 \\37 \\77'
const notOctalEscapeSequence = '\877'
~~~~~~ [single]
const notOctalEscapeSequence2 = '\017'
~~~~~~ [single]
const notOctalEscapeSequence3 = '\t'
~~~~ [single]
const notOctalEscapeSequence4 = '\0'
~~~~ [single]
const notOctalEscapeSequence4 = '\\77 \\37 \\\\47 \\\\\\77'
~~~~~~~~~~~~~~~~~~~~~~~~~~~ [single]
function strictFunction() {
"use strict"
const str = "use strict"
~~~~~~~~~~~~ [double]
}
var single = 'single';
~~~~~~~~ [single]
var double = "married";
~~~~~~~~~ [double]
var singleWithinDouble = "'singleWithinDouble'";
~~~~~~~~~~~~~~~~~~~~~~ [double]
var doubleWithinSingle = '"doubleWithinSingle"';
~~~~~~~~~~~~~~~~~~~~~~ [single]
var tabNewlineWithinSingle = 'tab\tNewline\nWithinSingle';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [single]
var array: Array<"literal string"> = [];
var arrayTwo: Array<"literal string" | number> = [];
var arrayThree: Array<"literal string" | "hello world"> = [];
var arrayFour: Array<"literal string" | "hello world" | "foo bar"> = [];
var array: Array<"literal string"> = [];
var arrayTwo: Array<"literal string" & number> = [];
var arrayFour: Array<"literal string" | "hello world" & "foo bar"> = [];
function test<T extends "generic">() {
}
function test<T extends ("generic" & number)>() {
}
declare var obj: {
helloWorldString: string
}
interface obj2 {
helloWorldString: string
}
type objHello = typeof obj["helloWorldString"]
type objHello2 = obj2["helloWorldString"]
let helloValue = obj["helloWorldString"]
~~~~~~~~~~~~~~~~~~ [double]
helloValue = obj["helloWorldString"]
~~~~~~~~~~~~~~~~~~ [double]
const obj3: {
value: typeof obj["helloWorldString"]
} = {
value: obj["helloWorldString"]
~~~~~~~~~~~~~~~~~~ [double]
}
const callback = <U extends "generic">() => "hi" as number | string
~~~~ [double]
var hello: "world";
~~~~~~~ [double]
'escaped\'quotemark';
~~~~~~~~~~~~~~~~~~~~ [single]
// "avoid-template" option is not set.
`foo`;
[single]: ' should be `
[double]: " should be `