-
-
Notifications
You must be signed in to change notification settings - Fork 512
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(useSortedClasses): should suggest code fixes that match the JSX q…
…uote style of the formatter (#4857)
- Loading branch information
Showing
13 changed files
with
117 additions
and
1 deletion.
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
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
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
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
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
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
2 changes: 2 additions & 0 deletions
2
crates/biome_js_analyze/tests/specs/nursery/useSortedClasses/issue_4855.jsx
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,2 @@ | ||
<div class="content-[''] absolute">Hello</div>; | ||
<div class='top-0 absolute'>Hello</div>; |
52 changes: 52 additions & 0 deletions
52
crates/biome_js_analyze/tests/specs/nursery/useSortedClasses/issue_4855.jsx.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,52 @@ | ||
--- | ||
source: crates/biome_js_analyze/tests/spec_tests.rs | ||
expression: issue_4855.jsx | ||
snapshot_kind: text | ||
--- | ||
# Input | ||
```jsx | ||
<div class="content-[''] absolute">Hello</div>; | ||
<div class='top-0 absolute'>Hello</div>; | ||
|
||
``` | ||
|
||
# Diagnostics | ||
``` | ||
issue_4855.jsx:1:12 lint/nursery/useSortedClasses FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
! These CSS classes should be sorted. | ||
> 1 │ <div class="content-[''] absolute">Hello</div>; | ||
│ ^^^^^^^^^^^^^^^^^^^^^^^ | ||
2 │ <div class='top-0 absolute'>Hello</div>; | ||
3 │ | ||
i Unsafe fix: Sort the classes. | ||
1 │ - <div·class="content-['']·absolute">Hello</div>; | ||
1 │ + <div·class="absolute·content-['']">Hello</div>; | ||
2 2 │ <div class='top-0 absolute'>Hello</div>; | ||
3 3 │ | ||
``` | ||
|
||
``` | ||
issue_4855.jsx:2:12 lint/nursery/useSortedClasses FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
! These CSS classes should be sorted. | ||
1 │ <div class="content-[''] absolute">Hello</div>; | ||
> 2 │ <div class='top-0 absolute'>Hello</div>; | ||
│ ^^^^^^^^^^^^^^^^ | ||
3 │ | ||
i Unsafe fix: Sort the classes. | ||
1 1 │ <div class="content-[''] absolute">Hello</div>; | ||
2 │ - <div·class='top-0·absolute'>Hello</div>; | ||
2 │ + <div·class="absolute·top-0">Hello</div>; | ||
3 3 │ | ||
``` |
22 changes: 22 additions & 0 deletions
22
crates/biome_js_analyze/tests/specs/nursery/useSortedClasses/issue_4855.options.json
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 @@ | ||
{ | ||
"$schema": "../../../../../../packages/@biomejs/biome/configuration_schema.json", | ||
"javascript": { | ||
"formatter": { | ||
"quoteStyle": "single", | ||
"jsxQuoteStyle": "double" | ||
} | ||
}, | ||
"linter": { | ||
"rules": { | ||
"nursery": { | ||
"useSortedClasses": { | ||
"level": "error", | ||
"options": { | ||
"attributes": ["customClassAttribute"], | ||
"functions": ["clsx", "tw", "tw.*"] | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
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
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
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
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