--- source: crates/rome_formatter_test/src/snapshot_builder.rs info: test_file: js/module/string/string.js --- # Input ```js import hey from "hey" import hey from "hey"; import "x" assert { type: "json" } import "foo" assert { "type": "json" }; import foo from "foo.json" assert { type: "json" }; import foo from "foo.json" assert { type: "json" }; import foo2 from "foo.json" assert { "type": "json", type: "html", "type": "js" }; import a, * as b from "foo" const foo = {}; foo["bar"] = true; foo["foo-bar"] = true; foo.bar["bar"]["lorem_ispsum"].foo["lorem-ipsum"] = true; a[ b ] c?.[ d ] let a = { // leading comment "type": "bar" // trailing comment } class Foo extends Boar { static { // some comment this.a = "test"; } method() { return "ipsum"; } static staticMethod() { return "bar" } } export * from "hey" export * as something_bad_will_happen from "something_bad_might_not_happen" export * as something_bad_will_happen from "something_bad_might_not_happen" assert { "type": "json", "type2": "json3"} // this one should switch to use single quotes ("content '' \"\"\" "); // this one should switch to use double quotes ('content \'\' " '); // you should keep all the character as they are ("content \\' \\' "); // you should remove the escape ("content \'\' ") ``` ============================= # Outputs ## Output 1 ----- Indent style: Tab Line width: 80 Quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always ----- ```js import hey from "hey"; import hey from "hey"; import "x" assert { type: "json" }; import "foo" assert { "type": "json" }; import foo from "foo.json" assert { type: "json" }; import foo from "foo.json" assert { type: "json" }; import foo2 from "foo.json" assert { "type": "json", type: "html", "type": "js", }; import a, * as b from "foo"; const foo = {}; foo["bar"] = true; foo["foo-bar"] = true; foo.bar["bar"]["lorem_ispsum"].foo["lorem-ipsum"] = true; a[b]; c?.[d]; let a = { // leading comment type: "bar", // trailing comment }; class Foo extends Boar { static { // some comment this.a = "test"; } method() { return "ipsum"; } static staticMethod() { return "bar"; } } export * from "hey"; export * as something_bad_will_happen from "something_bad_might_not_happen"; export * as something_bad_will_happen from "something_bad_might_not_happen" assert { "type": "json", "type2": "json3", }; // this one should switch to use single quotes ('content \'\' """ '); // this one should switch to use double quotes ("content '' \" "); // you should keep all the character as they are ("content \\' \\' "); // you should remove the escape ("content '' "); ``` # Lines exceeding max width of 80 characters ``` 48: export * as something_bad_will_happen from "something_bad_might_not_happen" assert { ``` ## Output 2 ----- Indent style: Tab Line width: 80 Quote style: Single Quotes Quote properties: As needed Trailing comma: All Semicolons: Always ----- ```js import hey from 'hey'; import hey from 'hey'; import 'x' assert { type: 'json' }; import 'foo' assert { 'type': 'json' }; import foo from 'foo.json' assert { type: 'json' }; import foo from 'foo.json' assert { type: 'json' }; import foo2 from 'foo.json' assert { 'type': 'json', type: "html", "type": "js", }; import a, * as b from 'foo'; const foo = {}; foo['bar'] = true; foo['foo-bar'] = true; foo.bar['bar']['lorem_ispsum'].foo['lorem-ipsum'] = true; a[b]; c?.[d]; let a = { // leading comment type: 'bar', // trailing comment }; class Foo extends Boar { static { // some comment this.a = 'test'; } method() { return 'ipsum'; } static staticMethod() { return 'bar'; } } export * from 'hey'; export * as something_bad_will_happen from 'something_bad_might_not_happen'; export * as something_bad_will_happen from 'something_bad_might_not_happen' assert { 'type': 'json', 'type2': 'json3', }; // this one should switch to use single quotes ('content \'\' """ '); // this one should switch to use double quotes ("content '' \" "); // you should keep all the character as they are ("content \\' \\' "); // you should remove the escape ("content '' "); ``` # Lines exceeding max width of 80 characters ``` 48: export * as something_bad_will_happen from 'something_bad_might_not_happen' assert { ``` ## Output 3 ----- Indent style: Tab Line width: 80 Quote style: Double Quotes Quote properties: Preserve Trailing comma: All Semicolons: Always ----- ```js import hey from "hey"; import hey from "hey"; import "x" assert { type: "json" }; import "foo" assert { "type": "json" }; import foo from "foo.json" assert { type: "json" }; import foo from "foo.json" assert { type: "json" }; import foo2 from "foo.json" assert { "type": "json", type: "html", "type": "js", }; import a, * as b from "foo"; const foo = {}; foo["bar"] = true; foo["foo-bar"] = true; foo.bar["bar"]["lorem_ispsum"].foo["lorem-ipsum"] = true; a[b]; c?.[d]; let a = { // leading comment "type": "bar", // trailing comment }; class Foo extends Boar { static { // some comment this.a = "test"; } method() { return "ipsum"; } static staticMethod() { return "bar"; } } export * from "hey"; export * as something_bad_will_happen from "something_bad_might_not_happen"; export * as something_bad_will_happen from "something_bad_might_not_happen" assert { "type": "json", "type2": "json3", }; // this one should switch to use single quotes ('content \'\' """ '); // this one should switch to use double quotes ("content '' \" "); // you should keep all the character as they are ("content \\' \\' "); // you should remove the escape ("content '' "); ``` # Lines exceeding max width of 80 characters ``` 48: export * as something_bad_will_happen from "something_bad_might_not_happen" assert { ```