Skip to content

Commit 112cf3e

Browse files
committed
fix(tests): sort snapshot cases correctly (#734)
Previously: 0, 1, 10, 11, 12, 13... Now: 0, 1, 2, 3, 4, 5...
1 parent 901b72d commit 112cf3e

File tree

56 files changed

+9838
-9695
lines changed

Some content is hidden

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

56 files changed

+9838
-9695
lines changed

internal/rule_tester/__snapshots__/await-thenable.snap

Lines changed: 76 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,82 @@ Message: Unexpected `await` of a non-Promise (non-"Thenable") value.
1515
Suggestion 1: [removeAwait] Remove unnecessary `await`.
1616
---
1717

18+
[TestAwaitThenable/invalid-2 - 1]
19+
Diagnostic 1: await (1:13 - 1:17)
20+
Message: Unexpected `await` of a non-Promise (non-"Thenable") value.
21+
1 | async () => await (Math.random() > 0.5 ? '' : 0);
22+
| ~~~~~
23+
Suggestion 1: [removeAwait] Remove unnecessary `await`.
24+
---
25+
26+
[TestAwaitThenable/invalid-3 - 1]
27+
Diagnostic 1: await (1:13 - 1:17)
28+
Message: Unexpected `await` of a non-Promise (non-"Thenable") value.
29+
1 | async () => await(Math.random() > 0.5 ? '' : 0);
30+
| ~~~~~
31+
Suggestion 1: [removeAwait] Remove unnecessary `await`.
32+
---
33+
34+
[TestAwaitThenable/invalid-4 - 1]
35+
Diagnostic 1: await (3:1 - 3:5)
36+
Message: Unexpected `await` of a non-Promise (non-"Thenable") value.
37+
2 | class NonPromise extends Array {}
38+
3 | await new NonPromise();
39+
| ~~~~~
40+
4 |
41+
Suggestion 1: [removeAwait] Remove unnecessary `await`.
42+
---
43+
44+
[TestAwaitThenable/invalid-5 - 1]
45+
Diagnostic 1: await (8:3 - 8:7)
46+
Message: Unexpected `await` of a non-Promise (non-"Thenable") value.
47+
7 |
48+
8 | await thenable;
49+
| ~~~~~
50+
9 | }
51+
Suggestion 1: [removeAwait] Remove unnecessary `await`.
52+
---
53+
54+
[TestAwaitThenable/invalid-6 - 1]
55+
Diagnostic 1: await (3:1 - 3:5)
56+
Message: Unexpected `await` of a non-Promise (non-"Thenable") value.
57+
2 | declare const callback: (() => void) | undefined;
58+
3 | await callback?.();
59+
| ~~~~~
60+
4 |
61+
Suggestion 1: [removeAwait] Remove unnecessary `await`.
62+
---
63+
64+
[TestAwaitThenable/invalid-7 - 1]
65+
Diagnostic 1: await (3:1 - 3:5)
66+
Message: Unexpected `await` of a non-Promise (non-"Thenable") value.
67+
2 | declare const obj: { a?: { b?: () => void } };
68+
3 | await obj.a?.b?.();
69+
| ~~~~~
70+
4 |
71+
Suggestion 1: [removeAwait] Remove unnecessary `await`.
72+
---
73+
74+
[TestAwaitThenable/invalid-8 - 1]
75+
Diagnostic 1: await (3:1 - 3:5)
76+
Message: Unexpected `await` of a non-Promise (non-"Thenable") value.
77+
2 | declare const obj: { a: { b: { c?: () => void } } } | undefined;
78+
3 | await obj?.a.b.c?.();
79+
| ~~~~~
80+
4 |
81+
Suggestion 1: [removeAwait] Remove unnecessary `await`.
82+
---
83+
84+
[TestAwaitThenable/invalid-9 - 1]
85+
Diagnostic 1: forAwaitOfNonAsyncIterable (7:1 - 7:41)
86+
Message: Unexpected `for await...of` of a value that is not async iterable.
87+
6 | }
88+
7 | for await (const value of yieldNumbers()) {
89+
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
90+
8 | console.log(value);
91+
Suggestion 1: [convertToOrdinaryFor] Convert to an ordinary `for...of` loop.
92+
---
93+
1894
[TestAwaitThenable/invalid-10 - 1]
1995
Diagnostic 1: forAwaitOfNonAsyncIterable (7:1 - 7:48)
2096
Message: Unexpected `for await...of` of a value that is not async iterable.
@@ -110,79 +186,3 @@ Message: Unexpected `await` of a non-Promise (non-"Thenable") value.
110186
5 | }
111187
Suggestion 1: [removeAwait] Remove unnecessary `await`.
112188
---
113-
114-
[TestAwaitThenable/invalid-2 - 1]
115-
Diagnostic 1: await (1:13 - 1:17)
116-
Message: Unexpected `await` of a non-Promise (non-"Thenable") value.
117-
1 | async () => await (Math.random() > 0.5 ? '' : 0);
118-
| ~~~~~
119-
Suggestion 1: [removeAwait] Remove unnecessary `await`.
120-
---
121-
122-
[TestAwaitThenable/invalid-3 - 1]
123-
Diagnostic 1: await (1:13 - 1:17)
124-
Message: Unexpected `await` of a non-Promise (non-"Thenable") value.
125-
1 | async () => await(Math.random() > 0.5 ? '' : 0);
126-
| ~~~~~
127-
Suggestion 1: [removeAwait] Remove unnecessary `await`.
128-
---
129-
130-
[TestAwaitThenable/invalid-4 - 1]
131-
Diagnostic 1: await (3:1 - 3:5)
132-
Message: Unexpected `await` of a non-Promise (non-"Thenable") value.
133-
2 | class NonPromise extends Array {}
134-
3 | await new NonPromise();
135-
| ~~~~~
136-
4 |
137-
Suggestion 1: [removeAwait] Remove unnecessary `await`.
138-
---
139-
140-
[TestAwaitThenable/invalid-5 - 1]
141-
Diagnostic 1: await (8:3 - 8:7)
142-
Message: Unexpected `await` of a non-Promise (non-"Thenable") value.
143-
7 |
144-
8 | await thenable;
145-
| ~~~~~
146-
9 | }
147-
Suggestion 1: [removeAwait] Remove unnecessary `await`.
148-
---
149-
150-
[TestAwaitThenable/invalid-6 - 1]
151-
Diagnostic 1: await (3:1 - 3:5)
152-
Message: Unexpected `await` of a non-Promise (non-"Thenable") value.
153-
2 | declare const callback: (() => void) | undefined;
154-
3 | await callback?.();
155-
| ~~~~~
156-
4 |
157-
Suggestion 1: [removeAwait] Remove unnecessary `await`.
158-
---
159-
160-
[TestAwaitThenable/invalid-7 - 1]
161-
Diagnostic 1: await (3:1 - 3:5)
162-
Message: Unexpected `await` of a non-Promise (non-"Thenable") value.
163-
2 | declare const obj: { a?: { b?: () => void } };
164-
3 | await obj.a?.b?.();
165-
| ~~~~~
166-
4 |
167-
Suggestion 1: [removeAwait] Remove unnecessary `await`.
168-
---
169-
170-
[TestAwaitThenable/invalid-8 - 1]
171-
Diagnostic 1: await (3:1 - 3:5)
172-
Message: Unexpected `await` of a non-Promise (non-"Thenable") value.
173-
2 | declare const obj: { a: { b: { c?: () => void } } } | undefined;
174-
3 | await obj?.a.b.c?.();
175-
| ~~~~~
176-
4 |
177-
Suggestion 1: [removeAwait] Remove unnecessary `await`.
178-
---
179-
180-
[TestAwaitThenable/invalid-9 - 1]
181-
Diagnostic 1: forAwaitOfNonAsyncIterable (7:1 - 7:41)
182-
Message: Unexpected `for await...of` of a value that is not async iterable.
183-
6 | }
184-
7 | for await (const value of yieldNumbers()) {
185-
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
186-
8 | console.log(value);
187-
Suggestion 1: [convertToOrdinaryFor] Convert to an ordinary `for...of` loop.
188-
---

internal/rule_tester/__snapshots__/consistent-return.snap

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,6 @@ Message: Function 'foo' expected a return value.
1717
6 | }
1818
---
1919

