--- source: crates/rome_formatter_test/src/snapshot_builder.rs info: test_file: js/rest/trailing-commas.js --- # Input ```js declare class C { f( superSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperLong, ...args ): void, } function f( superSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperLong, ...args ) {} declare class C { f(...superSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperLong): void; } [superSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperLong,,]; [veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLong, ...a] = []; var {veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLong, ...a} = {}; ``` # Prettier differences ```diff --- Prettier +++ Rome @@ -2,7 +2,7 @@ f( superSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperLong, ...args - ): void; + ): void, } function f( @@ -10,11 +10,7 @@ ...args ) {} -declare class C { - f( - ...superSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperLong - ): void; -} +declare class C { f(...superSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperLong): void; } [ superSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperLong, ``` # Output ```js declare class C { f( superSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperLong, ...args ): void, } function f( superSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperLong, ...args ) {} declare class C { f(...superSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperLong): void; } [ superSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperLong, , ]; [ veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLong, ...a ] = []; var { veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLong, ...a } = {}; ``` # Errors ``` trailing-commas.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × The 'declare' modifier can only be used in TypeScript files. > 1 │ declare class C { │ ^^^^^^^ 2 │ f( 3 │ superSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperLong, trailing-commas.js:13:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × The 'declare' modifier can only be used in TypeScript files. 11 │ ) {} 12 │ > 13 │ declare class C { f(...superSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperLong): void; } │ ^^^^^^^ 14 │ 15 │ [superSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperLong,,]; ``` # Lines exceeding max width of 80 characters ``` 13: declare class C { f(...superSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperLong): void; } 16: superSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperLong, ```