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

feat(format/html): add multiline for multi attributes #4972

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
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
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ cargo install just

But we **highly recommend** to [install it using an OS package manager](https://github.com/casey/just#packages), so you won't need to prefix every command with `cargo`.

Once installed, run the following command install the required tools:
Once installed, run the following command to install the required tools:

```shell
just install-tools
Expand All @@ -104,7 +104,7 @@ And you're good to go hack with Biome and Rust! 🚀

You can either use `cargo` or `just` to run tests. For simplicity and running tests real quick, use `cargo`.

With `cargo`, you can run tests with using the `test` command:
With `cargo`, you can run tests by using the `test` command:

```shell
# run tests
Expand All @@ -131,7 +131,7 @@ cd crates/biome_js_formatter
cargo t quick_test
```

This will run the `quick_test` test inside he `biome_js_formatter` crate. You should see an output similar to this:
This will run the `quick_test` test inside the `biome_js_formatter` crate. You should see an output similar to this:

```shell
running 1 test
Expand Down
61 changes: 46 additions & 15 deletions GOVERNANCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,34 @@ This document outlines the governance model for Biome.

It describes various parts of how the project is managed as well as accepted practices for day-to-day operation:

- [Contributor Model](#contributor-model)
- [Project Direction](#project-direction)
- [Code Review](#code-review)
- [Financial Contributions](#financial-contributions)
- [Moderation](#moderation)
* [Contributor Model](#contributor-model)
+ [Lead](#lead)
- [Lead nomination](#lead-nomination)
+ [Core Contributor](#core-contributor)
- [Core contributor nomination](#core-contributor-nomination)
+ [Maintainer](#maintainer)
- [Maintainer nomination](#maintainer-nomination)
+ [Voting Rules](#voting-rules)
+ [Ownership](#ownership)
+ [Inactivity](#inactivity)
+ [Contributions](#contributions)
+ [Governance changes](#governance-changes)
* [Project Direction](#project-direction)
+ [Roadmap](#roadmap)
* [Code review](#code-review)
* [Financial Contributions](#financial-contributions)
+ [Sponsorship](#sponsorship)
+ [Community-Funded Bounties](#community-funded-bounties)
+ [Project-Funded Bounties](#project-funded-bounties)
+ [Paid Contracting](#paid-contracting)
+ [Fund Allocation](#fund-allocation)
- [Expenses](#expenses)
* [Moderation](#moderation)
+ [Reporting](#reporting)
+ [Who gets involved?](#who-gets-involved)
+ [Review](#review)
+ [Resolution](#resolution)


## Contributor Model

Expand All @@ -21,16 +44,18 @@ Leads are the owners of the organisation.
Leads have additional privileges over core contributors. Leads control and maintain sensitive project assets and act as tiebreakers in the event of disagreements. In case of disagreements, only **one** lead must be involved in the resolution.

These assets and responsibilities are but are not limited to:
- Access to social accounts
- Administration privileges of the [Biome Discord server][discord]
- Administration privileges of the [Biome GitHub org][gh-org]
- Website accesses (hosting platform, domain name, etc.)
- Access to sensitive emails, such as the CoC email
- Access to social accounts.
- Administration privileges of the [Biome Discord server][discord].
- Administration privileges of the [Biome GitHub org][gh-org].
- Website credentials (hosting platform, domain name, etc.).
- Access to sensitive emails, such as the CoC email.

Also:
- Ability to vote for new leads
- Onboard new [core contributors](#core-contributor) and new leads;
- Takes part in [project decisions](#project-direction-and-planning)
- Ability to vote for new leads.
- Onboard new [core contributors](#core-contributor) and new leads.
- Takes part in [project decisions](#project-direction-and-planning).
- Access to the Discord `Lead` category and channels that belong to this category.
- Propose changes to the governance document via PR.

The ownership of assets is only sometimes evenly distributed among all the leads.

Expand Down Expand Up @@ -58,6 +83,8 @@ Core Contributors are outstanding [maintainers](#maintainer), are ambassadors of
- Ability to [vote](#maintainer-nomination) on new maintainers and [vote](#core-contributor-nomination) on new core contributors
- Onboard new [maintainers](#maintainer)
- Assign [pledges to issues](#bounties).
- Access to the Discord `Core contributors` category and channels that belong to this category.
- Propose changes to the governance document via PR.

#### Core contributor nomination

Expand Down Expand Up @@ -93,7 +120,7 @@ Maintainers are those with a history of consistent contributions, including but
- `Maintainer` status on the [Biome Discord server][discord]
- Ability to [vote](#voting) on project decisions
- Ability to [vote](#maintainer-nomination) on new maintainers

- Access to the Discord `Maintainers` category and channels that belong to this category.
#### Maintainer nomination

Maintainers may either be nominated by another [maintainer](#maintainer), [Core contributor](#core-contributor), [lead](#lead).
Expand Down Expand Up @@ -148,6 +175,10 @@ Contributions to the project aren't only limited to code. Contributions come in
- Support in secondary channels, e.g. StackOverflow, etc.
- Website;

### Governance changes

Changes to the governance document must be approved by at least fifty percent of the Core Contributors and a majority of the Leads.

## Project Direction

Project direction and planning is a shared responsibility amongst members. Core contributors are responsible for dictating high-level goals and the project scope that should be adhered to.
Expand Down Expand Up @@ -247,7 +278,7 @@ conditions:
or indirectly benefits the roadmap, a customized fee may be negotiated.
- If the last-published roadmap is more than 12 months old, the Core Contributor is asked to
consult with the Core team about alignment with the project goals.
- Fee negotiation may happen either publically in the `Community > #funding` channel, or privately
- Fee negotiation may happen either publicly in the `Community > #funding` channel, or privately
in the `Core > #core-team` channel.
- Custom fees require the approval of at least one Lead.
- The work may not conflict with the project direction or
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_analyze/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ See the [code generation section](#code-generation) for more details.

To create a new rule, you have to create and update several files.
Because it is a bit tedious, _Biome_ provides an easy way to create and test your rule using [Just](https://just.systems/man/en/).
_Just_ is not part of the rust toolchain, you have to install it with [a package manager](https://just.systems/man/en/chapter_4.html).
_Just_ is not part of the rust toolchain, you have to install it with [a package manager](https://just.systems/man/en/packages.html).

### Guidelines

Expand Down
3 changes: 2 additions & 1 deletion crates/biome_html_formatter/src/html/lists/attribute_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ pub(crate) struct FormatHtmlAttributeList;
impl FormatRule<HtmlAttributeList> for FormatHtmlAttributeList {
type Context = HtmlFormatContext;
fn fmt(&self, node: &HtmlAttributeList, f: &mut HtmlFormatter) -> FormatResult<()> {
let line_break = if f.options().attribute_position() == AttributePosition::Multiline {
let attribute_len = node.iter().len();
let line_break = if f.options().attribute_position() == AttributePosition::Multiline && attribute_len > 1 {
hard_line_break()
} else {
soft_line_break_or_space()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<div foo="bar" disabled id="foo"></div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
source: crates/biome_formatter_test/src/snapshot_builder.rs
assertion_line: 212
info: attributes/multiline/break.html
---
# Input

```html
<div foo="bar" disabled id="foo"></div>

```


=============================

# Outputs

## Output 1

-----
Indent style: Tab
Indent width: 2
Line ending: LF
Line width: 80
Attribute Position: Auto
-----

```html
<div foo="bar" disabled id="foo"></div>
```

## Output 1

-----
Indent style: Tab
Indent width: 2
Line ending: LF
Line width: 80
Attribute Position: Multiline
-----

```html
<div
foo="bar"
disabled
id="foo"
></div>
```
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<div foo="bar"></div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
source: crates/biome_formatter_test/src/snapshot_builder.rs
assertion_line: 212
info: attributes/multiline/no-break.html
---
# Input

```html
<div foo="bar"></div>

```


=============================

# Outputs

## Output 1

-----
Indent style: Tab
Indent width: 2
Line ending: LF
Line width: 80
Attribute Position: Auto
-----

```html
<div foo="bar"></div>
```

## Output 1

-----
Indent style: Tab
Indent width: 2
Line ending: LF
Line width: 80
Attribute Position: Multiline
-----

```html
<div foo="bar"></div>
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "/Users/user/rust/biome/packages/@biomejs/biome/configuration_schema.json",
"formatter": {
"attributePosition": "multiline"
}
}
12 changes: 10 additions & 2 deletions crates/biome_service/src/file_handlers/html.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use biome_analyze::{AnalyzerConfiguration, AnalyzerOptions};
use biome_formatter::{IndentStyle, IndentWidth, LineEnding, LineWidth, Printed};
use biome_formatter::{IndentStyle, IndentWidth, LineEnding, LineWidth, AttributePosition, Printed};
use biome_fs::BiomePath;
use biome_html_formatter::{format_node, HtmlFormatOptions};
use biome_html_parser::parse_html_with_cache;
Expand All @@ -25,6 +25,7 @@ pub struct HtmlFormatterSettings {
pub line_width: Option<LineWidth>,
pub indent_width: Option<IndentWidth>,
pub indent_style: Option<IndentStyle>,
pub attribute_position: Option<AttributePosition>,
pub enabled: Option<bool>,
}

Expand All @@ -36,6 +37,7 @@ impl Default for HtmlFormatterSettings {
indent_width: Default::default(),
line_ending: Default::default(),
line_width: Default::default(),
attribute_position: Default::default(),
}
}
}
Expand Down Expand Up @@ -79,11 +81,17 @@ impl ServiceLanguage for HtmlLanguage {
.or(global.and_then(|g| g.line_ending))
.unwrap_or_default();

let attribute_position = language
.and_then(|l| l.attribute_position)
.or(global.and_then(|g| g.attribute_position))
.unwrap_or_default();

let options = HtmlFormatOptions::new(file_source.to_html_file_source().unwrap_or_default())
.with_indent_style(indent_style)
.with_indent_width(indent_width)
.with_line_width(line_width)
.with_line_ending(line_ending);
.with_line_ending(line_ending)
.with_attribute_position(attribute_position);
if let Some(overrides) = overrides {
overrides.to_override_html_format_options(path, options)
} else {
Expand Down
3 changes: 3 additions & 0 deletions packages/@biomejs/biome/README.fr.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ Nous utilisons [Polar.sh](https://polar.sh/biomejs) pour voter pour des fonction
<td align="center" valign="middle">
<a href="https://www.phoenixlabs.dev/?utm_source=biome&utm_medium=readme" target="_blank"><img src="https://images.opencollective.com/phoenix-labs/2824ed4/logo/100.png?height=100" height="100"></a>
</td>
<td align="center" valign="middle">
<a href="https://lokalise.com/?utm_source=biome&utm_medium=readme" target="_blank"><img src="https://avatars.githubusercontent.com/u/14294501?s=200&v=4" height="100"></a>
</td>
</tr>
</tbody>
</table>
Expand Down
3 changes: 3 additions & 0 deletions packages/@biomejs/biome/README.hi.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ Biome एक सरल प्रायोजन[^37] कार्यक्रम
<td align="center" valign="middle">
<a href="https://www.phoenixlabs.dev/?utm_source=biome&utm_medium=readme" target="_blank"><img src="https://images.opencollective.com/phoenix-labs/2824ed4/logo/100.png?height=100" height="100"></a>
</td>
<td align="center" valign="middle">
<a href="https://lokalise.com/?utm_source=biome&utm_medium=readme" target="_blank"><img src="https://avatars.githubusercontent.com/u/14294501?s=200&v=4" height="100"></a>
</td>
</tr>
</tbody>
</table>
Expand Down
3 changes: 3 additions & 0 deletions packages/@biomejs/biome/README.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ Biome についてもっと知るために[ホームページ][biomejs]をチェ
<td align="center" valign="middle">
<a href="https://www.phoenixlabs.dev/?utm_source=biome&utm_medium=readme" target="_blank"><img src="https://images.opencollective.com/phoenix-labs/2824ed4/logo/100.png?height=100" height="100"></a>
</td>
<td align="center" valign="middle">
<a href="https://lokalise.com/?utm_source=biome&utm_medium=readme" target="_blank"><img src="https://avatars.githubusercontent.com/u/14294501?s=200&v=4" height="100"></a>
</td>
</tr>
</tbody>
</table>
Expand Down
3 changes: 3 additions & 0 deletions packages/@biomejs/biome/README.kr.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ Biome은 기업이 다양한 개발자들 사이에서 인지도를 얻을 수
<td align="center" valign="middle">
<a href="https://www.phoenixlabs.dev/?utm_source=biome&utm_medium=readme" target="_blank"><img src="https://images.opencollective.com/phoenix-labs/2824ed4/logo/100.png?height=100" height="100"></a>
</td>
<td align="center" valign="middle">
<a href="https://lokalise.com/?utm_source=biome&utm_medium=readme" target="_blank"><img src="https://avatars.githubusercontent.com/u/14294501?s=200&v=4" height="100"></a>
</td>
</tr>
</tbody>
</table>
Expand Down
7 changes: 7 additions & 0 deletions packages/@biomejs/biome/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
> [!IMPORTANT]
> All new developments, fixes and features should be directed towards the `next` branch.
> The `main` is only used for maintenance and CI while the team prepares everything for v2.

<div align="center">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/biomejs/resources/main/svg/slogan-dark-transparent.svg">
Expand Down Expand Up @@ -137,6 +141,9 @@ We use [Polar.sh](https://polar.sh/biomejs) to up-vote and promote specific feat
<td align="center" valign="middle">
<a href="https://www.phoenixlabs.dev/?utm_source=biome&utm_medium=readme" target="_blank"><img src="https://images.opencollective.com/phoenix-labs/2824ed4/logo/100.png?height=100" height="100"></a>
</td>
<td align="center" valign="middle">
<a href="https://lokalise.com/?utm_source=biome&utm_medium=readme" target="_blank"><img src="https://avatars.githubusercontent.com/u/14294501?s=200&v=4" height="100"></a>
</td>
</tr>
</tbody>
</table>
Expand Down
3 changes: 3 additions & 0 deletions packages/@biomejs/biome/README.pt-BR.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ Leia mais sobre nossa [filosofia de projeto][biome-philosophy].
<td align="center" valign="middle">
<a href="https://www.phoenixlabs.dev/?utm_source=biome&utm_medium=readme" target="_blank"><img src="https://images.opencollective.com/phoenix-labs/2824ed4/logo/100.png?height=100" height="100"></a>
</td>
<td align="center" valign="middle">
<a href="https://lokalise.com/?utm_source=biome&utm_medium=readme" target="_blank"><img src="https://avatars.githubusercontent.com/u/14294501?s=200&v=4" height="100"></a>
</td>
</tr>
</tbody>
</table>
Expand Down
3 changes: 3 additions & 0 deletions packages/@biomejs/biome/README.ru.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ Biome предлагает простую спонсорскую програм
<td align="center" valign="middle">
<a href="https://www.phoenixlabs.dev/?utm_source=biome&utm_medium=readme" target="_blank"><img src="https://images.opencollective.com/phoenix-labs/2824ed4/logo/100.png?height=100" height="100"></a>
</td>
<td align="center" valign="middle">
<a href="https://lokalise.com/?utm_source=biome&utm_medium=readme" target="_blank"><img src="https://avatars.githubusercontent.com/u/14294501?s=200&v=4" height="100"></a>
</td>
</tr>
</tbody>
</table>
Expand Down
3 changes: 3 additions & 0 deletions packages/@biomejs/biome/README.uk.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ Biome пропонує просту програму спонсорства, я
<td align="center" valign="middle">
<a href="https://www.phoenixlabs.dev/?utm_source=biome&utm_medium=readme" target="_blank"><img src="https://images.opencollective.com/phoenix-labs/2824ed4/logo/100.png?height=100" height="100"></a>
</td>
<td align="center" valign="middle">
<a href="https://lokalise.com/?utm_source=biome&utm_medium=readme" target="_blank"><img src="https://avatars.githubusercontent.com/u/14294501?s=200&v=4" height="100"></a>
</td>
</tr>
</tbody>
</table>
Expand Down
3 changes: 3 additions & 0 deletions packages/@biomejs/biome/README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ npx @biomejs/biome ci ./src
<td align="center" valign="middle">
<a href="https://www.phoenixlabs.dev/?utm_source=biome&utm_medium=readme" target="_blank"><img src="https://images.opencollective.com/phoenix-labs/2824ed4/logo/100.png?height=100" height="100"></a>
</td>
<td align="center" valign="middle">
<a href="https://lokalise.com/?utm_source=biome&utm_medium=readme" target="_blank"><img src="https://avatars.githubusercontent.com/u/14294501?s=200&v=4" height="100"></a>
</td>
</tr>
</tbody>
</table>
Expand Down
Loading
Loading