Skip to content

Commit 757a996

Browse files
committed
feat: enrich await-thenable diagnostics (#865)
part of #648
1 parent 8077d48 commit 757a996

File tree

3 files changed

+417
-7
lines changed

3 files changed

+417
-7
lines changed

e2e/__snapshots__/snapshot.test.ts.snap

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,18 @@ exports[`TSGoLint E2E Snapshot Tests > should generate consistent diagnostics sn
5151
{
5252
"file_path": "fixtures/basic/rules/await-thenable/index.ts",
5353
"kind": 0,
54+
"labeled_ranges": [
55+
{
56+
"label": "This expression is not Promise-like",
57+
"range": {
58+
"end": 63,
59+
"pos": 61,
60+
},
61+
},
62+
],
5463
"message": {
5564
"description": "Unexpected \`await\` of a non-Promise (non-"Thenable") value.",
65+
"help": "Remove \`await\` if the value is synchronous, or change the expression to return a Promise or Thenable before awaiting it.",
5666
"id": "await",
5767
},
5868
"range": {
@@ -81,8 +91,18 @@ exports[`TSGoLint E2E Snapshot Tests > should generate consistent diagnostics sn
8191
{
8292
"file_path": "fixtures/basic/rules/await-thenable/index.ts",
8393
"kind": 0,
94+
"labeled_ranges": [
95+
{
96+
"label": "This expression is not Promise-like",
97+
"range": {
98+
"end": 81,
99+
"pos": 71,
100+
},
101+
},
102+
],
84103
"message": {
85104
"description": "Unexpected \`await\` of a non-Promise (non-"Thenable") value.",
105+
"help": "Remove \`await\` if the value is synchronous, or change the expression to return a Promise or Thenable before awaiting it.",
86106
"id": "await",
87107
},
88108
"range": {
@@ -111,8 +131,18 @@ exports[`TSGoLint E2E Snapshot Tests > should generate consistent diagnostics sn
111131
{
112132
"file_path": "fixtures/basic/rules/await-thenable/index.ts",
113133
"kind": 0,
134+
"labeled_ranges": [
135+
{
136+
"label": "This expression is not Promise-like",
137+
"range": {
138+
"end": 123,
139+
"pos": 112,
140+
},
141+
},
142+
],
114143
"message": {
115144
"description": "Unexpected \`await\` of a non-Promise (non-"Thenable") value.",
145+
"help": "Remove \`await\` if the value is synchronous, or change the expression to return a Promise or Thenable before awaiting it.",
116146
"id": "await",
117147
},
118148
"range": {
@@ -141,8 +171,18 @@ exports[`TSGoLint E2E Snapshot Tests > should generate consistent diagnostics sn
141171
{
142172
"file_path": "fixtures/basic/rules/await-thenable/index.ts",
143173
"kind": 0,
174+
"labeled_ranges": [
175+
{
176+
"label": "This expression is not Promise-like",
177+
"range": {
178+
"end": 144,
179+
"pos": 131,
180+
},
181+
},
182+
],
144183
"message": {
145184
"description": "Unexpected \`await\` of a non-Promise (non-"Thenable") value.",
185+
"help": "Remove \`await\` if the value is synchronous, or change the expression to return a Promise or Thenable before awaiting it.",
146186
"id": "await",
147187
},
148188
"range": {
@@ -171,8 +211,18 @@ exports[`TSGoLint E2E Snapshot Tests > should generate consistent diagnostics sn
171211
{
172212
"file_path": "fixtures/basic/rules/await-thenable/index.ts",
173213
"kind": 0,
214+
"labeled_ranges": [
215+
{
216+
"label": "This expression is not Promise-like",
217+
"range": {
218+
"end": 278,
219+
"pos": 268,
220+
},
221+
},
222+
],
174223
"message": {
175224
"description": "Unexpected \`await\` of a non-Promise (non-"Thenable") value.",
225+
"help": "Remove \`await\` if the value is synchronous, or change the expression to return a Promise or Thenable before awaiting it.",
176226
"id": "await",
177227
},
178228
"range": {

0 commit comments

Comments
 (0)