-
-
Notifications
You must be signed in to change notification settings - Fork 541
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
π useSortedClasses lint error with Template literals #3394
Comments
Providing a fix for this use case will be extremely challenging, almost impossible. What's the expected and correct fix? |
Maybe
But οΌNow it break |
The rule does handle template literals, however there's a limitation of what the rule can do and that's one of them. |
Hello buddy, I think it is possible by dealing with JsTemplateExpression 1γExtract the template string content from JsTemplateExpression |
That's not what I'm talking about. Can the tailwind plugin fix your case? |
Test in prettier-plugin-tailwindcss It has special logic in sortTemplateLiteralοΌand https://github.com/tailwindlabs/prettier-plugin-tailwindcss/blob/main/src/index.ts#L538 |
@ematipico sorry but I can't understand if tailwind sorting of classes is enabled and handled out of the box when using Biome. I also tried moving Can you point me out to relevant documentation? I only found this https://biomejs.dev/linter/rules/use-sorted-classes/#important-notes. |
This rule has been flagged with an unsafe fix, hence it's only fixable via CLI using the You're free to change the severity of the fix. The lint rule page provides useful links at the bottom of the page. One of them is this one: https://biomejs.dev/linter/#configure-the-rule-fix I advise you to read more about how our linter works, it's different from ESLint |
@ematipico I managed to have the sort working, marking as "safe" and letting webstorm handling it on save as I had with eslint, grazie! As reference for others: {
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
"organizeImports": {
"enabled": true
},
"formatter": {
"indentStyle": "space",
"indentWidth": 2,
"lineWidth": 160,
"lineEnding": "lf"
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"a11y": {
"recommended": false
},
"suspicious": {
"recommended": false
},
"nursery": {
"useSortedClasses": {
"level": "error",
"fix": "safe",
"options": {
"attributes": ["className"],
"functions": ["cx"]
}
}
}
}
}
} |
Environment information
Playground link
https://biomejs.dev/playground/?bracketSameLine=true&lintRules=all&code=aQBtAHAAbwByAHQAIABSAGUAYQBjAHQAIABmAHIAbwBtACAAJwByAGUAYQBjAHQAJwA7AAoACgBjAG8AbgBzAHQAIABBAHAAcAAgAD0AIAAoACkAIAA9AD4AIAB7AAoAIAAgAGMAbwBuAHMAdAAgAGwAaQBzAHQAVAB5AHAAZQAgAD0AIAAnAHAAaQBjAHQAdQByAGUALQBjAGEAcgBkACcAOwAKACAAIAByAGUAdAB1AHIAbgAgADwAZABpAHYAIABjAGwAYQBzAHMATgBhAG0AZQA9AHsAYABtAC0AdwBlAGIAcwBlAHMAcwBpAG8AbgAtAHUAcABsAG8AYQBkAGwAaQBzAHQAIABmAGkAcwBoAGQALQB1AHAAbABvAGEAZAAtAGwAaQBzAHQALQAkAHsAbABpAHMAdABUAHkAcABlAH0AYAB9AD4AYQBwAHAAPAAvAGQAaQB2AD4AOwAKAH0AOwAKAAoAZQB4AHAAbwByAHQAIABkAGUAZgBhAHUAbAB0ACAAQQBwAHAAOwAKAA%3D%3D
Code of Conduct
The text was updated successfully, but these errors were encountered: