Skip to content

Commit e95b7bb

Browse files
authored
test: update typescript-eslint and fix test cases (#2477)
1 parent 516253d commit e95b7bb

File tree

5 files changed

+14
-10
lines changed

5 files changed

+14
-10
lines changed

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@
7373
"@types/node": "^14.18.63",
7474
"@types/semver": "^7.5.7",
7575
"@types/xml-name-validator": "^4.0.3",
76-
"@typescript-eslint/parser": "^7.0.1",
77-
"@typescript-eslint/types": "^7.0.1",
76+
"@typescript-eslint/parser": "^7.13.1",
77+
"@typescript-eslint/types": "^7.13.1",
7878
"assert": "^2.1.0",
7979
"env-cmd": "^10.1.0",
8080
"esbuild": "^0.20.0",
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!--{"languageOptions": {"parserOptions": {"parser":"@typescript-eslint/parser"}}}-->
22
<script lang="ts">
3-
declare async function
3+
declare function
44
foo
55
(
66
arg1: string,
@@ -9,4 +9,6 @@ declare async function
99
:
1010
arg1 is
1111
string;
12+
async function
13+
bar() {}
1214
</script>

tests/fixtures/script-indent/ts-declare-function-04.vue

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<!--{"languageOptions": {"parserOptions": {"parser":"@typescript-eslint/parser"}}}-->
22
<script lang="ts">
33
declare function
4-
*
54
foo
65
(
76
arg1: string,

tests/lib/rules/comment-directive.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const { ESLint } = require('../../eslint-compat')
1212
const eslint = new ESLint({
1313
overrideConfigFile: true,
1414
overrideConfig: {
15-
files: ['*'],
15+
files: ['*.*'],
1616
languageOptions: {
1717
parser: require('vue-eslint-parser'),
1818
ecmaVersion: 2015

tests/lib/rules/no-sparse-arrays.js

+8-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
*/
44
'use strict'
55

6-
const RuleTester = require('../../eslint-compat').RuleTester
6+
const { RuleTester, ESLint } = require('../../eslint-compat')
7+
const semver = require('semver')
78
const rule = require('../../../lib/rules/no-sparse-arrays')
89

910
const tester = new RuleTester({
@@ -29,9 +30,10 @@ tester.run('no-sparse-arrays', rule, {
2930
{
3031
message: 'Unexpected comma in middle of array.',
3132
line: 3,
32-
column: 22,
3333
endLine: 3,
34-
endColumn: 38
34+
...(semver.gte(ESLint.version, '9.5.0')
35+
? { column: 23, endColumn: 24 }
36+
: { column: 22, endColumn: 38 })
3537
}
3638
]
3739
},
@@ -44,9 +46,10 @@ tester.run('no-sparse-arrays', rule, {
4446
{
4547
message: 'Unexpected comma in middle of array.',
4648
line: 3,
47-
column: 22,
4849
endLine: 3,
49-
endColumn: 30
50+
...(semver.gte(ESLint.version, '9.5.0')
51+
? { column: 23, endColumn: 24 }
52+
: { column: 22, endColumn: 30 })
5053
}
5154
]
5255
}

0 commit comments

Comments
 (0)