-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathno-super-linear-move.ts
52 lines (47 loc) · 1.44 KB
/
no-super-linear-move.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
import { SnapshotRuleTester } from "eslint-snapshot-rule-tester"
import rule from "../../../lib/rules/no-super-linear-move"
const tester = new SnapshotRuleTester({
languageOptions: {
ecmaVersion: "latest",
sourceType: "module",
},
})
tester.run("no-super-linear-move", rule as any, {
valid: [
String.raw`/regexp/`,
String.raw`/\ba*:/`,
// no rejecting suffix
String.raw`/a*/`,
{
code: String.raw`/a*/.test(input)`,
options: [{ report: "potential" }],
},
{
code: String.raw`export default /a*/`,
options: [{ report: "certain" }],
},
{ code: String.raw`/a*b/.source`, options: [{ ignorePartial: true }] },
{ code: String.raw`/a*b/y`, options: [{ ignoreSticky: true }] },
String.raw`/[\q{abc}]+/v`,
],
invalid: [
String.raw`/a*:/`,
String.raw`/^\s*(\w+)\s*[:=]/m`,
String.raw`/((?:\\{2})*)(\\?)\|/g`,
String.raw`/[a-z_][A-Z_0-9]*(?=\s*\()/i`,
String.raw`/(?!\d)\w+(?=\s*\()/i`,
{
code: String.raw`export default /a*/`,
options: [{ report: "potential" }],
},
{
code: String.raw`/a*b/.source`,
options: [{ ignorePartial: false }],
},
{
code: String.raw`/a*b/y`,
options: [{ ignoreSticky: false }],
},
String.raw`/[\q{abc}]+a/v`,
],
})