File tree 1 file changed +33
-3
lines changed
Filter options
1 file changed +33
-3
lines changed
Original file line number Diff line number Diff line change 3
3
*/
4
4
'use strict'
5
5
6
- const RuleTester = require ( '../../eslint-compat' ) . RuleTester
6
+ const semver = require ( 'semver' )
7
+ const { RuleTester, ESLint } = require ( '../../eslint-compat' )
7
8
const rule = require ( '../../../lib/rules/eqeqeq' )
8
9
9
10
const tester = new RuleTester ( {
@@ -24,7 +25,19 @@ tester.run('eqeqeq', rule, {
24
25
invalid : [
25
26
{
26
27
code : '<template><div :attr="a == 1" /></template>' ,
27
- errors : [ "Expected '===' and instead saw '=='." ]
28
+ errors : [
29
+ {
30
+ message : "Expected '===' and instead saw '=='." ,
31
+ suggestions : semver . gte ( ESLint . version , '9.26.0' )
32
+ ? [
33
+ {
34
+ desc : "Use '===' instead of '=='." ,
35
+ output : `<template><div :attr="a === 1" /></template>`
36
+ }
37
+ ]
38
+ : null
39
+ }
40
+ ]
28
41
} ,
29
42
// CSS vars injection
30
43
{
@@ -34,7 +47,24 @@ tester.run('eqeqeq', rule, {
34
47
color: v-bind(a == 1 ? 'red' : 'blue')
35
48
}
36
49
</style>` ,
37
- errors : [ "Expected '===' and instead saw '=='." ]
50
+ errors : [
51
+ {
52
+ message : "Expected '===' and instead saw '=='." ,
53
+ suggestions : semver . gte ( ESLint . version , '9.26.0' )
54
+ ? [
55
+ {
56
+ desc : "Use '===' instead of '=='." ,
57
+ output : `
58
+ <style>
59
+ .text {
60
+ color: v-bind(a === 1 ? 'red' : 'blue')
61
+ }
62
+ </style>`
63
+ }
64
+ ]
65
+ : null
66
+ }
67
+ ]
38
68
}
39
69
]
40
70
} )
You can’t perform that action at this time.
0 commit comments