Skip to content

Commit

Permalink
docs: update internal docs (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
Conaclos authored Aug 19, 2023
1 parent 506ee2e commit 5a9bfdd
Show file tree
Hide file tree
Showing 24 changed files with 138 additions and 255 deletions.
40 changes: 20 additions & 20 deletions benchmark/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,43 +14,43 @@ Run in the root directory, not `./benchmark`
Setup: MacBook Pro (13-inch, M1, 2020)

### Formatting
* Rome's ~25 times faster than Prettier
* Rome's ~20 times faster than parallel-prettier
* Rome's ~20 times faster than `xargs -P`[^1]
* Rome's 1.5-2 times faster than `dprint`
* Rome single-threaded is ~7 times faster than Prettier.
* Biome's ~25 times faster than Prettier
* Biome's ~20 times faster than parallel-prettier
* Biome's ~20 times faster than `xargs -P`[^1]
* Biome's 1.5-2 times faster than `dprint`
* Biome single-threaded is ~7 times faster than Prettier.


[^1]: Run `time find lib/ examples declarations benchmark -name '*.js' -print0 | xargs -P8 -0 -n 200 npx prettier --write --loglevel=error` in the `target/webpack` directory. I manually tinkered with the `-n` parameter to get the fastest run.

### Linting
* Rome's ~15x times faster than ESLint
* Rome single-threaded is ~4 times faster than ESLint.
* Biome's ~15x times faster than ESLint
* Biome single-threaded is ~4 times faster than ESLint.

The speed-ups for the multithreaded benchmarks can vary significantly depending on the setup. For example, Rome is 100 times faster than Prettier on an M1 Max with 10 cores.
The speed-ups for the multithreaded benchmarks can vary significantly depending on the setup. For example, Biome is 100 times faster than Prettier on an M1 Max with 10 cores.

## Analysis
### Formatter
* Rome's formatter is fast :).
* It should be possible to speed up Prettier. Rome's architecture isn't that different, and native has its advantages, but Prettier should be able to compete in single-threaded mode.
* Biome's formatter is fast :).
* It should be possible to speed up Prettier. Biome's architecture isn't that different, and native has its advantages, but Prettier should be able to compete in single-threaded mode.

### Linting
* Rome's linter is fast but there is room for improvements
* Rome's linter spends significant time building the semantic model, the control flow graph, and matching queries. I'm convinced there's room for improvement ([3565](https://github.com/rome/tools/pull/3565), [3569](https://github.com/rome/tools/pull/3569)).
* Computing the diff for code fixes is expensive. Rome can spend up to 3s computing diffs (not measured by these benchmarks, see explanations below)
* Biome's linter is fast but there is room for improvements
* Biome's linter spends significant time building the semantic model, the control flow graph, and matching queries. I'm convinced there's room for improvement ([3565](https://github.com/rome/tools/pull/3565), [3569](https://github.com/rome/tools/pull/3569)).
* Computing the diff for code fixes is expensive. Biome can spend up to 3s computing diffs (not measured by these benchmarks, see explanations below)

## Notes

We've been careful to create fair benchmarks. This section explains some of the decisions behind the benchmark setup and how these decisions affect the results. Please [let us know](https://github.com/rome/tools/issues) if you have ideas on how to make the benchmarks fairer or if there's a mistake with our setup.

### Formatting
* Compares the wall time of Rome, Prettier, and dprint to format all files in a project where all files are correctly formatted.
* dprint and Prettier support incremental formatting to only format changed files, whereas Rome does not. This benchmark does not measure incremental formatting as it measures cold formatting time. You may see significant speedups on subsequent formatting runs when enabling incremental formatting.
* The benchmark limits Prettier to only format JavaScript and TypeScript files because Rome doesn't support other file types.
* Rome only prints a summary with the number of formatted files. The prettier benchmark uses `--loglevel=error` for a fairer benchmark so that Prettier doesn't print every filename.
* Compares the wall time of Biome, Prettier, and dprint to format all files in a project where all files are correctly formatted.
* dprint and Prettier support incremental formatting to only format changed files, whereas Biome does not. This benchmark does not measure incremental formatting as it measures cold formatting time. You may see significant speedups on subsequent formatting runs when enabling incremental formatting.
* The benchmark limits Prettier to only format JavaScript and TypeScript files because Biome doesn't support other file types.
* Biome only prints a summary with the number of formatted files. The prettier benchmark uses `--loglevel=error` for a fairer benchmark so that Prettier doesn't print every filename.

### Linting
* Compares the wall time of Rome and ESLint to check all files in a project.
* Only enables rules that both Rome and ESLint support.
* Rome prints rich diffs for each lint diagnostic, whereas ESLint only shows the name and description of the lint rule. That's why the benchmark uses `--max-diagnostics=0` when running Rome because Rome then only counts diagnostics without generating the diffs. Overall, this results in a more accurate comparison but has the downside that Rome only prints the diagnostic count, whereas ESLint prints a line for each lint error.
* Compares the wall time of Biome and ESLint to check all files in a project.
* Only enables rules that both Biome and ESLint support.
* Biome prints rich diffs for each lint diagnostic, whereas ESLint only shows the name and description of the lint rule. That's why the benchmark uses `--max-diagnostics=0` when running Biome because Biome then only counts diagnostics without generating the diffs. Overall, this results in a more accurate comparison but has the downside that Biome only prints the diagnostic count, whereas ESLint prints a line for each lint error.

12 changes: 6 additions & 6 deletions crates/rome_analyze/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ Rules are divided by capabilities:

Most of the rules will go under `analyzers/` or `semantic_analyzer/`.

Inside these four folders, we have a folder for each group that _Rome_ supports.
Inside these four folders, we have a folder for each group that _Biome_ supports.

When implementing **new rules**, they have to be implemented under the group `nursery`.
New rules should always be considered unstable/not exhaustive.

In addition to selecting a group, rules may be flagged as `recommended`.
The **recommended rules** are enabled in the default configuration of the _Rome_ linter.
The **recommended rules** are enabled in the default configuration of the _Biome_ linter.
As a general principle, a recommended rule should catch actual programming errors.
For instance, detecting a coding pattern that will throw an exception at runtime.
Pedantic rules that check for specific unwanted patterns but may have high false positive rates,
Expand All @@ -45,12 +45,12 @@ Our CI ensures that this code is not out of sync and fails otherwise.
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, _Rome_ provides an easy way to create and test your rule using [Just](https://just.systems/man/en/).
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).

### Choose a name

_Rome_ follows a naming convention according to what the rule do:
_Biome_ follows a naming convention according to what the rule do:

1. Forbid a concept

Expand Down Expand Up @@ -112,7 +112,7 @@ Let's say we want to create a new rule called `myRuleName`, which uses the seman
}
```

While implementing the diagnostic, please keep [Rome's technical principals](https://rome.tools/#technical) in mind.
While implementing the diagnostic, please keep [Biome's technical principals](https://biomejs.dev/#technical) in mind.
This function is called for every signal emitted by the `run` function, and it may return
zero or one diagnostic.

Expand Down Expand Up @@ -198,7 +198,7 @@ The doc-comment for the rule is mandatory and is used to generate the
documentation page for the rule on the website.
Importantly, the tool used to generate those pages also runs tests on the
code blocks included in the documentation written in languages supported by
the _Rome_ toolchain (JavaScript, JSX, TypeScript, ...) similar to how
the _Biome_ toolchain (JavaScript, JSX, TypeScript, ...) similar to how
`rustdoc` generates tests from code blocks written in Rust. Because code
blocks in Rust doc-comments are assumed to be written in Rust by default
the language of the test must be explicitly specified, for instance:
Expand Down
2 changes: 1 addition & 1 deletion crates/rome_analyze/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Rome Analyze
# Biome Analyze

## This entire crate is a WIP with a clunky and unstable API.

Expand Down
11 changes: 5 additions & 6 deletions crates/rome_cli/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# `rome_cli`

Rome's main binary distribution, exposes the command line interface defined in
this crate, and the language server interface defined in `rome_lsp` and used by
the `rome` VSCode extension
The main binary distribution, exposes the command line interface defined in this crate,
and the language server interface defined in `rome_lsp` and used by the `biome` VSCode extension

# Logs

When the server is run in daemon mode, it will output logs to a file created in
a `biome-logs` directory inside the system temporary directory. The log file
will be rotated on a hourly basis.
When the server is run in daemon mode,
it will output logs to a file created in the `biome-logs` directory inside the system temporary directory.
The log file will be rotated on a hourly basis.
27 changes: 7 additions & 20 deletions crates/rome_css_parser/README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,23 @@
<p align="center">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/rome/brand/main/PNG/logo_white_yellow_transparent.png" width="700">
<img alt="Rome's logo depicting an ancient Roman arch with the word Rome to its side" src="https://raw.githubusercontent.com/rome/brand/main/PNG/logo_transparent.png" width="700">
</picture>
<img alt="Biome - Toolchain of the web" width="400" src="https://raw.githubusercontent.com/biomejs/resources/main/biome-logo-slogan.svg"/>
</p>

<div align="center">

[![MIT licensed][mit-badge]][mit-url]
[![Discord chat][discord-badge]][discord-url]
[![CI on main][ci-badge]][ci-url]
[![npm version][npm-badge]][npm-url]
[![VSCode version][vscode-badge]][vscode-url]
[![CI][ci-badge]][ci-url]
[![cargo version][cargo-badge]][cargo-url]


[mit-badge]: https://img.shields.io/badge/license-MIT-blue.svg?color=brightgreen
[mit-url]: LICENSE
[discord-badge]: https://img.shields.io/discord/678763474494423051?logo=discord&label=discord&color=brightgreen
[discord-url]: https://discord.gg/rome
[discord-badge]: https://badgen.net/discord/online-members/BypW39g6Yc?icon=discord&label=discord&color=green
[discord-url]: https://discord.gg/BypW39g6Yc
[ci-badge]: https://github.com/biomejs/biome/actions/workflows/main.yml/badge.svg
[ci-url]: https://github.com/biomejs/biome/actions/workflows/main.yml
[npm-badge]: https://img.shields.io/npm/v/rome/latest?color=brightgreen
[npm-url]: https://www.npmjs.com/package/rome/v/latest
[vscode-badge]: https://img.shields.io/visual-studio-marketplace/v/rome.rome?color=brightgreen&label=vscode
[vscode-url]: https://marketplace.visualstudio.com/items?itemName=rome.rome
[cargo-badge]: https://img.shields.io/crates/v/rome_css_parser?&color=brightgreen
[cargo-url]: https://crates.io/crates/rome_css_parser
[cargo-badge]: https://badgen.net/crates/v/rome_css_parser?&color=green
[cargo-url]: https://crates.io/crates/rome_css_parser/

</div>

# `rome_css_parser`

Rome's CSS parser implementation. Follow the [documentation](https://docs.rs/rome_css_parser/latest).
Biome's CSS parser implementation. Follow the [documentation](https://docs.rs/rome_css_parser/latest).

17 changes: 8 additions & 9 deletions crates/rome_diagnostics/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# Writing Diagnostics

The `rome_diagnostics` crate implements "Diagnostics", the generic concept of
how the various errors and issues that can be raised in the Rome codebase,
how the various errors and issues that can be raised in the Biome codebase,
and displayed to the final user. This guide is aimed at
contributors to the Rome codebase to help writing diagnostics, both at the
contributors to the Biome codebase to help writing diagnostics, both at the
technical level, and as general best practices to make diagnostics easier to
understand for the final user.

## What is a Diagnostic

Diagnostics are at the core of the experience of the Rome toolchain for the
Diagnostics are at the core of the experience of the Biome toolchain for the
users, and providing high quality diagnostics is crucial to making the usage of
Rome as frictionless as possible even when errors happen. What follows is a
Biome as frictionless as possible even when errors happen. What follows is a
list of best practice for writing good diagnostics:

- The Diagnostic should follow the [Technical Principles](https://rome.tools/#technical)
of the Rome project
- The Diagnostic should follow the [Technical Principles](https://biomejs.dev/#technical)
of the Biome project
- A diagnostic should not simply state that something went wrong, it should
explain why it went wrong. Add explanations in log advices, and show hyperlinks
to relevant documentation pages in case the user wants to know more.
Expand Down Expand Up @@ -62,7 +62,7 @@ for instance by passing a `--verbose` flag to the CLI). Verbose advices are
printed in a separate section below the main advices and can be used to provide
further information about a given diagnostic (for instance a fixable linter
diagnostic may print a verbose advice instructing the user to run
`rome check --apply` to automatically apply the fix).
`biome check --apply` to automatically apply the fix).
- A `location` describing where the error happened. It can be a path to a file
on the file system, a command line argument, or an arbitrary memory buffer. It may
optionally specify a specific range within the text content of this resource,
Expand All @@ -71,7 +71,7 @@ code frames in the diagnostic. Conceptually the `location` points to a
"resource" this error originated from.
- `tags` conveying additional informations about the diagnostic: if the
diagnostic has information on how it can be fixed, if it resulted from an
internal error in Rome and was not directly caused by the user, if it is being
internal error in Biome and was not directly caused by the user, if it is being
emitted to warn the user about unused or deprecated code.
- An optional `source`, another diagnostic that details the low-level reason
why this diagnostic was emitted: for instance a diagnostic reporting a failed
Expand Down Expand Up @@ -135,4 +135,3 @@ allocates).
The category may also require some special care if you're declaring a new one,
since all diagnostic categories have to be statically registered you'll need to
add it to `crates/rome_diagnostics_categories/src/categories.rs`

2 changes: 1 addition & 1 deletion crates/rome_diagnostics/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# `rome_diagnostics`

This crate contains the types and utility functions used to implement errors
and diagnostics in the Rome codebase
and diagnostics in the Biome codebase

## Acknowledgement

Expand Down
2 changes: 1 addition & 1 deletion crates/rome_diagnostics_categories/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# `rome_diagnostics_categories`

This crate contains a static registry of all the diagnostic categories used
throughout the Rome codebase
throughout the Biome codebase

## Code Generation

Expand Down
27 changes: 7 additions & 20 deletions crates/rome_formatter/README.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,22 @@
<p align="center">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/rome/brand/main/PNG/logo_white_yellow_transparent.png" width="700">
<img alt="Rome's logo depicting an ancient Roman arch with the word Rome to its side" src="https://raw.githubusercontent.com/rome/brand/main/PNG/logo_transparent.png" width="700">
</picture>
<img alt="Biome - Toolchain of the web" width="400" src="https://raw.githubusercontent.com/biomejs/resources/main/biome-logo-slogan.svg"/>
</p>

<div align="center">

[![MIT licensed][mit-badge]][mit-url]
[![Discord chat][discord-badge]][discord-url]
[![CI on main][ci-badge]][ci-url]
[![npm version][npm-badge]][npm-url]
[![VSCode version][vscode-badge]][vscode-url]
[![CI][ci-badge]][ci-url]
[![cargo version][cargo-badge]][cargo-url]


[mit-badge]: https://img.shields.io/badge/license-MIT-blue.svg?color=brightgreen
[mit-url]: LICENSE
[discord-badge]: https://img.shields.io/discord/678763474494423051?logo=discord&label=discord&color=brightgreen
[discord-url]: https://discord.gg/rome
[discord-badge]: https://badgen.net/discord/online-members/BypW39g6Yc?icon=discord&label=discord&color=green
[discord-url]: https://discord.gg/BypW39g6Yc
[ci-badge]: https://github.com/biomejs/biome/actions/workflows/main.yml/badge.svg
[ci-url]: https://github.com/biomejs/biome/actions/workflows/main.yml
[npm-badge]: https://img.shields.io/npm/v/rome/latest?color=brightgreen
[npm-url]: https://www.npmjs.com/package/rome/v/latest
[vscode-badge]: https://img.shields.io/visual-studio-marketplace/v/rome.rome?color=brightgreen&label=vscode
[vscode-url]: https://marketplace.visualstudio.com/items?itemName=rome.rome
[cargo-badge]: https://img.shields.io/crates/v/rome_formatter?&color=brightgreen
[cargo-url]: https://crates.io/crates/rome_formatter
[cargo-badge]: https://badgen.net/crates/v/rome_formatter?&color=green
[cargo-url]: https://crates.io/crates/rome_formatter/

</div>

# `rome_formatter`

Rome's formatter implementation. Follow the [documentation](https://docs.rs/rome_formatter/).
Biome's formatter implementation. Follow the [documentation](https://docs.rs/rome_formatter/).
25 changes: 6 additions & 19 deletions crates/rome_js_factory/README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,19 @@
<p align="center">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/rome/brand/main/PNG/logo_white_yellow_transparent.png" width="700">
<img alt="Rome's logo depicting an ancient Roman arch with the word Rome to its side" src="https://raw.githubusercontent.com/rome/brand/main/PNG/logo_transparent.png" width="700">
</picture>
<img alt="Biome - Toolchain of the web" width="400" src="https://raw.githubusercontent.com/biomejs/resources/main/biome-logo-slogan.svg"/>
</p>

<div align="center">

[![MIT licensed][mit-badge]][mit-url]
[![Discord chat][discord-badge]][discord-url]
[![CI on main][ci-badge]][ci-url]
[![npm version][npm-badge]][npm-url]
[![VSCode version][vscode-badge]][vscode-url]
[![CI][ci-badge]][ci-url]
[![cargo version][cargo-badge]][cargo-url]


[mit-badge]: https://img.shields.io/badge/license-MIT-blue.svg?color=brightgreen
[mit-url]: LICENSE
[discord-badge]: https://img.shields.io/discord/678763474494423051?logo=discord&label=discord&color=brightgreen
[discord-url]: https://discord.gg/rome
[discord-badge]: https://badgen.net/discord/online-members/BypW39g6Yc?icon=discord&label=discord&color=green
[discord-url]: https://discord.gg/BypW39g6Yc
[ci-badge]: https://github.com/biomejs/biome/actions/workflows/main.yml/badge.svg
[ci-url]: https://github.com/biomejs/biome/actions/workflows/main.yml
[npm-badge]: https://img.shields.io/npm/v/rome/latest?color=brightgreen
[npm-url]: https://www.npmjs.com/package/rome/v/latest
[vscode-badge]: https://img.shields.io/visual-studio-marketplace/v/rome.rome?color=brightgreen&label=vscode
[vscode-url]: https://marketplace.visualstudio.com/items?itemName=rome.rome
[cargo-badge]: https://img.shields.io/crates/v/rome_js_factory?&color=brightgreen
[cargo-url]: https://crates.io/crates/rome_js_factory
[cargo-badge]: https://badgen.net/crates/v/rome_js_factory?&color=green
[cargo-url]: https://crates.io/crates/rome_js_factory/

</div>

Expand Down
Loading

0 comments on commit 5a9bfdd

Please sign in to comment.