|
2 | 2 | source: crates/oxc_formatter/tests/fixtures/mod.rs |
3 | 3 | --- |
4 | 4 | ==================== Input ==================== |
5 | | -// Issue #22273 - Should retain space after comma in import attributes |
| 5 | +// Issue #22273 - Should have a space after commas in import attributes |
6 | 6 | import myEmbeddedDb from './my.db' with { type: 'sqlite', embed: 'true' } |
| 7 | +import myEmbeddedDb2 from './my.db' with {type: 'sqlite',embed: 'true'} |
| 8 | +import myEmbeddedDb3 from './my.db' with { embed: 'true', type: 'sqlite' } |
7 | 9 |
|
8 | | -// Should be spread over multiple lines |
9 | | -import myEmbeddedDb from './my.db' with { type: 'sqlite', embed: 'true', veryLongAttribute: "true" } |
10 | | - |
11 | | -// Shouldn't have a comma for a single attribute |
12 | | -import myEmbeddedDb from './my.db' with { type: 'sqlite' } |
13 | | - |
14 | | - |
| 10 | +// Should spread over multiple lines |
| 11 | +import myEmbeddedDb4 from './my.db' with { type: 'sqlite', embed: 'true', veryLongAttribute: 'true' } |
| 12 | +import myEmbeddedDb5 from './my.db' with { veryVeryVeryVeryVeryVeryVeryVeryVeryLongAttribute: 'true' } |
15 | 13 |
|
16 | 14 | ==================== Output ==================== |
17 | 15 | ------------------ |
18 | 16 | { printWidth: 80 } |
19 | 17 | ------------------ |
20 | | -// Issue #22273 - Should retain space after comma in import attributes |
| 18 | +// Issue #22273 - Should have a space after commas in import attributes |
21 | 19 | import myEmbeddedDb from "./my.db" with { type: "sqlite", embed: "true" }; |
| 20 | +import myEmbeddedDb2 from "./my.db" with { type: "sqlite", embed: "true" }; |
| 21 | +import myEmbeddedDb3 from "./my.db" with { embed: "true", type: "sqlite" }; |
22 | 22 |
|
23 | | -// Should be spread over multiple lines |
24 | | -import myEmbeddedDb from "./my.db" with { |
| 23 | +// Should spread over multiple lines |
| 24 | +import myEmbeddedDb4 from "./my.db" with { |
25 | 25 | type: "sqlite", |
26 | 26 | embed: "true", |
27 | 27 | veryLongAttribute: "true", |
28 | 28 | }; |
29 | | - |
30 | | -// Shouldn't have a comma for a single attribute |
31 | | -import myEmbeddedDb from "./my.db" with { type: "sqlite" }; |
| 29 | +import myEmbeddedDb5 from "./my.db" with { |
| 30 | + veryVeryVeryVeryVeryVeryVeryVeryVeryLongAttribute: "true", |
| 31 | +}; |
32 | 32 |
|
33 | 33 | ------------------- |
34 | 34 | { printWidth: 100 } |
35 | 35 | ------------------- |
36 | | -// Issue #22273 - Should retain space after comma in import attributes |
| 36 | +// Issue #22273 - Should have a space after commas in import attributes |
37 | 37 | import myEmbeddedDb from "./my.db" with { type: "sqlite", embed: "true" }; |
| 38 | +import myEmbeddedDb2 from "./my.db" with { type: "sqlite", embed: "true" }; |
| 39 | +import myEmbeddedDb3 from "./my.db" with { embed: "true", type: "sqlite" }; |
38 | 40 |
|
39 | | -// Should be spread over multiple lines |
40 | | -import myEmbeddedDb from "./my.db" with { |
| 41 | +// Should spread over multiple lines |
| 42 | +import myEmbeddedDb4 from "./my.db" with { |
41 | 43 | type: "sqlite", |
42 | 44 | embed: "true", |
43 | 45 | veryLongAttribute: "true", |
44 | 46 | }; |
45 | | - |
46 | | -// Shouldn't have a comma for a single attribute |
47 | | -import myEmbeddedDb from "./my.db" with { type: "sqlite" }; |
| 47 | +import myEmbeddedDb5 from "./my.db" with { |
| 48 | + veryVeryVeryVeryVeryVeryVeryVeryVeryLongAttribute: "true", |
| 49 | +}; |
48 | 50 |
|
49 | 51 | ===================== End ===================== |
0 commit comments