-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
/
no-undef.test.ts
73 lines (67 loc) · 1.8 KB
/
no-undef.test.ts
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
import rule from 'eslint/lib/rules/no-undef';
import { RuleTester } from '../RuleTester';
const ruleTester = new RuleTester({
parserOptions: {
ecmaVersion: 6,
sourceType: 'module',
ecmaFeatures: {}
},
parser: '@typescript-eslint/parser'
});
ruleTester.run('no-undef', rule, {
valid: [
`
import Beemo from './Beemo';
import Driver from './Driver';
import Script from './Script';
import Context from './contexts/Context';
import DriverContext from './contexts/DriverContext';
import ScriptContext from './contexts/ScriptContext';
export { Context, Driver, DriverContext, Script, ScriptContext };
export * from './constants';
export * from './types';
export default Beemo;
`,
// https://github.com/eslint/typescript-eslint-parser/issues/471
`
class X {
field = {}
}
`,
// https://github.com/eslint/typescript-eslint-parser/issues/466
`
/*globals document, selector */
const links = document.querySelectorAll( selector ) as NodeListOf<HTMLElement>
`,
// https://github.com/eslint/typescript-eslint-parser/issues/437
`
interface Runnable {
run (): Result
toString (): string
}
`,
// https://github.com/eslint/typescript-eslint-parser/issues/416
`
export type SomeThing = {
id: string;
}
`,
// https://github.com/typescript-eslint/typescript-eslint/issues/20
`
export abstract class Foo {}
export class FooBar extends Foo {}
`,
// https://github.com/typescript-eslint/typescript-eslint/issues/18
`
function eachr<Key, Value>(subject: Map<Key, Value>): typeof subject;
function eachr(subject: Object | Array<Value>): typeof subject {
return subject
}
`,
// https://github.com/typescript-eslint/typescript-eslint/issues/18
`
function eachr<Key, Value>(subject: Map<Key, Value>): typeof subject;
`
],
invalid: []
});