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

release: 12.0.0 #4002

Merged
merged 45 commits into from
Mar 28, 2023
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
1331d61
release: placeholder
ematipico Dec 7, 2022
05adcfa
chore: update documentation
ematipico Mar 5, 2023
face399
some goodies for the README.md
ematipico Mar 6, 2023
7967014
chore: make organize imports opt-in only
ematipico Mar 6, 2023
4baa586
add examples to help
ematipico Mar 8, 2023
667974b
feat(rome_service): add `all` configuration to linter (#4258)
ematipico Mar 5, 2023
d819a12
docs(rome_js_analyze): improve noDuplicateParameters docs (#4257)
Conaclos Mar 5, 2023
dcf1dde
docs(rome_js_analyze): improve noCatchAssign docs (#4262)
Conaclos Mar 5, 2023
7d6c6ee
Fix Linux executable's path in the standalone docs (#4251)
davidbgk Mar 5, 2023
fd0ea23
fix(rome_fs): Allow to ignore patterns to symbolic links (symlinks) (…
realtimetodie Mar 5, 2023
cb49a39
fix(rome_cli): don't add newline when formatting from std (#4263)
ematipico Mar 6, 2023
6451441
feat(rome_js_analyzer): read globals from analyzer options (#4261)
ematipico Mar 6, 2023
19e461d
feat(rome_js_analyze): noParameterAssign (#4264)
Conaclos Mar 7, 2023
622f130
docs(rome_js_analyze): `noParameterAssign` in release 12.0.0 (#4271)
Conaclos Mar 7, 2023
e1c41c9
feat(rome_js_parser): Support optional variance annotation (#4250)
nissy-dev Mar 8, 2023
727bb1e
feat(rome_js_analyze): useNamespaceKeyword (#4266)
Conaclos Mar 8, 2023
ff06665
chore: update dependencies (#4277)
ematipico Mar 8, 2023
6d60763
docs(rome_js_analyze): improve CONTRIBUTING and code gen (#4278)
Conaclos Mar 8, 2023
b5a2fd4
refactor(rome_js_analyze): rename noSelfAssignment to noSelfAssign (#…
Conaclos Mar 8, 2023
7b4ad15
docs(rome_js_analyze): improve CONTRIBUTING (#4280)
Conaclos Mar 8, 2023
4c3775b
fix(rome_cli): prevent exploration of ignored directories (#4276)
ematipico Mar 9, 2023
d7d94e8
docs: Changing the yarn command (#4273)
JunkMeal Mar 9, 2023
43f9a03
refactor(rome_js_analyze): noDelete (#4272)
Conaclos Mar 9, 2023
8b25653
fix(rome_cli): exit with error code while applying fixes (#4270)
ematipico Mar 10, 2023
def3db2
update changelog
ematipico Mar 10, 2023
2724c43
rebase and add mention for testing
ematipico Mar 10, 2023
3bf7555
more changelog changes
ematipico Mar 10, 2023
689140a
Merge remote-tracking branch 'origin/main' into release/12.0.0
ematipico Mar 10, 2023
cf04739
merge
ematipico Mar 10, 2023
5c9b1f0
apply format
ematipico Mar 10, 2023
21a808f
more changes
ematipico Mar 11, 2023
4efff74
chore: apply organize imports
ematipico Mar 15, 2023
805ce83
Merge remote-tracking branch 'origin/main' into release/12.0.0
ematipico Mar 18, 2023
5534335
merge, contribution tips and more changelog
ematipico Mar 18, 2023
ca8e902
add script
ematipico Mar 18, 2023
7527be7
update configuration
ematipico Mar 18, 2023
9437ab1
fix generation of json blocks
ematipico Mar 18, 2023
fdf5f96
apply check
ematipico Mar 18, 2023
6a29f2d
change versioning philosophy
ematipico Mar 20, 2023
2537dcd
update rage command to take organize imports into account
ematipico Mar 20, 2023
dcd4340
list of rules
ematipico Mar 21, 2023
e95384c
bump numbers
ematipico Mar 21, 2023
d2e1c31
udpate contributors
ematipico Mar 27, 2023
34a66e7
Merge remote-tracking branch 'origin' into release/12.0.0
ematipico Mar 27, 2023
03942c9
better phrase
ematipico Mar 28, 2023
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 .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ indent_size = 2

# YAML doesn't support hard tabs 🙃
# Templates that will be weird with hard tabs in the website editor
[{**.yml, .github/**.md, **.rs}]
[{**.yml, .github/**.md, **.rs, **.mdx}]
indent_style = space

[*.rs]
Expand Down
10 changes: 10 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@

<!-- Demonstrate the code is solid. Example: The exact commands you ran and their output. -->

## Changelog

<!--
Read the following paragraph for more information: https://github.com/rome/tools/blob/main/CONTRIBUTING.md#changelog

Tick the checkbox if your PR requires a new line in the changelog.
-->

- [ ] The PR requires a changelog line

## Documentation

<!--
Expand Down
103 changes: 103 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,108 @@
# Rome changelog

## [Unreleased]

### CLI
### Configuration
### Editors
### Formatter
### Linter
### Parser
### VSCode
### JavaScript APIs


## 12.0.0

### CLI

##### Breaking changes

- Review how the traversal of the file system works. Now Rome won't navigate folders that are ignored.
While this change is a bug fix, this could affect how the `ignore` entries. We suggest to review them
and make sure they still work.
- `--apply-suggested` is now called `--apply-unsafe`

##### Other changes

- `rome check` now sorts import statements. This is an experimental feature that needs to be
enabled via configuration.
- Rome now is able to auto discover the configuration file. If Rome doesn't fine a configuration in the
working directory, it will try to find one in the parent directories.
- Add a new global options called `--config-path`. It tells Rome to try and discover a `rome.json` file
in the given path. When this option is passed, the **auto discover** is disabled. Additionally, if no
configuration file is found, Rome will abort the operation and exit with an error code.
```shell
rome format --config-path=../../other/path/
rome check --config-path=../../other/path/
```
- `rome check --apply` and `rome check --apply-unsafe` exit with an error code if some file
still has error diagnostics. This will happen for rules that don't have code fixes.
-


### Configuration

#### Other changes

- Rome now uses the internal JSON parser to validate the configuration file. This means Rome won't
exit anymore if there are issues with the `rome.json` file, instead it will apply its defaults
to the sections that are incorrect.
- Add `javascript.organizeImports`. This is an experimental feature and users need to opt-in.

```json
{
"javascript": {
"organizeImports": {
ematipico marked this conversation as resolved.
Show resolved Hide resolved
"enabled": true
}
}
}
```
- Add `linter.rules.all` and `linter.rules.[group].all`. These options allow to enable or disable **all**
rules, or all rules for a **given group**. `all` and `recommended` can't be both `true`.


```json
{
"linter": {
"rules": {
"all": true,
"style" : {
"all": false
}
}
}
}
```

The previous example will enable all rules and disable all rules that belong to the `style` group.

### Editors

##### Other changes

- Add support to display diagnostics for JSON files
- Add support to format JSON files

### Formatter

- Add support to format JSON files

### Linter

### Parser

- Support for TypeScript 4.7

### VSCode

##### Other changes
- Add a new option called `requireConfiguration`. Enabling this option will force Rome to require
a configuration file in your workspace/project. If Rome doesn't find a `rome.json` file, it won't
emit diagnostics.


## 11.0.0

### CLI
Expand Down
75 changes: 71 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,46 @@ cargo run --bin rome -- --help

Rome can be used as a language server by following the instructions below.

## Testing

To run the tests, just run

```shell
cargo test
```

Or

```shell
cargo t
```

If you want to test run tests for a single crates, just change path inside the root of the crate you want to test.
For example, if you want to run the tests of the `rome_cli` crate, you would run:

```shell
cd ./crates/rome_cli
cargo t
```

If you to run only the doctests, you would need to pass an argument to the command:
```shell
cargo test --doc
```

In some crates, we use snapshot testing. The majority of snapshot testing is done using [`insta`](https://insta.rs).

Make sure to install it globally via `cargo`:

```shell
cargo install cargo-insta
```

When a snapshot test fails, you can run:
- `cargo insta accept` to accept all the changes and update all the snapshots;
- `cargo insta reject` to reject all the changes;
- `cargo insta review` to review snapshots singularly;

## Language Server and VS Code Extension Development

The Rome language server is the binary crate `rome` which can be built using the command:
Expand Down Expand Up @@ -177,6 +217,36 @@ When creating a new pull request, it's preferable to use a conventional commit-f

Please use the template provided.

#### Changelog

If the PR you're about to open is a bugfix/feature around Rome, you should add a new line to the `CHANGELOG.md`.

At the top of the file you will see a `[Unreleased]` section. The headings divide the sections by "feature", make sure
to add a new bullet point.

Here's a sample of the headings:

```markdown
## [Unreleased]

### CLI
### Configuration
### Editors
### Formatter
### Linter
### Parser
### VSCode
### JavaScript APIs
```


If you're editing a blank section:
- If your PR adds a **breaking change**, create a new heading called `#### BREAKING CHANGES` and add
bullet point that explains the breaking changes; provide a migration path if possible.
- If your PR adds a new feature of a fix, create a new heading called `#### Other changes` and
add a bullet point that explains the fix or the new feature. Make sure that this new heading
appears after the `#### BREAKING CHANGES` heading.

#### Documentation

If your PR requires some update on the website (new features, breaking changes, etc.), you should create a new PR once the previous PR is successfully merged.
Expand All @@ -191,10 +261,7 @@ The template should help to give all the information to the team.

Here are some other scripts that you might find useful.

#### If you are a core contributor

If you are a core contributor, and you have access to create new branches
from the main repository (not a fork), use these comments to run specific workflows:
#### Magic comments

- `!bench_parser` benchmarks the parser's runtime performance and writes a comment with the results;
- `!bench_formatter` benchmarks the formatter runtime performance and writes a comment with the results;
Expand Down
17 changes: 16 additions & 1 deletion crates/rome_cli/src/commands/help.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ const CHECK: Markup = markup! {
"<Emphasis>"USAGE:"</Emphasis>"
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
INPUTS can be one or more filesystem paths, each pointing to a single file or an entire directory.

"<Emphasis>"EXAMPLES:"</Emphasis>"
rome check ./scripts/file.js
rome check ./
rome check ./src ./internal ./scripts

"<Emphasis>"OPTIONS:"</Emphasis>"
"<Dim>"--apply"</Dim>" Apply safe fixes
Expand Down Expand Up @@ -62,6 +67,11 @@ const CI: Markup = markup! {

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

"<Emphasis>"EXAMPLES:"</Emphasis>"
rome ci ./scripts/file.js
rome ci ./
rome ci ./src ./internal ./scripts

"<Emphasis>"OPTIONS:"</Emphasis>"
"<Dim>"--formatter-enabled"</Dim>" Allow to enable or disable the formatter check. (default: true)
"<Dim>"--linter-enabled"</Dim>" Allow to enable or disable the linter check. (default: true)
Expand All @@ -80,6 +90,11 @@ const FORMAT: Markup = markup! {

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

"<Emphasis>"EXAMPLES:"</Emphasis>"
rome format ./scripts/file.js
rome format ./
rome format ./src ./internal ./scripts

"<Emphasis>"OPTIONS:"</Emphasis>"
"<Dim>"--write"</Dim>" Edit the files in place (beware!) instead of printing the diff to the console
"<Dim>"--skip-errors"</Dim>" Skip over files containing syntax errors instead of emitting an error diagnostic.
Expand Down
4 changes: 4 additions & 0 deletions crates/rome_cli/tests/commands/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1423,6 +1423,10 @@ fn organize_imports() {
let mut fs = MemoryFileSystem::default();
let mut console = BufferConsole::default();

let config = r#"{ "organizeImports": { "enabled": true } }"#;
let file_path = Path::new("rome.json");
fs.insert(file_path.into(), config.as_bytes());

let file_path = Path::new("check.js");
let content = r#"
import { lorem, foom, bar } from "foo";
Expand Down
4 changes: 2 additions & 2 deletions crates/rome_cli/tests/configs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub const CONFIG_FORMAT: &str = r#"{

pub const CONFIG_INIT_DEFAULT: &str = r#"{
"organizeImports": {
"enabled": true
"enabled": false
},
"linter": {
"enabled": true,
Expand All @@ -24,7 +24,7 @@ pub const CONFIG_INIT_DEFAULT: &str = r#"{
pub const CONFIG_INIT_DEFAULT_WHEN_INSTALLED: &str = r#"{
"$schema": "./node_modules/rome/configuration_schema.json",
"organizeImports": {
"enabled": true
"enabled": false
},
"linter": {
"enabled": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
source: crates/rome_cli/tests/snap_test.rs
expression: content
---
## `rome.json`

```json
{ "organizeImports": { "enabled": true } }
```

## `check.js`

```js
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ expression: content
```json
{
"organizeImports": {
"enabled": true
"enabled": false
},
"linter": {
"enabled": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ expression: content
{
"$schema": "./node_modules/rome/configuration_schema.json",
"organizeImports": {
"enabled": true
"enabled": false
},
"linter": {
"enabled": true,
Expand Down
2 changes: 1 addition & 1 deletion crates/rome_service/src/configuration/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ impl Default for Configuration {
enabled: true,
..LinterConfiguration::default()
}),
organize_imports: Some(OrganizeImports { enabled: true }),
organize_imports: Some(OrganizeImports { enabled: false }),
formatter: None,
javascript: None,
schema: None,
Expand Down
18 changes: 9 additions & 9 deletions editors/vscode/README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
# Rome VS Code Extension

[Rome](https://rome.tools/) unifies your development stack by combining the functionality of separate tools. It uses a single configuration file, has fantastic performance, and works with any stack. This extension brings Rome to your editor so that you can:
[Rome](https://rome.tools/) unifies your development stack by combining the functionality of separate tools. It uses a single configuration file, has fantastic performance, and works with any stack. This extension brings Rome to your editor so that you can:

- Format files *on save* or when issuing the *Format Document* command
- Format files *on save* or when issuing the *Format Document* command
- See lints while you type and apply code fixes
- Perform refactors

## Installation

You can install the code extension by heading to the extension's [Visual Studio Code Market Place page](https://marketplace.visualstudio.com/items?itemName=rome.rome) or from within VS Code by either:
You can install the code extension by heading to the extension's [Visual Studio Code Market Place page](https://marketplace.visualstudio.com/items?itemName=rome.rome) or from within VS Code by either:

- Open the *extensions* tab (_View_ → _Extensions)_ and search for Rome.
- Open the _Quick Open Overlay_ (Ctrl/Cmd+P or _Go -> Go to File_), enter `ext install rome.rome`, and hit enter.
- Open the *extensions* tab (_View_ → _Extensions)_ and search for Rome.
- Open the _Quick Open Overlay_ (<kbd>Ctrl</kbd>/<kbd title="Cmd">⌘</kbd>+<kbd>P</kbd> or _Go -> Go to File_), enter `ext install rome.rome`, and hit enter.

## Getting Started

### Default Formatter

Configure Rome as the default formatter for supported files to ensure that VS Code uses Rome over other formatters that you may have installed. You can do so by opening a JavaScript or TypeScript and then:

- Open the Command Palette (Ctrl/Cmd+Shift+P or View → Command Palette)
- Open the Command Palette (<kbd>Ctrl</kbd>/<kbd title="Cmd">⌘</kbd>+<kbd title="Shift">⇧</kbd>+<kbd>P</kbd> or View → Command Palette)
- Select _Format Document With…_
- Select _Configure Default Formatter…_
- Select Rome

You can also enable Rome for specific languages only:

- [Open the `settings.json`](https://code.visualstudio.com/docs/getstarted/settings#_settingsjson): open the _Command Palette_(Ctr+Shift+P) and select _Preferences: Open User Settings (JSON)_
- [Open the `settings.json`](https://code.visualstudio.com/docs/getstarted/settings#_settingsjson): open the _Command Palette_(<kbd>Ctrl</kbd>/<kbd title="Cmd">⌘</kbd>+<kbd title="Shift">⇧</kbd>+<kbd>P</kbd>) and select _Preferences: Open User Settings (JSON)_
- And set the `editor.defaultFormatter` to `rome.rome` for the desired language

```json
Expand Down Expand Up @@ -56,9 +56,9 @@ If the project has no dependency on Rome and no explicit path is configured, the

### Format document

To format an entire document, open the _Command Palette_ (Ctrl/Cmd+Shift+P) and select _Format Document_.
To format an entire document, open the _Command Palette_ (<kbd>Ctrl</kbd>/<kbd title="Cmd">⌘</kbd>+<kbd title="Shift">⇧</kbd>+<kbd>P</kbd>) and select _Format Document_.

To format a text range, select the text you want to format, open the _Command Palette_ (Ctrl/Cmd+Shift+P), and select _Format Selection_.
To format a text range, select the text you want to format, open the _Command Palette_ (<kbd>Ctrl</kbd>/<kbd title="Cmd">⌘</kbd>+<kbd title="Shift">⇧</kbd>+<kbd>P</kbd>), and select _Format Selection_.

### Format on save

Expand Down
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.20.0",
"version": "0.21.0",
"icon": "icon.png",
"activationEvents": [
"onLanguage:javascript",
Expand Down
Loading