forked from microsoft/DefinitelyTyped-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
prefer-declare-function.test.ts
54 lines (51 loc) · 1.04 KB
/
prefer-declare-function.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
import { ESLintUtils } from "@typescript-eslint/utils";
import * as noConstEnum from "../src/rules/prefer-declare-function";
const ruleTester = new ESLintUtils.RuleTester({
parser: "@typescript-eslint/parser",
});
ruleTester.run("prefer-declare-function", noConstEnum, {
invalid: [
{
code: `export const example: () => void;`,
errors: [
{
column: 14,
endColumn: 33,
line: 1,
messageId: "variableFunction",
},
],
},
{
code: `
namespace N {
export const example: () => void;
}
`,
errors: [
{
column: 26,
endColumn: 45,
line: 3,
messageId: "variableFunction",
},
],
},
{
code: `
namespace N {
const example: () => void;
}
`,
errors: [
{
column: 19,
endColumn: 38,
line: 3,
messageId: "variableFunction",
},
],
},
],
valid: [`function example(): void`],
});