Skip to content

Commit fdf14b7

Browse files
committed
fix: typescript-eslint v6 compatibility
1 parent df45c22 commit fdf14b7

File tree

77 files changed

+6000
-828
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+6000
-828
lines changed

.github/workflows/NodeCI.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,26 @@ jobs:
5555
run: pnpm install
5656
- name: Test
5757
run: pnpm run test
58+
test-for-ts-eslint-v5:
59+
runs-on: ubuntu-latest
60+
strategy:
61+
matrix:
62+
node-version: [18.x]
63+
steps:
64+
- uses: actions/checkout@v3
65+
- uses: pnpm/action-setup@v2
66+
- name: Use Node.js ${{ matrix.node-version }}
67+
uses: actions/setup-node@v3
68+
with:
69+
node-version: ${{ matrix.node-version }}
70+
- name: Install @typescript-eslint v5
71+
run: |+
72+
pnpm install -D @typescript-eslint/parser@5 @typescript-eslint/eslint-plugin@5
73+
rm -rf node_modules
74+
- name: Install Packages
75+
run: pnpm install
76+
- name: Test
77+
run: pnpm run test
5878
test-for-ts-eslint-v4:
5979
runs-on: ubuntu-latest
6080
strategy:

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@
7373
"@types/mocha": "^10.0.1",
7474
"@types/node": "^18.16.16",
7575
"@types/semver": "^7.5.0",
76-
"@typescript-eslint/eslint-plugin": "^5.59.9",
77-
"@typescript-eslint/parser": "~5.62.0",
78-
"@typescript-eslint/types": "^5.59.9",
76+
"@typescript-eslint/eslint-plugin": "^6.1.0",
77+
"@typescript-eslint/parser": "~6.1.0",
78+
"@typescript-eslint/types": "^6.1.0",
7979
"benchmark": "^2.1.4",
8080
"chai": "^4.3.7",
8181
"env-cmd": "^10.1.0",

