Skip to content

Commit 22f7e5f

Browse files
committed
fix(no-unnecessary-type-assertion): trim expression span and label cast span (oxc-project#707)
1 parent 00134dc commit 22f7e5f

4 files changed

Lines changed: 452 additions & 150 deletions

File tree

e2e/__snapshots__/snapshot.test.ts.snap

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1294,7 +1294,14 @@ exports[`TSGoLint E2E Snapshot Tests > should generate consistent diagnostics sn
12941294
"label": "This expression already has the type 'string'",
12951295
"range": {
12961296
"end": 120,
1297-
"pos": 116,
1297+
"pos": 117,
1298+
},
1299+
},
1300+
{
1301+
"label": "Casting it to 'string' is unnecessary",
1302+
"range": {
1303+
"end": 130,
1304+
"pos": 121,
12981305
},
12991306
},
13001307
],
@@ -1325,7 +1332,14 @@ exports[`TSGoLint E2E Snapshot Tests > should generate consistent diagnostics sn
13251332
"label": "This expression already has the type 'string'",
13261333
"range": {
13271334
"end": 248,
1328-
"pos": 236,
1335+
"pos": 237,
1336+
},
1337+
},
1338+
{
1339+
"label": "Casting it to 'string' is unnecessary",
1340+
"range": {
1341+
"end": 258,
1342+
"pos": 249,
13291343
},
13301344
},
13311345
],
@@ -1356,7 +1370,14 @@ exports[`TSGoLint E2E Snapshot Tests > should generate consistent diagnostics sn
13561370
"label": "This expression already has the type '42'",
13571371
"range": {
13581372
"end": 353,
1359-
"pos": 349,
1373+
"pos": 350,
1374+
},
1375+
},
1376+
{
1377+
"label": "Casting it to '42' is unnecessary",
1378+
"range": {
1379+
"end": 359,
1380+
"pos": 354,
13601381
},
13611382
},
13621383
],
@@ -1762,7 +1783,14 @@ exports[`TSGoLint E2E Snapshot Tests > should generate consistent diagnostics sn
17621783
"label": "This expression already has the type 'any'",
17631784
"range": {
17641785
"end": 228,
1765-
"pos": 219,
1786+
"pos": 220,
1787+
},
1788+
},
1789+
{
1790+
"label": "Casting it to 'any' is unnecessary",
1791+
"range": {
1792+
"end": 235,
1793+
"pos": 229,
17661794
},
17671795
},
17681796
],
@@ -2849,7 +2877,14 @@ exports[`TSGoLint E2E Snapshot Tests > should generate consistent diagnostics sn
28492877
"label": "This expression already has the type 'number'",
28502878
"range": {
28512879
"end": 173,
2852-
"pos": 130,
2880+
"pos": 131,
2881+
},
2882+
},
2883+
{
2884+
"label": "Casting it to 'number' is unnecessary",
2885+
"range": {
2886+
"end": 183,
2887+
"pos": 174,
28532888
},
28542889
},
28552890
],

0 commit comments

Comments
 (0)