20-
[TestConsistentReturnRule/invalid-10 - 1]
21-
Diagnostic 1: unexpectedReturnValue (6:11 - 6:22)
22-
Message: Function 'foo' expected no return value.
23-
5 | }
24-
6 | return true;
25-
| ~~~~~~~~~~~~
26-
7 | }
27-
---
28-
29-
[TestConsistentReturnRule/invalid-11 - 1]
30-
Diagnostic 1: unexpectedReturnValue (7:11 - 7:28)
31-
Message: Function 'foo' expected no return value.
32-
6 | }
33-
7 | return undefOrNum;
34-
| ~~~~~~~~~~~~~~~~~~
35-
8 | }
36-
---
37-
3820
[TestConsistentReturnRule/invalid-2 - 1]
3921
Diagnostic 1: missingReturnValue (2:9 - 6:9)
4022
Message: Function 'foo' expected a return value.
@@ -121,3 +103,21 @@ Message: Function 'foo' expected a return value.
121103
| ~~~~~~~
122104
8 | }
123105
---
106+
107+
[TestConsistentReturnRule/invalid-10 - 1]
108+
Diagnostic 1: unexpectedReturnValue (6:11 - 6:22)
109+
Message: Function 'foo' expected no return value.
110+
5 | }
111+
6 | return true;
112+
| ~~~~~~~~~~~~
113+
7 | }
114+
---
115+
116+
[TestConsistentReturnRule/invalid-11 - 1]
117+
Diagnostic 1: unexpectedReturnValue (7:11 - 7:28)
118+
Message: Function 'foo' expected no return value.
119+
6 | }
120+
7 | return undefOrNum;
121+
| ~~~~~~~~~~~~~~~~~~
122+
8 | }
123+
---

