--- source: crates/rome_formatter_test/src/snapshot_builder.rs info: test_file: js/record/computed.js --- # Input ```js const key = "a"; assert(#{ [key]: 1 } === #{ a: 1 }) assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) assert(#{ [true]: 1 } === #{ true: 1 }) assert(#{ [true]: 1 } === #{ ["true"]: 1 }) assert(#{ [1 + 1]: "two" } === #{ 2: "two" }) assert(#{ [9 + 1]: "ten" } === #{ ["10"]: "ten" }) ``` # Prettier differences ```diff --- Prettier +++ Rome @@ -1,9 +1,9 @@ const key = "a"; -assert(#{ [key]: 1 } === #{ a: 1 }); -assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }); +assert(#{ [key]: 1 } === #{ a: 1 }) +assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) -assert(#{ [true]: 1 } === #{ true: 1 }); -assert(#{ [true]: 1 } === #{ ["true"]: 1 }); +assert(#{ [true]: 1 } === #{ true: 1 }) +assert(#{ [true]: 1 } === #{ ["true"]: 1 }) -assert(#{ [1 + 1]: "two" } === #{ 2: "two" }); -assert(#{ [9 + 1]: "ten" } === #{ ["10"]: "ten" }); +assert(#{ [1 + 1]: "two" } === #{ 2: "two" }) +assert(#{ [9 + 1]: "ten" } === #{ ["10"]: "ten" }) ``` # Output ```js const key = "a"; assert(#{ [key]: 1 } === #{ a: 1 }) assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) assert(#{ [true]: 1 } === #{ true: 1 }) assert(#{ [true]: 1 } === #{ ["true"]: 1 }) assert(#{ [1 + 1]: "two" } === #{ 2: "two" }) assert(#{ [9 + 1]: "ten" } === #{ ["10"]: "ten" }) ``` # Errors ``` computed.js:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected an identifier but instead found '{' 1 │ const key = "a"; > 2 │ assert(#{ [key]: 1 } === #{ a: 1 }) │ ^ 3 │ assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) 4 │ i Expected an identifier here 1 │ const key = "a"; > 2 │ assert(#{ [key]: 1 } === #{ a: 1 }) │ ^ 3 │ assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) 4 │ computed.js:2:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression 1 │ const key = "a"; > 2 │ assert(#{ [key]: 1 } === #{ a: 1 }) │ ^ 3 │ assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) 4 │ computed.js:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `,` but instead found `{` 1 │ const key = "a"; > 2 │ assert(#{ [key]: 1 } === #{ a: 1 }) │ ^ 3 │ assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) 4 │ i Remove { computed.js:2:27 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected an identifier but instead found '{' 1 │ const key = "a"; > 2 │ assert(#{ [key]: 1 } === #{ a: 1 }) │ ^ 3 │ assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) 4 │ i Expected an identifier here 1 │ const key = "a"; > 2 │ assert(#{ [key]: 1 } === #{ a: 1 }) │ ^ 3 │ assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) 4 │ computed.js:2:26 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression 1 │ const key = "a"; > 2 │ assert(#{ [key]: 1 } === #{ a: 1 }) │ ^ 3 │ assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) 4 │ computed.js:2:27 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `,` but instead found `{` 1 │ const key = "a"; > 2 │ assert(#{ [key]: 1 } === #{ a: 1 }) │ ^ 3 │ assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) 4 │ i Remove { computed.js:3:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected an identifier but instead found '{' 1 │ const key = "a"; 2 │ assert(#{ [key]: 1 } === #{ a: 1 }) > 3 │ assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) │ ^ 4 │ 5 │ assert(#{ [true]: 1 } === #{ true: 1 }) i Expected an identifier here 1 │ const key = "a"; 2 │ assert(#{ [key]: 1 } === #{ a: 1 }) > 3 │ assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) │ ^ 4 │ 5 │ assert(#{ [true]: 1 } === #{ true: 1 }) computed.js:3:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression 1 │ const key = "a"; 2 │ assert(#{ [key]: 1 } === #{ a: 1 }) > 3 │ assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) │ ^ 4 │ 5 │ assert(#{ [true]: 1 } === #{ true: 1 }) computed.js:3:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `,` but instead found `{` 1 │ const key = "a"; 2 │ assert(#{ [key]: 1 } === #{ a: 1 }) > 3 │ assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) │ ^ 4 │ 5 │ assert(#{ [true]: 1 } === #{ true: 1 }) i Remove { computed.js:3:41 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected an identifier but instead found '{' 1 │ const key = "a"; 2 │ assert(#{ [key]: 1 } === #{ a: 1 }) > 3 │ assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) │ ^ 4 │ 5 │ assert(#{ [true]: 1 } === #{ true: 1 }) i Expected an identifier here 1 │ const key = "a"; 2 │ assert(#{ [key]: 1 } === #{ a: 1 }) > 3 │ assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) │ ^ 4 │ 5 │ assert(#{ [true]: 1 } === #{ true: 1 }) computed.js:3:40 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression 1 │ const key = "a"; 2 │ assert(#{ [key]: 1 } === #{ a: 1 }) > 3 │ assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) │ ^ 4 │ 5 │ assert(#{ [true]: 1 } === #{ true: 1 }) computed.js:3:41 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `,` but instead found `{` 1 │ const key = "a"; 2 │ assert(#{ [key]: 1 } === #{ a: 1 }) > 3 │ assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) │ ^ 4 │ 5 │ assert(#{ [true]: 1 } === #{ true: 1 }) i Remove { computed.js:5:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected an identifier but instead found '{' 3 │ assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) 4 │ > 5 │ assert(#{ [true]: 1 } === #{ true: 1 }) │ ^ 6 │ assert(#{ [true]: 1 } === #{ ["true"]: 1 }) 7 │ i Expected an identifier here 3 │ assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) 4 │ > 5 │ assert(#{ [true]: 1 } === #{ true: 1 }) │ ^ 6 │ assert(#{ [true]: 1 } === #{ ["true"]: 1 }) 7 │ computed.js:5:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression 3 │ assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) 4 │ > 5 │ assert(#{ [true]: 1 } === #{ true: 1 }) │ ^ 6 │ assert(#{ [true]: 1 } === #{ ["true"]: 1 }) 7 │ computed.js:5:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `,` but instead found `{` 3 │ assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) 4 │ > 5 │ assert(#{ [true]: 1 } === #{ true: 1 }) │ ^ 6 │ assert(#{ [true]: 1 } === #{ ["true"]: 1 }) 7 │ i Remove { computed.js:5:28 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected an identifier but instead found '{' 3 │ assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) 4 │ > 5 │ assert(#{ [true]: 1 } === #{ true: 1 }) │ ^ 6 │ assert(#{ [true]: 1 } === #{ ["true"]: 1 }) 7 │ i Expected an identifier here 3 │ assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) 4 │ > 5 │ assert(#{ [true]: 1 } === #{ true: 1 }) │ ^ 6 │ assert(#{ [true]: 1 } === #{ ["true"]: 1 }) 7 │ computed.js:5:27 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression 3 │ assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) 4 │ > 5 │ assert(#{ [true]: 1 } === #{ true: 1 }) │ ^ 6 │ assert(#{ [true]: 1 } === #{ ["true"]: 1 }) 7 │ computed.js:5:28 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `,` but instead found `{` 3 │ assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) 4 │ > 5 │ assert(#{ [true]: 1 } === #{ true: 1 }) │ ^ 6 │ assert(#{ [true]: 1 } === #{ ["true"]: 1 }) 7 │ i Remove { computed.js:6:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected an identifier but instead found '{' 5 │ assert(#{ [true]: 1 } === #{ true: 1 }) > 6 │ assert(#{ [true]: 1 } === #{ ["true"]: 1 }) │ ^ 7 │ 8 │ assert(#{ [1 + 1]: "two" } === #{ 2: "two" }) i Expected an identifier here 5 │ assert(#{ [true]: 1 } === #{ true: 1 }) > 6 │ assert(#{ [true]: 1 } === #{ ["true"]: 1 }) │ ^ 7 │ 8 │ assert(#{ [1 + 1]: "two" } === #{ 2: "two" }) computed.js:6:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression 5 │ assert(#{ [true]: 1 } === #{ true: 1 }) > 6 │ assert(#{ [true]: 1 } === #{ ["true"]: 1 }) │ ^ 7 │ 8 │ assert(#{ [1 + 1]: "two" } === #{ 2: "two" }) computed.js:6:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `,` but instead found `{` 5 │ assert(#{ [true]: 1 } === #{ true: 1 }) > 6 │ assert(#{ [true]: 1 } === #{ ["true"]: 1 }) │ ^ 7 │ 8 │ assert(#{ [1 + 1]: "two" } === #{ 2: "two" }) i Remove { computed.js:6:28 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected an identifier but instead found '{' 5 │ assert(#{ [true]: 1 } === #{ true: 1 }) > 6 │ assert(#{ [true]: 1 } === #{ ["true"]: 1 }) │ ^ 7 │ 8 │ assert(#{ [1 + 1]: "two" } === #{ 2: "two" }) i Expected an identifier here 5 │ assert(#{ [true]: 1 } === #{ true: 1 }) > 6 │ assert(#{ [true]: 1 } === #{ ["true"]: 1 }) │ ^ 7 │ 8 │ assert(#{ [1 + 1]: "two" } === #{ 2: "two" }) computed.js:6:27 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression 5 │ assert(#{ [true]: 1 } === #{ true: 1 }) > 6 │ assert(#{ [true]: 1 } === #{ ["true"]: 1 }) │ ^ 7 │ 8 │ assert(#{ [1 + 1]: "two" } === #{ 2: "two" }) computed.js:6:28 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `,` but instead found `{` 5 │ assert(#{ [true]: 1 } === #{ true: 1 }) > 6 │ assert(#{ [true]: 1 } === #{ ["true"]: 1 }) │ ^ 7 │ 8 │ assert(#{ [1 + 1]: "two" } === #{ 2: "two" }) i Remove { computed.js:8:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected an identifier but instead found '{' 6 │ assert(#{ [true]: 1 } === #{ ["true"]: 1 }) 7 │ > 8 │ assert(#{ [1 + 1]: "two" } === #{ 2: "two" }) │ ^ 9 │ assert(#{ [9 + 1]: "ten" } === #{ ["10"]: "ten" }) 10 │ i Expected an identifier here 6 │ assert(#{ [true]: 1 } === #{ ["true"]: 1 }) 7 │ > 8 │ assert(#{ [1 + 1]: "two" } === #{ 2: "two" }) │ ^ 9 │ assert(#{ [9 + 1]: "ten" } === #{ ["10"]: "ten" }) 10 │ computed.js:8:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression 6 │ assert(#{ [true]: 1 } === #{ ["true"]: 1 }) 7 │ > 8 │ assert(#{ [1 + 1]: "two" } === #{ 2: "two" }) │ ^ 9 │ assert(#{ [9 + 1]: "ten" } === #{ ["10"]: "ten" }) 10 │ computed.js:8:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `,` but instead found `{` 6 │ assert(#{ [true]: 1 } === #{ ["true"]: 1 }) 7 │ > 8 │ assert(#{ [1 + 1]: "two" } === #{ 2: "two" }) │ ^ 9 │ assert(#{ [9 + 1]: "ten" } === #{ ["10"]: "ten" }) 10 │ i Remove { computed.js:8:33 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected an identifier but instead found '{' 6 │ assert(#{ [true]: 1 } === #{ ["true"]: 1 }) 7 │ > 8 │ assert(#{ [1 + 1]: "two" } === #{ 2: "two" }) │ ^ 9 │ assert(#{ [9 + 1]: "ten" } === #{ ["10"]: "ten" }) 10 │ i Expected an identifier here 6 │ assert(#{ [true]: 1 } === #{ ["true"]: 1 }) 7 │ > 8 │ assert(#{ [1 + 1]: "two" } === #{ 2: "two" }) │ ^ 9 │ assert(#{ [9 + 1]: "ten" } === #{ ["10"]: "ten" }) 10 │ computed.js:8:32 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression 6 │ assert(#{ [true]: 1 } === #{ ["true"]: 1 }) 7 │ > 8 │ assert(#{ [1 + 1]: "two" } === #{ 2: "two" }) │ ^ 9 │ assert(#{ [9 + 1]: "ten" } === #{ ["10"]: "ten" }) 10 │ computed.js:8:33 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `,` but instead found `{` 6 │ assert(#{ [true]: 1 } === #{ ["true"]: 1 }) 7 │ > 8 │ assert(#{ [1 + 1]: "two" } === #{ 2: "two" }) │ ^ 9 │ assert(#{ [9 + 1]: "ten" } === #{ ["10"]: "ten" }) 10 │ i Remove { computed.js:9:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected an identifier but instead found '{' 8 │ assert(#{ [1 + 1]: "two" } === #{ 2: "two" }) > 9 │ assert(#{ [9 + 1]: "ten" } === #{ ["10"]: "ten" }) │ ^ 10 │ i Expected an identifier here 8 │ assert(#{ [1 + 1]: "two" } === #{ 2: "two" }) > 9 │ assert(#{ [9 + 1]: "ten" } === #{ ["10"]: "ten" }) │ ^ 10 │ computed.js:9:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression 8 │ assert(#{ [1 + 1]: "two" } === #{ 2: "two" }) > 9 │ assert(#{ [9 + 1]: "ten" } === #{ ["10"]: "ten" }) │ ^ 10 │ computed.js:9:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `,` but instead found `{` 8 │ assert(#{ [1 + 1]: "two" } === #{ 2: "two" }) > 9 │ assert(#{ [9 + 1]: "ten" } === #{ ["10"]: "ten" }) │ ^ 10 │ i Remove { computed.js:9:33 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected an identifier but instead found '{' 8 │ assert(#{ [1 + 1]: "two" } === #{ 2: "two" }) > 9 │ assert(#{ [9 + 1]: "ten" } === #{ ["10"]: "ten" }) │ ^ 10 │ i Expected an identifier here 8 │ assert(#{ [1 + 1]: "two" } === #{ 2: "two" }) > 9 │ assert(#{ [9 + 1]: "ten" } === #{ ["10"]: "ten" }) │ ^ 10 │ computed.js:9:32 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression 8 │ assert(#{ [1 + 1]: "two" } === #{ 2: "two" }) > 9 │ assert(#{ [9 + 1]: "ten" } === #{ ["10"]: "ten" }) │ ^ 10 │ computed.js:9:33 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `,` but instead found `{` 8 │ assert(#{ [1 + 1]: "two" } === #{ 2: "two" }) > 9 │ assert(#{ [9 + 1]: "ten" } === #{ ["10"]: "ten" }) │ ^ 10 │ i Remove { ```