-
-
Notifications
You must be signed in to change notification settings - Fork 379
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: upgrade prettier and update snapshots (#2502)
- Loading branch information
Showing
114 changed files
with
4,114 additions
and
667 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 21 additions & 6 deletions
27
crates/biome_formatter_test/src/prettier/package-lock.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,6 @@ | |
"start": "node prepare_tests" | ||
}, | ||
"dependencies": { | ||
"prettier": "3.1.0" | ||
"prettier": "3.2.5" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 0 additions & 5 deletions
5
...s_formatter/tests/specs/prettier/js/arrows/issue-1805-with-body-conditional-expression.js
This file was deleted.
Oops, something went wrong.
10 changes: 0 additions & 10 deletions
10
...sts/specs/prettier/js/arrows/issue-1805-with-body-conditional-expression.js.prettier-snap
This file was deleted.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
crates/biome_js_formatter/tests/specs/prettier/js/chain-expression/issue-15785-1.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
function someFunctionName( | ||
someLongBreakingParameterName, | ||
anotherLongParameterName, | ||
) { | ||
return isEqual(a?.map(([t, _]) => t?.id), b?.map(([t, _]) => t?.id)); | ||
return isEqual(a.map(([t, _]) => t?.id), b.map(([t, _]) => t?.id)); | ||
} | ||
|
13 changes: 13 additions & 0 deletions
13
...iome_js_formatter/tests/specs/prettier/js/chain-expression/issue-15785-1.js.prettier-snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
function someFunctionName( | ||
someLongBreakingParameterName, | ||
anotherLongParameterName, | ||
) { | ||
return isEqual( | ||
a?.map(([t, _]) => t?.id), | ||
b?.map(([t, _]) => t?.id), | ||
); | ||
return isEqual( | ||
a.map(([t, _]) => t?.id), | ||
b.map(([t, _]) => t?.id), | ||
); | ||
} |
6 changes: 6 additions & 0 deletions
6
crates/biome_js_formatter/tests/specs/prettier/js/chain-expression/issue-15785-2.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
const theValue = Object.entries(someLongObjectName).filter( | ||
([listingId]) => someListToCompareToHere?.includes(listingId), | ||
); | ||
const theValue2 = Object.entries(someLongObjectName).filter( | ||
([listingId]) => someListToCompareToHere.includes(listingId), | ||
); |
6 changes: 6 additions & 0 deletions
6
...iome_js_formatter/tests/specs/prettier/js/chain-expression/issue-15785-2.js.prettier-snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
const theValue = Object.entries(someLongObjectName).filter(([listingId]) => | ||
someListToCompareToHere?.includes(listingId), | ||
); | ||
const theValue2 = Object.entries(someLongObjectName).filter(([listingId]) => | ||
someListToCompareToHere.includes(listingId), | ||
); |
6 changes: 6 additions & 0 deletions
6
crates/biome_js_formatter/tests/specs/prettier/js/chain-expression/issue-15785-3.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
logger.log( | ||
`A long template string with a conditional: ${channel?.id}, and then some more content that continues until ${JSON.stringify(location)}` | ||
); | ||
logger.log( | ||
`A long template string with a conditional: ${channel.id}, and then some more content that continues until ${JSON.stringify(location)}` | ||
); |
6 changes: 6 additions & 0 deletions
6
...iome_js_formatter/tests/specs/prettier/js/chain-expression/issue-15785-3.js.prettier-snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
logger.log( | ||
`A long template string with a conditional: ${channel?.id}, and then some more content that continues until ${JSON.stringify(location)}`, | ||
); | ||
logger.log( | ||
`A long template string with a conditional: ${channel.id}, and then some more content that continues until ${JSON.stringify(location)}`, | ||
); |
59 changes: 59 additions & 0 deletions
59
crates/biome_js_formatter/tests/specs/prettier/js/chain-expression/issue-15785-3.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
--- | ||
source: crates/biome_formatter_test/src/snapshot_builder.rs | ||
info: js/chain-expression/issue-15785-3.js | ||
--- | ||
# Input | ||
|
||
```js | ||
logger.log( | ||
`A long template string with a conditional: ${channel?.id}, and then some more content that continues until ${JSON.stringify(location)}` | ||
); | ||
logger.log( | ||
`A long template string with a conditional: ${channel.id}, and then some more content that continues until ${JSON.stringify(location)}` | ||
); | ||
``` | ||
# Prettier differences | ||
```diff | ||
--- Prettier | ||
+++ Biome | ||
@@ -1,6 +1,14 @@ | ||
logger.log( | ||
- `A long template string with a conditional: ${channel?.id}, and then some more content that continues until ${JSON.stringify(location)}`, | ||
+ `A long template string with a conditional: ${ | ||
+ channel?.id | ||
+ }, and then some more content that continues until ${JSON.stringify( | ||
+ location, | ||
+ )}`, | ||
); | ||
logger.log( | ||
- `A long template string with a conditional: ${channel.id}, and then some more content that continues until ${JSON.stringify(location)}`, | ||
+ `A long template string with a conditional: ${ | ||
+ channel.id | ||
+ }, and then some more content that continues until ${JSON.stringify( | ||
+ location, | ||
+ )}`, | ||
); | ||
``` | ||
# Output | ||
```js | ||
logger.log( | ||
`A long template string with a conditional: ${ | ||
channel?.id | ||
}, and then some more content that continues until ${JSON.stringify( | ||
location, | ||
)}`, | ||
); | ||
logger.log( | ||
`A long template string with a conditional: ${ | ||
channel.id | ||
}, and then some more content that continues until ${JSON.stringify( | ||
location, | ||
)}`, | ||
); | ||
``` |
3 changes: 3 additions & 0 deletions
3
crates/biome_js_formatter/tests/specs/prettier/js/chain-expression/issue-15912.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
test() | ||
.test2() | ||
.test2(thing?.something); |
1 change: 1 addition & 0 deletions
1
.../biome_js_formatter/tests/specs/prettier/js/chain-expression/issue-15912.js.prettier-snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
test().test2().test2(thing?.something); |
12 changes: 12 additions & 0 deletions
12
crates/biome_js_formatter/tests/specs/prettier/js/chain-expression/issue-15916.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const randomFuncion = (value) => { | ||
if (value.a) { | ||
funcA( | ||
"", | ||
funcB( | ||
dayjs(value.a?.toString()) | ||
.add(1, "day") | ||
.toISOString() | ||
) | ||
); | ||
} | ||
}; |
5 changes: 5 additions & 0 deletions
5
.../biome_js_formatter/tests/specs/prettier/js/chain-expression/issue-15916.js.prettier-snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const randomFuncion = (value) => { | ||
if (value.a) { | ||
funcA("", funcB(dayjs(value.a?.toString()).add(1, "day").toISOString())); | ||
} | ||
}; |
4 changes: 4 additions & 0 deletions
4
crates/biome_js_formatter/tests/specs/prettier/js/chain-expression/test-2.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{{{{ | ||
const [lastCommittedX, lastCommittedY] = | ||
multiElement?.lastCommittedPoint ?? [0, 0]; | ||
}}}} |
10 changes: 10 additions & 0 deletions
10
crates/biome_js_formatter/tests/specs/prettier/js/chain-expression/test-2.js.prettier-snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
{ | ||
{ | ||
{ | ||
const [lastCommittedX, lastCommittedY] = | ||
multiElement?.lastCommittedPoint ?? [0, 0]; | ||
} | ||
} | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
crates/biome_js_formatter/tests/specs/prettier/js/chain-expression/test-3.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
function getLanguageByInterpreter(languages, file) { | ||
return languages.find((language) => language.interpreters?.includes(interpreter), | ||
); | ||
return languages.find((language) =>language.interpreters.includes(interpreter), | ||
); | ||
} |
8 changes: 8 additions & 0 deletions
8
crates/biome_js_formatter/tests/specs/prettier/js/chain-expression/test-3.js.prettier-snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
function getLanguageByInterpreter(languages, file) { | ||
return languages.find((language) => | ||
language.interpreters?.includes(interpreter), | ||
); | ||
return languages.find((language) => | ||
language.interpreters.includes(interpreter), | ||
); | ||
} |
22 changes: 22 additions & 0 deletions
22
crates/biome_js_formatter/tests/specs/prettier/js/chain-expression/test-4.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// https://github.com/marmelab/react-admin/blob/8c1ddfeb4e011a94609d709c0f4f139fb5d480e8/packages/ra-data-localstorage/src/index.ts#L112 | ||
export default (params) => { | ||
return { | ||
updateMany: (resource, params) => { | ||
updateLocalStorage(() => { | ||
params.ids.forEach(id => { | ||
const index = data.data.data.data.data[resource]?.findIndex( | ||
record => record.id == id | ||
); | ||
const index2 = data.data.data.data.data[resource].findIndex( | ||
record => record.id == id | ||
); | ||
data[resource][index] = { | ||
...data[resource][index], | ||
...params.data, | ||
}; | ||
}); | ||
}); | ||
return baseDataProvider.updateMany(resource, params); | ||
}, | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
crates/biome_js_formatter/tests/specs/prettier/js/chain-expression/test-4.js.prettier-snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// https://github.com/marmelab/react-admin/blob/8c1ddfeb4e011a94609d709c0f4f139fb5d480e8/packages/ra-data-localstorage/src/index.ts#L112 | ||
export default (params) => { | ||
return { | ||
updateMany: (resource, params) => { | ||
updateLocalStorage(() => { | ||
params.ids.forEach((id) => { | ||
const index = data.data.data.data.data[resource]?.findIndex( | ||
(record) => record.id == id, | ||
); | ||
const index2 = data.data.data.data.data[resource].findIndex( | ||
(record) => record.id == id, | ||
); | ||
data[resource][index] = { | ||
...data[resource][index], | ||
...params.data, | ||
}; | ||
}); | ||
}); | ||
return baseDataProvider.updateMany(resource, params); | ||
}, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -120,7 +120,6 @@ function inlineComment() { | |
) || 42 | ||
} | ||
|
||
|
||
function multilineBlockSameLine() { | ||
return ( | ||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -127,7 +127,6 @@ function inlineComment() { | |
) || 42 | ||
} | ||
|
||
|
||
function multilineBlockSameLine() { | ||
return ( | ||
/** | ||
|
17 changes: 17 additions & 0 deletions
17
crates/biome_js_formatter/tests/specs/prettier/js/cursor/cursor-11.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// At the time of adding this test, the cursor positioning we end up with | ||
// here seems clearly wrong. | ||
// I'm adding the test case anyway to demonstrate the brokenness and ensure | ||
// that if a future changes fixes it, it'll be obvious from the PR diff that | ||
// the fix happened. | ||
[ | ||
[ | ||
[ | ||
[ | ||
1, | ||
2, | ||
<|> 3, "looooooooooooooooooooooooooooooooooooooooooooooooooong", | ||
"looooooooooooooooooooooooooooooooooooooooooooooooooong", | ||
] | ||
] | ||
] | ||
] |
18 changes: 18 additions & 0 deletions
18
crates/biome_js_formatter/tests/specs/prettier/js/cursor/cursor-11.js.prettier-snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// At the time of adding this test, the cursor positioning we end up with | ||
// here seems clearly wrong. | ||
// I'm adding the test case anyway to demonstrate the brokenness and ensure | ||
// that if a future changes fixes it, it'll be obvious from the PR diff that | ||
// the fix happened. | ||
[ | ||
[ | ||
[ | ||
[ | ||
1, | ||
2, | ||
3, | ||
<|> "looooooooooooooooooooooooooooooooooooooooooooooooooong", | ||
"looooooooooooooooooooooooooooooooooooooooooooooooooong", | ||
], | ||
], | ||
], | ||
]; |
17 changes: 17 additions & 0 deletions
17
crates/biome_js_formatter/tests/specs/prettier/js/cursor/cursor-12.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// At the time of adding this test, the cursor positioning we end up with | ||
// here seems clearly wrong. | ||
// I'm adding the test case anyway to demonstrate the brokenness and ensure | ||
// that if a future changes fixes it, it'll be obvious from the PR diff that | ||
// the fix happened. | ||
[ | ||
[ | ||
[ | ||
[ | ||
1, | ||
2, | ||
3 <|> ,"looooooooooooooooooooooooooooooooooooooooooooooooooong", | ||
"looooooooooooooooooooooooooooooooooooooooooooooooooong", | ||
] | ||
] | ||
] | ||
] |
18 changes: 18 additions & 0 deletions
18
crates/biome_js_formatter/tests/specs/prettier/js/cursor/cursor-12.js.prettier-snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// At the time of adding this test, the cursor positioning we end up with | ||
// here seems clearly wrong. | ||
// I'm adding the test case anyway to demonstrate the brokenness and ensure | ||
// that if a future changes fixes it, it'll be obvious from the PR diff that | ||
// the fix happened. | ||
[ | ||
[ | ||
[ | ||
[ | ||
1, | ||
2, | ||
3, | ||
<|> "looooooooooooooooooooooooooooooooooooooooooooooooooong", | ||
"looooooooooooooooooooooooooooooooooooooooooooooooooong", | ||
], | ||
], | ||
], | ||
]; |
3 changes: 3 additions & 0 deletions
3
crates/biome_js_formatter/tests/specs/prettier/js/cursor/cursor-13.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import lib from './lib.js'; | ||
|
||
function myFunction() { return 'foo'; }<|> |
5 changes: 5 additions & 0 deletions
5
crates/biome_js_formatter/tests/specs/prettier/js/cursor/cursor-13.js.prettier-snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import lib from "./lib.js"; | ||
|
||
function myFunction() { | ||
return "foo"; | ||
}<|> |
Oops, something went wrong.