Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

release: 0.6.0 #2662

Merged
merged 7 commits into from
Jun 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
42 changes: 42 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,47 @@
# Rome changelog

## 0.6.0

### Formatter

- BREAKING CHANGES: the command `rome format --ci` has been removed, use `rome ci` instead.

#### Improved the compatibility with Prettier (check [#2403](https://github.com/rome/tools/issues/2403) for more details)

- TypeScript's formatting is better in line with what Prettier does.
- Better formatting of string literals.
Removing unnecessary quotes in string literals and quotes from member names.
Correctly choose the correct quote based on quantity of quotes inside a literal:
```js
// original code
let a = {
"something": 3
}
let b = "cool isn\'t it";
let c = "\"content\" ' ";

// formatted code
let a = {
something: 3
}
let b = "cool ins't it";
let c = '"content" \' ';
```
- Better formatting of various statements
- Improved the performance of the formatter an average of 20%-30%! Check the relevant
PRs [1](https://github.com/rome/tools/pull/2456), [2](https://github.com/rome/tools/pull/2638), [3](https://github.com/rome/tools/pull/2612), [4](https://github.com/rome/tools/pull/2462), [5](https://github.com/rome/tools/pull/2634) if you're interested in what the team did.

To reach better compatibility with Prettier, the team had to revise the foundation of our printer,
which caused some regressions around how comments are printed. These are known issues that we
plan to close by next release.

### Linter

We've built the foundation of our linter. At the moment is only opt-in, and it contains
only a bunch of rules. **Safe fixes are not enabled yet via CLI**.

Refer to the [website](https://rome.tools/#linter) to learn how to start using it.

## 0.5.0

- BREAKING CHANGES: the `format` command doesn't write on disk by default. Now the command prints on terminal.
Expand Down
2 changes: 1 addition & 1 deletion crates/rome_analyze/src/analyzers/no_double_equals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ impl Rule for NoDoubleEquals {

fn diagnostic(_: &Self::Query, op: &Self::State) -> Option<RuleDiagnostic> {
Some(RuleDiagnostic {
severity: Severity::Error,
severity: Severity::Warning,
message: markup! {
"Do not use the "{op.text_trimmed()}" operator"
}
Expand Down
2 changes: 1 addition & 1 deletion crates/rome_analyze/src/analyzers/use_while.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ impl Rule for UseWhile {

fn diagnostic(node: &Self::Query, _: &Self::State) -> Option<RuleDiagnostic> {
Some(RuleDiagnostic {
severity: Severity::Error,
severity: Severity::Warning,
message: markup! {
"Use a while loop instead of a for loop"
}
Expand Down
9 changes: 5 additions & 4 deletions crates/rome_analyze/tests/specs/noDoubleEquals.js.snap
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
source: crates/rome_analyze/tests/spec_tests.rs
assertion_line: 96
expression: noDoubleEquals.js
---
# Input
Expand All @@ -14,11 +15,11 @@ const isNonNull = a != null;

# Diagnostics
```
error[noDoubleEquals]: Do not use the == operator
warning[noDoubleEquals]: Do not use the == operator
┌─ noDoubleEquals.js:1:18
1 │ const isZero = a == 0;
^^ Do not use the == operator
-- Do not use the == operator

Replace with strict equality
| @@ -1,4 +1,4 @@
Expand All @@ -32,11 +33,11 @@ Replace with strict equality
```

```
error[noDoubleEquals]: Do not use the != operator
warning[noDoubleEquals]: Do not use the != operator
┌─ noDoubleEquals.js:2:21
2 │ const isNonZero = a != 0;
^^ Do not use the != operator
-- Do not use the != operator

Replace with strict equality
| @@ -1,5 +1,5 @@
Expand Down
5 changes: 3 additions & 2 deletions crates/rome_analyze/tests/specs/useWhile.js.snap
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
source: crates/rome_analyze/tests/spec_tests.rs
assertion_line: 96
expression: useWhile.js
---
# Input
Expand All @@ -12,11 +13,11 @@ for (; true; ) {}

# Diagnostics
```
error[useWhile]: Use a while loop instead of a for loop
warning[useWhile]: Use a while loop instead of a for loop
┌─ useWhile.js:3:1
3 │ for (; true; ) {}
^^^^^^^^^^^^^^^^^ Use a while loop instead of a for loop
----------------- Use a while loop instead of a for loop

Use a while loop
| @@ -1,3 +1,3 @@
Expand Down
1 change: 1 addition & 0 deletions crates/rome_cli/tests/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ mod check {
}

#[test]
#[ignore = "lint errors are disabled until the linter is stable"]
fn lint_error() {
let mut fs = MemoryFileSystem::default();

Expand Down
4 changes: 2 additions & 2 deletions editors/vscode/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion editors/vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"publisher": "rome",
"displayName": "Rome",
"description": "Rome LSP VS Code Extension",
"version": "0.6.0",
ematipico marked this conversation as resolved.
Show resolved Hide resolved
"version": "0.8.0",
"icon": "icon.png",
"activationEvents": [
"onLanguage:javascript",
Expand Down
2 changes: 1 addition & 1 deletion npm/rome/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rome",
"version": "0.5.0-next",
"version": "0.6.0-next",
"bin": "bin/rome",
"scripts": {
"postinstall": "node scripts/postinstall.js"
Expand Down
15 changes: 15 additions & 0 deletions website/src/_includes/docs/ci.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## CI

Rome comes with a CI mode that allows performing multiple CI checks just by
running one single command.

This mode is only available via CLI.

### Use CI mode via CLI

```shell
rome ci
```

This command will:
- run the formatter in check mode
5 changes: 1 addition & 4 deletions website/src/_includes/docs/formatter.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Our formatter is really strict and has support for only a few options:
- quantity of spaces, applied only if you choose spaces as indent style;
- line width, which is the number of characters that fit in a single line; **Rome's default is `80`**

### VSCode extension
### Use the formatter via VSCode extension

The extension allows you to change the default [formatter options](#formatter-options).

Expand All @@ -35,8 +35,6 @@ appear only for documents that Rome supports.

### Use the formatter with the CLI

The only command that is supported is `format`.

You can start by running the CLI with the `--help` flag:

```shell
Expand All @@ -55,7 +53,6 @@ USAGE:

OPTIONS:
--write Write the output of the formatter to the files instead of printing the diff to the console
--ci Enable CI mode, lock files and exit with an error if the formatter would modify them
--skip-errors Skip over files containing syntax errors instead of returning an error
--indent-style <tabs|space> Determine whether the formatter should use tabs or spaces for indentation (default: tabs)
--indent-size <number> If the indentation style is set to spaces, determine how many spaces should be used for indentation (default: 2)
Expand Down
37 changes: 37 additions & 0 deletions website/src/_includes/docs/linter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
## Linter

You can use the linter via our [VS Code extension] or by downloading our CLI directly from our [release page].

> WARNING: The CLI and VS Code extension are packaged with separate binaries, which means that if you don't
> use our default options, you will have to **pass them to both the extension AND the CLI**.
>
> This is a temporary choice to allow people to play with our formatter. This will change in the near future.


### Use the formatter via VSCode extension

The feature is opt-in, and you'd need to enable the following options:
- `analysis.enableDiagnostics`
- `analysis.enableCodeActions`

### Use the formatter via CLI

You can start by running the CLI with the `--help` flag:

```shell
rome check --help
```

Which will show you the options available at the moment:

```shell
USAGE:
rome check <INPUTS...>

INPUTS can be one or more filesystem path, each pointing to a single file or an entire directory to be searched recursively for supported files

```


[VS Code extension]: https://marketplace.visualstudio.com/items?itemName=rome.rome
leops marked this conversation as resolved.
Show resolved Hide resolved
[release page]: https://github.com/rome/tools/releases
2 changes: 2 additions & 0 deletions website/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ layout: layouts/homepage.liquid
{% include docs/getting-started.md %}
{% include docs/status.md %}
{% include docs/formatter.md %}
{% include docs/linter.md %}
{% include docs/ci.md %}
{% include docs/philosophy.md %}
{% include docs/_old_diagnostic-anatomy.md %}