Comments (5)
I'd like to give this a shot.
from biome.
from biome.
I've been combing over the code for a while now, and I think I understand what's going on. Mostly notes for myself:
The variable declaration group is higher up in the IR tree than the type annotation group. When the tree gets flattened into FormatElement
s, the variable declaration group gets evaluated first to see if it breaks (and since it's long enough, it breaks). Then the type annotation group gets evaluated, and its not long enough, so it doesn't break. This evaluation happens here:
biome/crates/biome_formatter/src/printer/mod.rs
Lines 184 to 188 in 01c440d
I think one way to fix this is to introduce some kind of "break priority" field to the Group
struct, and then favor breaking type annotations, but I think that could introduce some complexity.
from biome.
I think one way to fix this is to introduce some kind of "break priority" field to the Group struct, and then favor breaking type annotations, but I think that could introduce some complexity.
It seems that this approach assumes the current generated IR is accurate. Perhaps we could compare the IR generated by Biome
and Prettier
to identify differences between them and address these disparities to see if the issue is resolved.
from biome.
Ok yeah, I was looking at the IR before and it looked identical, but I'm looking at it again and it is definitely not. Biome is emitting an extra group
around the left hand side of the assignment.
from biome.
Related Issues (20)
- 💅 `noUnusedImports` is not aware of `@jsx` and `@jsxFrag` pragmas HOT 1
- 📎 React Compiler rules HOT 1
- 📎 Make code fix kind configurable
- 🐛 Biomejs server crashes in a specific scenario HOT 3
- 📎 Add css modules support
- 💅 Biome is adding a comma in the last line inside ReactDOM.createRoot.render method in main.tsx file when executing npx biome check --apply ./src HOT 3
- 📎 Implement `typescript/only-throw-error`
- 📎 Implement `eslint/max-params` `clippy/too_many_arguments` HOT 3
- 📎 Implement `useDateNow` - `unicorn/prefer-date-now`
- 📝 disabling formatter doesn't work HOT 9
- lint/correctness/noUndeclaredVariables should ignore TsGlobalDeclaration HOT 4
- Eslint Migration - Nextjs HOT 6
- lint/style/noNonNullAssertion should report on unnecessary non-null assertions HOT 2
- 📎 Improve `useAdjacentOverloadSIgnatures` implementation HOT 1
- False positive in `noUndeclaredVariables`
- 💅 useExhaustiveDependencies ignores duplicate dependencies
- 📎 Implement a fix for `noUselessCatch`
- 🐛 https://biomejs.dev/ is not accessible HOT 5
- 🐛 `biome-ignore` comments are detached by the formatter HOT 2
- 💅 lint/correctness/noConstantCondition does not consider enums when apply the rule HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from biome.