Skip to content

Commit a937890

Browse files
committed
feat(formatter)!: Default to lineWidth: 100 (#15933)
Fixes #15900 - Update default 80 > 100 - Set `printWidth: 80` for fixture tests - Test diffs are all just adding header part for used options - Also use `printWidth: 80` for `prettier_conformance`
1 parent 4b9d8d2 commit a937890

File tree

77 files changed

+255
-46
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

+255
-46
lines changed

crates/oxc_formatter/src/formatter/printer/mod.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1480,6 +1480,7 @@ two lines`,
14801480
&token("\"0123456789\""),
14811481
&token("\"0123456789\""),
14821482
&token("\"0123456789\""),
1483+
&token("\"0123456789\""),
14831484
],
14841485
},
14851486
],
@@ -1492,7 +1493,7 @@ two lines`,
14921493
"b",
14931494
"c",
14941495
"d",
1495-
["0123456789", "0123456789", "0123456789", "0123456789", "0123456789"],
1496+
["0123456789", "0123456789", "0123456789", "0123456789", "0123456789", "0123456789"],
14961497
]"#,
14971498
result.as_code()
14981499
);
@@ -1689,7 +1690,7 @@ two lines`,
16891690
write!(
16901691
f,
16911692
[
1692-
group(&token("Group with id-1 does not fit on the line because it exceeds the line width of 80 characters by")).with_group_id(Some(id_1)),
1693+
group(&token("Group with id-1 does not fit on the line because it exceeds the line width of 100 characters by..........")).with_group_id(Some(id_1)),
16931694
hard_line_break()
16941695
]
16951696
)?;
@@ -1709,7 +1710,7 @@ two lines`,
17091710
assert_eq!(
17101711
printed.as_code(),
17111712
r"Group with id-2
1712-
Group with id-1 does not fit on the line because it exceeds the line width of 80 characters by
1713+
Group with id-1 does not fit on the line because it exceeds the line width of 100 characters by..........
17131714
Group 2 fits
17141715
Group 1 breaks"
17151716
);

crates/oxc_formatter/src/options.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub struct FormatOptions {
2323
/// The type of line ending.
2424
pub line_ending: LineEnding,
2525

26-
/// What's the max width of a line. Defaults to 80.
26+
/// What's the max width of a line. Defaults to 100.
2727
pub line_width: LineWidth,
2828

2929
/// The style for quotes. Defaults to double.
@@ -301,7 +301,7 @@ impl LineWidth {
301301

302302
impl Default for LineWidth {
303303
fn default() -> Self {
304-
Self(80)
304+
Self(100)
305305
}
306306
}
307307

crates/oxc_formatter/src/service/oxfmtrc.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub struct Oxfmtrc {
2525
/// Which end of line characters to apply. (Default: "lf")
2626
#[serde(skip_serializing_if = "Option::is_none")]
2727
pub end_of_line: Option<EndOfLineConfig>,
28-
/// The line length that the printer will wrap on. (Default: 80)
28+
/// The line length that the printer will wrap on. (Default: 100)
2929
#[serde(skip_serializing_if = "Option::is_none")]
3030
pub print_width: Option<u16>,
3131
/// Use single quotes instead of double quotes. (Default: false)
@@ -444,7 +444,7 @@ mod tests {
444444
// Should use defaults
445445
assert!(options.indent_style.is_space());
446446
assert_eq!(options.indent_width.value(), 2);
447-
assert_eq!(options.line_width.value(), 80);
447+
assert_eq!(options.line_width.value(), 100);
448448
assert_eq!(options.experimental_sort_imports, None);
449449
}
450450

@@ -456,7 +456,7 @@ mod tests {
456456
// Should use defaults
457457
assert!(options.indent_style.is_space());
458458
assert_eq!(options.indent_width.value(), 2);
459-
assert_eq!(options.line_width.value(), 80);
459+
assert_eq!(options.line_width.value(), 100);
460460
assert_eq!(options.experimental_sort_imports, None);
461461
}
462462

crates/oxc_formatter/tests/fixtures/js/arguments/empty-lines.js.snap

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ call(() => {
4949
);
5050

5151
==================== Output ====================
52+
------------------
53+
{ printWidth: 80 }
54+
------------------
5255
call(() => {
5356
// ...
5457
}, "good");

crates/oxc_formatter/tests/fixtures/js/arguments/long-curried-call/trailing-comma.js.snap

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,25 @@ Event.debounce(
88
)(() => { });
99

1010
==================== Output ====================
11-
-------------------------
12-
{ trailingComma: "none" }
13-
-------------------------
11+
-----------------------------------------
12+
{ printWidth: 80, trailingComma: "none" }
13+
-----------------------------------------
1414
Event.debounce(
1515
call(A, B),
1616
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
1717
)(() => {});
1818

19-
------------------------
20-
{ trailingComma: "es5" }
21-
------------------------
19+
----------------------------------------
20+
{ printWidth: 80, trailingComma: "es5" }
21+
----------------------------------------
2222
Event.debounce(
2323
call(A, B),
2424
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
2525
)(() => {});
2626

27-
------------------------
28-
{ trailingComma: "all" }
29-
------------------------
27+
----------------------------------------
28+
{ printWidth: 80, trailingComma: "all" }
29+
----------------------------------------
3030
Event.debounce(
3131
call(A, B),
3232
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD,

crates/oxc_formatter/tests/fixtures/js/array-assignment/rest-only.js.snap

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ source: crates/oxc_formatter/tests/fixtures/mod.rs
55
[...rest] = arr;
66

77
==================== Output ====================
8+
------------------
9+
{ printWidth: 80 }
10+
------------------
811
[...rest] = arr;
912

1013
===================== End =====================

crates/oxc_formatter/tests/fixtures/js/array-pattern/rest-only.js.snap

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ source: crates/oxc_formatter/tests/fixtures/mod.rs
55
const [...rest] = arr;
66

77
==================== Output ====================
8+
------------------
9+
{ printWidth: 80 }
10+
------------------
811
const [...rest] = arr;
912

1013
===================== End =====================

crates/oxc_formatter/tests/fixtures/js/assignments/parenthesis.js.snap

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ source: crates/oxc_formatter/tests/fixtures/mod.rs
55
object[key = "a" + "b"];
66

77
==================== Output ====================
8+
------------------
9+
{ printWidth: 80 }
10+
------------------
811
object[(key = "a" + "b")];
912

1013
===================== End =====================

crates/oxc_formatter/tests/fixtures/js/assignments/static-member.js.snap

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ source: crates/oxc_formatter/tests/fixtures/mod.rs
55
options = BracketMatchingControllerLONGLONGLONG._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER;
66

77
==================== Output ====================
8+
------------------
9+
{ printWidth: 80 }
10+
------------------
811
options =
912
BracketMatchingControllerLONGLONGLONG._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER;
1013

crates/oxc_formatter/tests/fixtures/js/awaits/nested.js.snap

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ vite = await (
88
appType
99
})
1010
==================== Output ====================
11+
------------------
12+
{ printWidth: 80 }
13+
------------------
1114
vite = await (
1215
await import("vite")
1316
).createServer({

0 commit comments

Comments
 (0)