File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { Linter } from "eslint"
2
+ import * as parser from "@typescript-eslint/parser"
3
+ // @ts -expect-error -- ignore
4
+ import { rules } from "../../lib/index"
5
+ import assert from "assert"
6
+
7
+ describe ( "Don't crash even if with d flag." , ( ) => {
8
+ const code = "var foo = /a/d; new RegExp('a', 'd')"
9
+
10
+ for ( const key of Object . keys ( rules ) ) {
11
+ const rule = rules [ key ]
12
+ const ruleId = rule . meta . docs . ruleId
13
+
14
+ it ( ruleId , ( ) => {
15
+ const linter = new Linter ( )
16
+ const config : Linter . Config = {
17
+ parser : "@typescript-eslint/parser" ,
18
+ parserOptions : {
19
+ ecmaVersion : 2020 ,
20
+ } ,
21
+ rules : {
22
+ [ ruleId ] : "error" ,
23
+ } ,
24
+ }
25
+ // @ts -expect-error -- ignore
26
+ linter . defineParser ( "@typescript-eslint/parser" , parser )
27
+ // @ts -expect-error -- ignore
28
+ linter . defineRule ( ruleId , rule )
29
+ const resultVue = linter . verifyAndFix ( code , config , "test.js" )
30
+
31
+ assert . deepStrictEqual ( resultVue . messages , [ ] )
32
+ } )
33
+ }
34
+ } )
You can’t perform that action at this time.
0 commit comments