internal/rule_tester/__snapshots__/consistent-type-exports.snap

Lines changed: 76 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,82 @@ Message: All exports in the declaration are only used as types. Use `export type
1313
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1414
---
1515

16+
[TestConsistentTypeExportsRule/invalid-2 - 1]
17+
Diagnostic 1: singleExportIsType (1:1 - 1:58)
18+
Message: Type export Type1 is not a value and should be exported using `export type`.
19+
1 | export { Type1, value1 } from './consistent-type-exports';
20+
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
21+
---
22+
23+
[TestConsistentTypeExportsRule/invalid-3 - 1]
24+
Diagnostic 1: singleExportIsType (2:1 - 2:66)
25+
Message: Type export Type1 is not a value and should be exported using `export type`.
26+
1 |
27+
2 | export { Type1, value1, value2 } from './consistent-type-exports';
28+
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
29+
3 |
30+
---
31+
32+
[TestConsistentTypeExportsRule/invalid-4 - 1]
33+
Diagnostic 1: multipleExportsAreTypes (2:1 - 2:73)
34+
Message: Type exports Type1 and Type2 are not values and should be exported using `export type`.
35+
1 |
36+
2 | export { Type1, value1, Type2, value2 } from './consistent-type-exports';
37+
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
38+
3 |
39+
---
40+
41+
[TestConsistentTypeExportsRule/invalid-5 - 1]
42+
Diagnostic 1: typeOverValue (1:1 - 1:57)
43+
Message: All exports in the declaration are only used as types. Use `export type`.
44+
1 | export { Type2 as Foo } from './consistent-type-exports';
45+
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
46+
---
47+
48+
[TestConsistentTypeExportsRule/invalid-6 - 1]
49+
Diagnostic 1: singleExportIsType (2:1 - 2:65)
50+
Message: Type export Type2 as Foo is not a value and should be exported using `export type`.
51+
1 |
52+
2 | export { Type2 as Foo, value1 } from './consistent-type-exports';
53+
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
54+
3 |
55+
---
56+
57+
[TestConsistentTypeExportsRule/invalid-7 - 1]
58+
Diagnostic 1: singleExportIsType (2:1 - 6:35)
59+
Message: Type export Type2 as Foo is not a value and should be exported using `export type`.
60+
1 |
61+
2 | export {
62+
| ~~~~~~~~
63+
3 | Type2 as Foo,
64+
| ~~~~~~~~~~~~~~~
65+
4 | value1 as BScope,
66+
| ~~~~~~~~~~~~~~~~~~~
67+
5 | value2 as CScope,
68+
| ~~~~~~~~~~~~~~~~~~~
69+
6 | } from './consistent-type-exports';
70+
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
71+
7 |
72+
---
73+
74+
[TestConsistentTypeExportsRule/invalid-8 - 1]
75+
Diagnostic 1: typeOverValue (3:1 - 3:17)
76+
Message: All exports in the declaration are only used as types. Use `export type`.
77+
2 | import { Type2 } from './consistent-type-exports';
78+
3 | export { Type2 };
79+
| ~~~~~~~~~~~~~~~~~
80+
4 |
81+
---
82+
83+
[TestConsistentTypeExportsRule/invalid-9 - 1]
84+
Diagnostic 1: singleExportIsType (3:1 - 3:25)
85+
Message: Type export Type2 is not a value and should be exported using `export type`.
86+
2 | import { value2, Type2 } from './consistent-type-exports';
87+
3 | export { value2, Type2 };
88+
| ~~~~~~~~~~~~~~~~~~~~~~~~~
89+
4 |
90+
---
91+
1692
[TestConsistentTypeExportsRule/invalid-10 - 1]
1793
Diagnostic 1: multipleExportsAreTypes (9:1 - 9:32)
1894
Message: Type exports Alias and IFace are not values and should be exported using `export type`.
@@ -123,13 +199,6 @@ Message: All exports in the declaration are only used as types. Use `export type
123199
3 |
124200
---
125201
126-
[TestConsistentTypeExportsRule/invalid-2 - 1]
127-
Diagnostic 1: singleExportIsType (1:1 - 1:58)
128-
Message: Type export Type1 is not a value and should be exported using `export type`.
129-
1 | export { Type1, value1 } from './consistent-type-exports';
130-
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
131-
---
132-
133202
[TestConsistentTypeExportsRule/invalid-20 - 1]
134203
Diagnostic 1: typeOverValue (2:25 - 5:63)
135204
Message: All exports in the declaration are only used as types. Use `export type`.
@@ -180,72 +249,3 @@ Message: All exports in the declaration are only used as types. Use `export type
180249
| ~~~~~~~~~~~~~~~
181250
4 |
182251
---
183-
184-
[TestConsistentTypeExportsRule/invalid-3 - 1]
185-
Diagnostic 1: singleExportIsType (2:1 - 2:66)
186-
Message: Type export Type1 is not a value and should be exported using `export type`.
187-
1 |
188-
2 | export { Type1, value1, value2 } from './consistent-type-exports';
189-
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
190-
3 |
191-
---
192-
193-
[TestConsistentTypeExportsRule/invalid-4 - 1]
194-
Diagnostic 1: multipleExportsAreTypes (2:1 - 2:73)
195-
Message: Type exports Type1 and Type2 are not values and should be exported using `export type`.
196-
1 |
197-
2 | export { Type1, value1, Type2, value2 } from './consistent-type-exports';
198-
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
199-
3 |
200-
---
201-
202-
[TestConsistentTypeExportsRule/invalid-5 - 1]
203-
Diagnostic 1: typeOverValue (1:1 - 1:57)
204-
Message: All exports in the declaration are only used as types. Use `export type`.
205-
1 | export { Type2 as Foo } from './consistent-type-exports';
206-
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
207-
---
208-
209-
[TestConsistentTypeExportsRule/invalid-6 - 1]
210-
Diagnostic 1: singleExportIsType (2:1 - 2:65)
211-
Message: Type export Type2 as Foo is not a value and should be exported using `export type`.
212-
1 |
213-
2 | export { Type2 as Foo, value1 } from './consistent-type-exports';
214-
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
215-
3 |
216-
---
217-
218-
[TestConsistentTypeExportsRule/invalid-7 - 1]
219-
Diagnostic 1: singleExportIsType (2:1 - 6:35)
220-
Message: Type export Type2 as Foo is not a value and should be exported using `export type`.
221-
1 |
222-
2 | export {
223-
| ~~~~~~~~
224-
3 | Type2 as Foo,
225-
| ~~~~~~~~~~~~~~~
226-
4 | value1 as BScope,
227-
| ~~~~~~~~~~~~~~~~~~~
228-
5 | value2 as CScope,
229-
| ~~~~~~~~~~~~~~~~~~~
230-
6 | } from './consistent-type-exports';
231-
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
232-
7 |
233-
---
234-
235-
[TestConsistentTypeExportsRule/invalid-8 - 1]
236-
Diagnostic 1: typeOverValue (3:1 - 3:17)
237-
Message: All exports in the declaration are only used as types. Use `export type`.
238-
2 | import { Type2 } from './consistent-type-exports';
239-
3 | export { Type2 };
240-
| ~~~~~~~~~~~~~~~~~
241-
4 |
242-
---
243-
244-
[TestConsistentTypeExportsRule/invalid-9 - 1]
245-
Diagnostic 1: singleExportIsType (3:1 - 3:25)
246-
Message: Type export Type2 is not a value and should be exported using `export type`.
247-
2 | import { value2, Type2 } from './consistent-type-exports';
248-
3 | export { value2, Type2 };
249-
| ~~~~~~~~~~~~~~~~~~~~~~~~~
250-
4 |
251-
---

0 commit comments

Comments
 (0)