-
-
Notifications
You must be signed in to change notification settings - Fork 504
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(formatter/member-chain): regex formatting (#474)
- Loading branch information
1 parent
369998a
commit b2ec1ad
Showing
5 changed files
with
139 additions
and
392 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
24 changes: 24 additions & 0 deletions
24
...s/biome_js_formatter/tests/specs/js/module/expression/member-chain/static_member_regex.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,24 @@ | ||
// 5-len regex | ||
z.string().min(2).max(200).regex(/[a-z]/gm, { | ||
message: 'Only English alphabet symbols and hyphen allowed', | ||
}) | ||
|
||
// <5-len regex | ||
z.string().min(2).max(200).regex(/\w+/gm, { | ||
message: 'Only English alphabet symbols and hyphen allowed', | ||
}) | ||
|
||
|
||
// >5-len regex | ||
z.string().min(2).max(200).regex(/^[a-zA-Z\-]+$/gm, { | ||
message: 'Only English alphabet symbols and hyphen allowed', | ||
}) | ||
|
||
const a = { | ||
locales: z.record( | ||
localeKeySchema, | ||
z.string().min(2).regex(/^[a-zA-Z\-]+$/gm, { | ||
message: 'Only English alphabet symbols and hyphen allowed', | ||
}) | ||
), | ||
} |
87 changes: 87 additions & 0 deletions
87
...me_js_formatter/tests/specs/js/module/expression/member-chain/static_member_regex.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,87 @@ | ||
--- | ||
source: crates/biome_formatter_test/src/snapshot_builder.rs | ||
info: js/module/expression/member-chain/static_member-regex.js | ||
--- | ||
|
||
# Input | ||
|
||
```js | ||
// 5-len regex | ||
z.string().min(2).max(200).regex(/[a-z]/gm, { | ||
message: 'Only English alphabet symbols and hyphen allowed', | ||
}) | ||
|
||
// <5-len regex | ||
z.string().min(2).max(200).regex(/\w+/gm, { | ||
message: 'Only English alphabet symbols and hyphen allowed', | ||
}) | ||
|
||
|
||
// >5-len regex | ||
z.string().min(2).max(200).regex(/^[a-zA-Z\-]+$/gm, { | ||
message: 'Only English alphabet symbols and hyphen allowed', | ||
}) | ||
|
||
const a = { | ||
locales: z.record( | ||
localeKeySchema, | ||
z.string().min(2).regex(/^[a-zA-Z\-]+$/gm, { | ||
message: 'Only English alphabet symbols and hyphen allowed', | ||
}) | ||
), | ||
} | ||
|
||
``` | ||
|
||
|
||
============================= | ||
|
||
# Outputs | ||
|
||
## Output 1 | ||
|
||
----- | ||
Indent style: Tab | ||
Indent width: 2 | ||
Line width: 80 | ||
Quote style: Double Quotes | ||
JSX quote style: Double Quotes | ||
Quote properties: As needed | ||
Trailing comma: All | ||
Semicolons: Always | ||
Arrow parentheses: Always | ||
----- | ||
|
||
```js | ||
// 5-len regex | ||
z.string().min(2).max(200).regex(/[a-z]/gm, { | ||
message: "Only English alphabet symbols and hyphen allowed", | ||
}); | ||
|
||
// <5-len regex | ||
z.string().min(2).max(200).regex(/\w+/gm, { | ||
message: "Only English alphabet symbols and hyphen allowed", | ||
}); | ||
|
||
// >5-len regex | ||
z.string() | ||
.min(2) | ||
.max(200) | ||
.regex(/^[a-zA-Z\-]+$/gm, { | ||
message: "Only English alphabet symbols and hyphen allowed", | ||
}); | ||
|
||
const a = { | ||
locales: z.record( | ||
localeKeySchema, | ||
z | ||
.string() | ||
.min(2) | ||
.regex(/^[a-zA-Z\-]+$/gm, { | ||
message: "Only English alphabet symbols and hyphen allowed", | ||
}), | ||
), | ||
}; | ||
``` | ||
|
||
|
41 changes: 0 additions & 41 deletions
41
crates/biome_js_formatter/tests/specs/prettier/js/method-chain/issue-11298.js.snap
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.