Skip to content
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

release: 1.6.0 #1969

Merged
merged 39 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
195dd5e
release: 1.6.0
ematipico Mar 5, 2024
92391f7
update some documentation
ematipico Mar 5, 2024
1489b21
chore: first draft of the blog post
ematipico Mar 6, 2024
d442905
one more chapter
ematipico Mar 6, 2024
a52a484
Apply suggestions from code review
ematipico Mar 6, 2024
aefd29d
feat: promote rule (#1978)
Conaclos Mar 6, 2024
3cb83bf
Merge branch 'main' into relase/1.6.0
Conaclos Mar 6, 2024
4a3c7f6
trailingCommas with S, and codegen
ematipico Mar 6, 2024
5d1a2c8
fix: avoid source overriding of useConsistentArrayType
Conaclos Mar 6, 2024
2573386
apply changes and fix changed check
ematipico Mar 6, 2024
a49f6ba
fix incorrect order in changelog example
ematipico Mar 6, 2024
e6c7606
refactor(lint/noUnusedVariables): don't report unused imports
Conaclos Mar 6, 2024
486dad2
Merge remote-tracking branch 'refs/remotes/origin/relase/1.6.0' into …
Conaclos Mar 6, 2024
0f291d8
refactor: remove useGroupedTypeImports
Conaclos Mar 6, 2024
b4dec0e
chore: update crates
ematipico Mar 7, 2024
49035c0
chore: fix changelog
ematipico Mar 7, 2024
57af3b8
Merge remote-tracking branch 'origin/main' into relase/1.6.0
ematipico Mar 7, 2024
61144f3
better explanation
ematipico Mar 7, 2024
c942068
fix diagnostics for `useJsxKeyInIterable`
ematipico Mar 7, 2024
a69cdf2
refacor: remove future dead links
Conaclos Mar 7, 2024
9cd09a0
refactor(lint): set version of new rules
Conaclos Mar 7, 2024
3893b1d
Update website/src/content/blog/biome-v1-6.mdx
ematipico Mar 7, 2024
7572772
apply suggestion
ematipico Mar 7, 2024
054c0fa
add warning
ematipico Mar 7, 2024
b5b7077
refactor: move useAwait in suspicious and set as not recommended
Conaclos Mar 7, 2024
dc31ee7
Merge branch 'relase/1.6.0' of github.com:biomejs/biome into relase/1…
Conaclos Mar 7, 2024
b081455
Update CHANGELOG.md
Conaclos Mar 7, 2024
6832bad
Update website/src/content/blog/biome-v1-6.mdx
Conaclos Mar 7, 2024
4206878
Update website/src/content/docs/internals/language-support.mdx
Conaclos Mar 7, 2024
5f8b156
Update website/src/content/docs/internals/language-support.mdx
Conaclos Mar 7, 2024
7024c4a
Update website/src/content/docs/guides/getting-started.mdx
Conaclos Mar 7, 2024
3b4f49d
Update website/src/content/docs/guides/getting-started.mdx
Conaclos Mar 7, 2024
daf339b
Update website/src/content/blog/biome-v1-6.mdx
Conaclos Mar 7, 2024
2d0b90e
chore: update changelog
Conaclos Mar 7, 2024
ac991ec
Merge branch 'main' into relase/1.6.0
Conaclos Mar 8, 2024
6fdfdf5
fix: remove warning
Conaclos Mar 8, 2024
1738773
fix: update 1.6.0 config schema
Conaclos Mar 8, 2024
95f1a82
chore(blog): add new rules section
Conaclos Mar 8, 2024
962087a
chore: update number of rules
ematipico Mar 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/01_formatter_bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ body:
id: environment
attributes:
label: Environment information
description: Run the command `biome rage` and paste its output here. Please review it, in case there are sensitive information you don't want to share.
description: Run the command `biome rage --formatter` and paste its output here. Please review it, in case there are sensitive information you don't want to share.
render: bash
validations:
required: true
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/02_lint_bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ body:
id: environment
attributes:
label: Environment information
description: Run the command `biome rage` and paste its output here. Please review it, in case there are sensitive information you don't want to share.
description: Run the command `biome rage --linter` and paste its output here. Please review it, in case there are sensitive information you don't want to share.
render: bash
validations:
required: true
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ New entries must be placed in a section entitled `Unreleased`.
Read
our [guidelines for writing a good changelog entry](https://github.com/biomejs/biome/blob/main/CONTRIBUTING.md#changelog).

## Unreleased
## 1.6.0 (TBD)

### Analyzer

Expand Down
2 changes: 1 addition & 1 deletion crates/biome_service/src/file_handlers/vue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl VueFileHandler {

/// Returns the start byte offset of the Vue `<script>` tag
pub fn start(input: &str) -> Option<u32> {
Self::matches_script(input).map(|m| m.start() as u32 - 1)
Self::matches_script(input).map(|m| m.start() as u32)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes an issue in the LSP when showing diagnostics. Spans were incorrect

}

fn matches_script(input: &str) -> Option<Match> {
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
"private": true,
"version": "0.0.0",
"scripts": {
"check:apply": "cargo biome-cli-dev check --apply-unsafe editors website packages/@biomejs/js-api packages/tailwindcss-config-analyzer",
"check": "cargo biome-cli-dev check editors website packages/@biomejs/js-api packages/tailwindcss-config-analyzer",
"ci": "cargo biome-cli-dev ci editors website packages/@biomejs/js-api packages/tailwindcss-config-analyzer"
"check:apply": "cargo biome-cli-dev check --apply-unsafe website packages/@biomejs/js-api packages/tailwindcss-config-analyzer",
"check": "cargo biome-cli-dev check website packages/@biomejs/js-api packages/tailwindcss-config-analyzer",
"ci": "cargo biome-cli-dev ci website packages/@biomejs/js-api packages/tailwindcss-config-analyzer"
},
"keywords": [],
"author": "",
Expand Down
2 changes: 1 addition & 1 deletion packages/@biomejs/biome/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@biomejs/biome",
"version": "1.5.3",
"version": "1.6.0",
"bin": "bin/biome",
"scripts": {
"postinstall": "node scripts/postinstall.js"
Expand Down
1 change: 0 additions & 1 deletion website/astro.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ export default defineConfig({
{
label: "Git Hooks",
link: "/recipes/git-hooks",
badge: "New",
},
],
},
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion website/src/components/BlogPostInfo.astro
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const authors = await getAuthorsData(
{
authors.map(({ data: author }) => (
<span class="avatar">
<Image src={author.avatar} alt="" height="36" width="36" />
<Image src={author.avatar} alt="" height="36" width="36" loading="eager" />
</span>
))
}
Expand Down
2 changes: 1 addition & 1 deletion website/src/content/blog/biome-v1-5.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pubDate: 2024-01-08
coverImage:
lightSrc: "@/assets/blog/roadmap-2024/banner-light.png"
darkSrc: "@/assets/blog/roadmap-2024/banner-dark.png"
alt: The Prettier challenge banner, with the Biome logo over it
alt: The brand of the project. It says "Biome, toolchain of the web"
socialImage: "@/assets/social-logo.png"
---

Expand Down
228 changes: 228 additions & 0 deletions website/src/content/blog/biome-v1-6.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,228 @@
---
title: Biome v1.6
description: Partial support for Astro, Svelte and Vue, extend configuration from dependencies, formatter goodies.
summary: |
Partial support for Astro, Svelte and Vue files, both CLI and LSP.
Now, the `extends` field is able to pick configuration files that are exported as a dependency, very useful in monorepo and big projects.
ematipico marked this conversation as resolved.
Show resolved Hide resolved
The formatter has new options.
authors:
- ema
- team
pubDate: 2024-03-08
coverImage:
lightSrc: "@/assets/blog/roadmap-2024/banner-light.png"
darkSrc: "@/assets/blog/roadmap-2024/banner-dark.png"
alt: The brand of the project. It says "Biome, toolchain of the web"
socialImage: "@/assets/social-logo.png"
---

import { Tabs, TabItem } from '@astrojs/starlight/components';
import { Image } from "astro:assets";
import astroLint from "../../assets/blog/biome-v1-6/astro-linter.png"
import vueLint from "../../assets/blog/biome-v1-6/vue-linter.png"
import svelteLint from "../../assets/blog/biome-v1-6/svelte-linter.png"

Update Biome using the following commands:

```shell
npm install --save-dev --save-exact @biomejs/biome@latest
npx @biomejs/biome migrate
```

## Partial support for Astro, Svelte and Vue files

In this release, we're happy to provide partial support for Astor, Svelte and Vue files. What does **partial** support mean?
ematipico marked this conversation as resolved.
Show resolved Hide resolved

While the team is working on a [unified data structure](https://github.com/biomejs/biome/discussions/1726) for HTML-ish languages, we discovered that we could provide Biome functionalities to those files with just few changes, albeit some expectations.
ematipico marked this conversation as resolved.
Show resolved Hide resolved

This means that Biome is able to analyse the JavaScript/TypeScript portion of said files, and all features are available: formatting, linting and import sorting! Here's an example that you should expect in terms of developer experience:
ematipico marked this conversation as resolved.
Show resolved Hide resolved

<Tabs>
<TabItem label="Astro" icon="astro">
<div align="center">
<Image src={astroLint} alt="Screenshot of Biome linting in action for an Astro file in VSCode" width="500" />
</div>
</TabItem>
<TabItem label="Vue" icon="seti:vue">
<div align="center">
<Image src={vueLint} alt="Screenshot of Biome linting in action for an Vue file in VSCode" width="500" />
</div>
</TabItem>
<TabItem label="Svelte" icon="seti:svelte">
<div align="center">
<Image src={svelteLint} alt="Screenshot of Biome linting in action for an Svelte file in VSCode" width="500" />
</div>
</TabItem>
</Tabs>

Make sure to read the [documentation about expectations and limitations](/internals/language-support#html-super-languages-support).

## Configuration, lighter and more powerful

### Support for `biome.jsonc`

Biome now accepts the file `biome.jsonc` as configuration! Now, you can insert all the comments you want in a configuration.
Conaclos marked this conversation as resolved.
Show resolved Hide resolved

### `extends` resolves dependencies

From this version, Biome can the `extends` property can *resolve* other configuration files that are installed and exported as a dependency.
ematipico marked this conversation as resolved.
Show resolved Hide resolved

There are few important steps in order to make the configuration discoverable. The file must be exported from a `"module"` package, and the file should be exported in your `package.json` like this:

```json name="shared-configs/package.json"
{
"name": "@shared-configs",
"type": "module",
"exports": {
"./biome": "./biome.json"
}
}
```

This set up allows to expose a specifier `@shared-configs/biome`, which you use inside your `biome.json` file.

```json name="project/biome.json"
{
"extends": ["@shared-configs/biome"]
}
```

The resolution of the dependencies is powered by the library [`oxc-resolver`](https://github.com/oxc-project/oxc-resolver), one of the many libraries provided by the [OXC project](https://oxc-project.github.io/). It's battle-tested and spec compliant!

:::note
You can also export `biome.jsonc` files!

```json name="shared-configs/package.json" ins="./biome.jsonc"
{
"name": "@shared-configs",
"type": "module",
"exports": {
"./biome": "./biome.jsonc"
}
}
```
:::

### Reduced memory footprint

We **reduced** the size our configuration **by a factor of 6.5**! This change might not have massive effects on the speed of the program, but it greatly reduced the memory used when running the CLI or the LSP.

## New formatting options

Other than fixes, the formatter provides two new options that should improve the compatibility with Prettier parity
ematipico marked this conversation as resolved.
Show resolved Hide resolved

### Option `attributePosition`

The contributor [@octoshikari](https://github.com/octoshikari) implemented this new feature by themselves! Huge thank you for helping the Biome project.
ematipico marked this conversation as resolved.
Show resolved Hide resolved

When `formatter.attributePosition` has the value `multiline`, all attributes of HTML-ish languages (JSX/TSX as for time of writing) will be collapsed on multiple lines regardless of their numbers:


<div class="card">
<div class="card-column">
<h4>With variant `auto` (default)</h4>
The attributes are automatically formatted, and they will collapse in multiple lines only when they hit certain criteria.

```jsx title="file.jsx"
<Button as="link" style="primary" href="https://example.com">
Hit me
</Button>
```
</div>
<div class="card-column">
<h4>With variant `multiline`</h4>
The attributes are always formatted on multiple lines, regardless.

```jsx title="file.jsx"
<Button
as="link"
style="primary"
href="https://example.com"
>
Hit me
</Button>
```
</div>
</div>


### Option `json.formatter.trailingComma`
ematipico marked this conversation as resolved.
Show resolved Hide resolved

Previously, Biome parser introduced an option that would allow to parse JSON and JSONC files that contained a trailing comma. This was required to ease the friction caused by other tools that
tolerate trailing commas by default (e.g. VSCode, Prettier, etc.).

Although, our formatter wasn't as tolerant. With the option `json.formatter.trailingComma`, you can apply the same rules that `js.formatter.trailingComma` applies.
ematipico marked this conversation as resolved.
Show resolved Hide resolved

<div class="card">
<div class="card-column">
<h4>With variant `none` (default)</h4>
The formatter removes the trailing comma upon formatting.

```json title="file.json" ins="\"ipsum_last\""
{
"lorem": "ipsum",
"lorem": "ipsum",
"lorem": "ipsum",
"lorem": "ipsum_last"
}
```
</div>
<div class="card-column">
<h4>With variant `all`</h4>
The formatter adds the trailing comma upon formatting.

```json title="file.json" ins="\"ipsum_last\","
{
"lorem": "ipsum",
"lorem": "ipsum",
"lorem": "ipsum",
"lorem": "ipsum_last",
}
```
</div>
</div>

## Easier migration from Prettier

This release introduces a new command called `biome migrate prettier`. This command will read your Prettier `.prettierrc`/`prettier.json` and `.prettierignore`, and attempt to port its options and globs in Biome.

Given a `prettier.json` file, Biome will **modify** the existing configuration file to match Prettier's options:

```json title="prettier.json"
{ "useTabs": false, "semi": true, "singleQuote": true }
```

```json title="biome.json"
{
"formatter": {
"enabled": true,
"formatWithErrors": false,
"indentStyle": "space",
"indentWidth": 2,
"lineEnding": "lf",
"lineWidth": 80,
"attributePosition": "auto"
},
"linter": { "enabled": true },
"javascript": {
"formatter": {
"jsxQuoteStyle": "double",
"quoteProperties": "asNeeded",
"trailingComma": "all",
"semicolons": "always",
"arrowParentheses": "always",
"bracketSpacing": true,
"bracketSameLine": false,
"quoteStyle": "single",
"attributePosition": "auto"
}
}
}
```

:::caution
Due to the different nature of `.prettierignore` globs and Biome’s globs, it’s **highly advised** to make sure that those globs still work under Biome.
Prettier's globs are **git globs**, while Biome's globs are **unix-style** globs.
:::

###
21 changes: 20 additions & 1 deletion website/src/content/docs/guides/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,28 @@ After running the `init` command, you'll now have a new `biome.json` file in you
}
```

Alternatively, you can run `biome init --jsonc` , and emit a `biome.jsonc` file:
Conaclos marked this conversation as resolved.
Show resolved Hide resolved

<PackageManagerBiomeCommand command="init --jsonc" />

```json title="biome.jsonc"
{
"$schema": "https://biomejs.dev/schemas/1.5.3/schema.json",
"organizeImports": {
"enabled": false
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
}
}
```

The `linter.enabled: true` enables the linter and `rules.recommended: true` enables the [recommended rules](/linter/rules/).

Formatting is enabled because the configuration doesn't explicitly [disable](/reference/configuration/#formatterenabled) formatting with `formatter.enabled: false`.
Formatting is enabled **by default**, because the configuration doesn't explicitly [disable](/reference/configuration/#formatterenabled) formatting with `formatter.enabled: false`.
Conaclos marked this conversation as resolved.
Show resolved Hide resolved

## Usage

Expand Down
3 changes: 2 additions & 1 deletion website/src/content/docs/guides/how-biome-works.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,10 @@ From version `v1.6.0`, Biome is able to resolve configuration files from `node_m

In order to do so, the first thing to do is to set up your "shared" Biome configuration in a certain way. Let's suppose that your library is called `@org/shared-configs`, and you want to import the Biome configuration using the specifier `@org/shared-configs/biome`. You have to set up the `package.json` is a specific way:

```json title="package.json" ins={4}
```json title="package.json" ins={5,3}
{
"name": "@org/shared-configs",
"type": "module",
"exports": {
"./biome": "./biome.json"
}
Expand Down
2 changes: 1 addition & 1 deletion website/src/content/docs/internals/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ New entries must be placed in a section entitled `Unreleased`.
Read
our [guidelines for writing a good changelog entry](https://github.com/biomejs/biome/blob/main/CONTRIBUTING.md#changelog).

## Unreleased
## 1.6.0 (TBD)

### Analyzer

Expand Down
Loading
Loading