Comments (5)
It looks like a good temporary workaround is
"overrides": [
{
"include": ["**/package.json"],
"formatter": {
"lineWidth": 1
}
}
]
thanks for pointing me in the right direction!
from biome.
@wojtekmaj Unfortunately, the playground isn't sufficient for reproduction. Can you please give us more information about the issue and how can we reproduce it, maybe with a repository?
from biome.
Sorry, there was no place for that in the template, I'm working on an actual issue description.
from biome.
Sorry, the issue I'm seeing has a different cause than I initially presumed. I thought I'm seeing the opposite errors on macOS and Linux, but that's not the case. Here's full explanation.
I migrated from Prettier to Biome for formatting. Immediately, I was met with the following error:
./package.json format โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Formatter would have printed the following content:
4 4 โ "access": "public"
5 5 โ },
6 โ - ยทยท"files":ยท[
7 โ - ยทยทยทยท"dist",
8 โ - ยทยทยทยท"src"
9 โ - ยทยท],
6 โ + ยทยท"files":ยท["dist",ยท"src"],
10 7 โ "repository": {
11 8 โ "type": "git",
Checked 32 files in 11ms. No fixes needed.
Found 1 error.
format โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Some errors were emitted while running checks.
Of course, running biome format . --write
fixed the issue.
However, other tools in my toolchain attempt to format JSON in a Prettier-compatible way. Notably, running Yarn (4.1.1), reformats the package.json
back so that files
is split into multiple lines.
Since CI is basically yarn install
+ biome format
, this causes the latter to fail.
I would still consider it a formatting bug in Biome. Here's why I believe so:
- Quoting documentation, "The formatting style of Biome is also considered relatively stable, continuing to match Prettier as much as possible". This is a difference between the two, and one not listed on Differences with Prettier page.
- These particular arrays found in
package.json
(workspaces
,files
) are FAR more readable when split into multiple lines. - While technically correct, this discrepancy causes incompatibilities with other tools as described above.
from biome.
That's expected. Prettier formats package.json
files using JSON.stringify(content, null, 2)
, which package managers usually do.
Biome, instead, uses the classic heuristic, that's why you see all these changes. I am considering creating an option for making the formatting similar to Prettie, however it will take a bit to create it.
For the time being, you can use overrides
to ignore package.json
files from being formatted with Biome.
from biome.
Related Issues (20)
- ๐ Lint Rule `noUselessUndefinedInitialization` - autofixing behaviour on inline comments
- ๐ `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
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.