src/parser/parser-object.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@ export function isTSESLintParserObject(
6464
return Boolean(
6565
services &&
6666
services.esTreeNodeToTSNodeMap &&
67-
services.tsNodeToESTreeNodeMap &&
68-
services.program,
67+
services.tsNodeToESTreeNodeMap,
6968
);
7069
} catch {
7170
return false;

src/parser/typescript/analyze/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,7 @@ function transformForDeclareReactiveVar(
505505
const newBody: TSESTree.ExpressionStatement = {
506506
type: "ExpressionStatement" as TSESTree.ExpressionStatement["type"],
507507
expression: assignment,
508+
directive: undefined,
508509
loc: statement.body.loc,
509510
range: statement.body.range,
510511
parent: reactiveStatement,

tests/fixtures/parser/ast/await04-output.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,12 @@
104104
"declarations": [
105105
{
106106
"type": "VariableDeclarator",
107+
"definite": false,
107108
"id": {
108109
"type": "Identifier",
109110
"name": "p",
111+
"decorators": [],
112+
"optional": false,
110113
"range": [
111114
27,
112115
28
@@ -131,6 +134,8 @@
131134
"object": {
132135
"type": "Identifier",
133136
"name": "Promise",
137+
"decorators": [],
138+
"optional": false,
134139
"range": [
135140
31,
136141
38
@@ -150,6 +155,8 @@
150155
"property": {
151156
"type": "Identifier",
152157
"name": "resolve",
158+
"decorators": [],
159+
"optional": false,
153160
"range": [
154161
39,
155162
46
@@ -212,6 +219,7 @@
212219
}
213220
}
214221
],
222+
"declare": false,
215223
"range": [
216224
21,
217225
49
@@ -284,6 +292,8 @@
284292
"expression": {
285293
"type": "Identifier",
286294
"name": "p",
295+
"decorators": [],
296+
"optional": false,
287297
"range": [
288298
69,
289299
70
@@ -342,6 +352,8 @@
342352
"value": {
343353
"type": "Identifier",
344354
"name": "v",
355+
"decorators": [],
356+
"optional": false,
345357
"range": [
346358
79,
347359
80

tests/fixtures/parser/ast/await04-scope-output.json

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8611,6 +8611,8 @@
86118611
{
86128612
"type": "Identifier",
86138613
"name": "p",
8614+
"decorators": [],
8615+
"optional": false,
86148616
"range": [
86158617
27,
86168618
28
@@ -8633,6 +8635,8 @@
86338635
"name": {
86348636
"type": "Identifier",
86358637
"name": "p",
8638+
"decorators": [],
8639+
"optional": false,
86368640
"range": [
86378641
27,
86388642
28
@@ -8650,9 +8654,12 @@
86508654
},
86518655
"node": {
86528656
"type": "VariableDeclarator",
8657+
"definite": false,
86538658
"id": {
86548659
"type": "Identifier",
86558660
"name": "p",
8661+
"decorators": [],
8662+
"optional": false,
86568663
"range": [
86578664
27,
86588665
28
@@ -8677,6 +8684,8 @@
86778684
"object": {
86788685
"type": "Identifier",
86798686
"name": "Promise",
8687+
"decorators": [],
8688+
"optional": false,
86808689
"range": [
86818690
31,
86828691
38
@@ -8696,6 +8705,8 @@
86968705
"property": {
86978706
"type": "Identifier",
86988707
"name": "resolve",
8708+
"decorators": [],
8709+
"optional": false,
86998710
"range": [
87008711
39,
87018712
46
@@ -8764,6 +8775,8 @@
87648775
"identifier": {
87658776
"type": "Identifier",
87668777
"name": "p",
8778+
"decorators": [],
8779+
"optional": false,
87678780
"range": [
87688781
27,
87698782
28
@@ -8784,6 +8797,8 @@
87848797
"resolved": {
87858798
"type": "Identifier",
87868799
"name": "p",
8800+
"decorators": [],
8801+
"optional": false,
87878802
"range": [
87888803
27,
87898804
28
@@ -8804,6 +8819,8 @@
88048819
"identifier": {
88058820
"type": "Identifier",
88068821
"name": "p",
8822+
"decorators": [],
8823+
"optional": false,
88078824
"range": [
88088825
69,
88098826
70
@@ -8824,6 +8841,8 @@
88248841
"resolved": {
88258842
"type": "Identifier",
88268843
"name": "p",
8844+
"decorators": [],
8845+
"optional": false,
88278846
"range": [
88288847
27,
88298848
28
@@ -8848,6 +8867,8 @@
88488867
"identifier": {
88498868
"type": "Identifier",
88508869
"name": "p",
8870+
"decorators": [],
8871+
"optional": false,
88518872
"range": [
88528873
27,
88538874
28
@@ -8868,6 +8889,8 @@
88688889
"resolved": {
88698890
"type": "Identifier",
88708891
"name": "p",
8892+
"decorators": [],
8893+
"optional": false,
88718894
"range": [
88728895
27,
88738896
28
@@ -8888,6 +8911,8 @@
88888911
"identifier": {
88898912
"type": "Identifier",
88908913
"name": "Promise",
8914+
"decorators": [],
8915+
"optional": false,
88918916
"range": [
88928917
31,
88938918
38
@@ -8911,6 +8936,8 @@
89118936
"identifier": {
89128937
"type": "Identifier",
89138938
"name": "p",
8939+
"decorators": [],
8940+
"optional": false,
89148941
"range": [
89158942
69,
89168943
70
@@ -8931,6 +8958,8 @@
89318958
"resolved": {
89328959
"type": "Identifier",
89338960
"name": "p",
8961+
"decorators": [],
8962+
"optional": false,
89348963
"range": [
89358964
27,
89368965
28
@@ -8965,6 +8994,8 @@
89658994
{
89668995
"type": "Identifier",
89678996
"name": "v",
8997+
"decorators": [],
8998+
"optional": false,
89688999
"range": [
89699000
79,
89709001
80
@@ -8987,6 +9018,8 @@
89879018
"name": {
89889019
"type": "Identifier",
89899020
"name": "v",
9021+
"decorators": [],
9022+
"optional": false,
89909023
"range": [
89919024
79,
89929025
80
@@ -9008,6 +9041,8 @@
90089041
"value": {
90099042
"type": "Identifier",
90109043
"name": "v",
9044+
"decorators": [],
9045+
"optional": false,
90119046
"range": [
90129047
79,
90139048
80
@@ -9073,6 +9108,8 @@
90739108
"identifier": {
90749109
"type": "Identifier",
90759110
"name": "Promise",
9111+
"decorators": [],
9112+
"optional": false,
90769113
"range": [
90779114
31,
90789115
38
@@ -9100,6 +9137,8 @@
91009137
"identifier": {
91019138
"type": "Identifier",
91029139
"name": "Promise",
9140+
"decorators": [],
9141+
"optional": false,
91039142
"range": [
91049143
31,
91059144
38

0 commit comments

Comments
 (0)