Skip to content
This repository was archived by the owner on Aug 31, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 13 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
170 changes: 170 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,175 @@
# Rome changelog

## 11.0.0

### CLI

#### BREAKING CHANGES

- the argument `--no-colors` has been removed, in favor of `--color=off`

#### Other changes

- The `init` command now adds the `$schema` property to the generated `rome.json` file
if `rome` is installed inside the `node_modules` folder. Follow [this guide](https://docs.rome.tools/configuration#schema) to add the `$schema` property
manually in a project with an existing `rome.json` file.
- A new `--semicolons` option that configures if the formatter prints semicolons at the end of every statement (default) or at the beginning of statements when necessary to prevent ASI failures.
- Rome exits with an error code if it doesn't process any file.
- Fixed how the maximum number of diagnostics is calculated [#3869](https://github.com/rome/tools/pull/3869).
Rome now prints the total number of errors caused in the files.
- Rome now traverses symbolic links and emits warnings if it detects loops, and continues processing the next file during the directory traversal.
- You can force color output using the new global `--colors` option with the value `force`. Forcing color output can be useful if you spawn Rome as a subprocess.
Rome is spawned as a process;

### Configuration

- Added the JSON schema `$schema` property. The schema enables auto-completion by editors and...
auto-completion and descriptions of all fields of the configuration file.
- Added a new `files.ignore` option where users can ignore files across tools.

### Editors

- We also publish Rome to [Open VSX](https://open-vsx.org/).
- The extension now resolves the Rome version installed in the `node_modules` folder.
- Fixed an issue where diagnostics were not updated after a change to the configuration file (#3724)[https://github.com/rome/tools/pull/3724]
- The LSP emits a new action where the user can suppress a rule.

### Formatter

#### BREAKING CHANGES

- Fixed incompatibility issues with Prettier [#3531](https://github.com/rome/tools/issues/3531)
- [#3686](https://github.com/rome/tools/pull/3686)
- [#3732](https://github.com/rome/tools/pull/3732)
- [#3842](https://github.com/rome/tools/pull/3842)
- Fixed an issue where infinite parentheses were wrongly inserted [#3735](https://github.com/rome/tools/issues/3735)
- Better formatting for `jestEach` templates

#### Other changes

- Added [support](https://docs.rome.tools/configuration/#javascriptformattersemicolon) for omitting semicolons.


### Linter

- Fixed false positives emitted by `noUselessFragments` [#3668](https://github.com/rome/tools/issues/3668)
- Fixed `noArrayIndexKey` where some cases were not detected [#3670](https://github.com/rome/tools/issues/3670)
- Fixed false positives emitted by `noConstAssign` [#3728](https://github.com/rome/tools/issues/3728)
- Fixed false positives emitted by `noShoutyConstants` [#3867](https://github.com/rome/tools/issues/3867)
- Fixed false positives emitted by `noUnusedVariables` [#3779](https://github.com/rome/tools/issues/3779)
- Fixed `noUndeclaredVariables` where some cases were not detected [#3798](https://github.com/rome/tools/issues/3798)

#### Rules

The following rules have been stabilized:
- `nusery/useFlatMap` -> `complexity/useFlatMap`
- `nusery/useValidForDirection` -> `correctness/useValidForDirection`
- `nusery/noExplicitAny` -> `suspicious/noExplicitAny`
- `nusery/noConstAssign` -> `correctness/noConstAssign`

These rules are all recommended, so they will be enabled by default. You can simply remove those entries from your configuration file if you had enabled them manually from the `nursery` group.

The following rules have been renamed:
- `a11y/useBlankTarget` -> `a11y/noBlankTarget`
- `correctness/noMultipleSpacesInRegularExpressionLiterals` -> `complexity/noMultipleSpacesInRegularExpressionLiterals`
- `style/useOptionalChain` -> `complexity/useOptionalChain`
- `correctness/noUselessFragments` -> `complexity/noUselessFragments`
- `correctness/noDelete` -> `performance/noDelete`
- `correctness/useSingleCaseStatement` -> `style/useSingleCaseStatement`
- `correctness/useWhile` -> `style/useWhile`
- `correctness/noArguments` -> `style/noArguments`
- `correctness/noAsyncPromiseExecutor` -> `suspicious/noAsyncPromiseExecutor`
- `correctness/noCommentText` -> `suspicious/noCommentText`
- `correctness/noCompareNegZero` -> `suspicious/noCompareNegZero`
- `correctness/noDebugger` -> `suspicious/noDebugger`
- `correctness/noDoubleEquals` -> `suspicious/noDoubleEquals`
- `correctness/noShadowRestrictedNames` -> `suspicious/noShadowRestrictedNames`
- `correctness/noSparseArray` -> `suspicious/noSparseArray`
- `correctness/noUnsafeNegation` -> `suspicious/noUnsafeNegation`
- `correctness/useValidTypeof` -> `suspicious/useValidTypeof`
- `correctness/noArrayIndexKey` -> `suspicious/noArrayIndexKey`
- `correctness/noCatchAssign` -> `suspicious/noCatchAssign`
- `correctness/noDupeArgs` -> `suspicious/noDuplicateParameters`
- `correctness/noFunctionAssign` -> `suspicious/noFunctionAssign`
- `correctness/noImportAssign` -> `suspicious/noImportAssign`
- `correctness/noLabelVar` -> `suspicious/noLabelVar`
- `correctness/noRestrictedGlobals` -> `nursery/noRestrictedGlobals`
- `nursery/noDupeKeys` -> `nursery/noDuplicateObjectKeys`

If you were not changing the severity level of any of these rules in your configuration file, or suppressing a diagnostic emitted by those rules using suppression comments, you do not have to do anything. But if you did, Rome will now emit diagnostics for the parts of your configuration or suppression comments you need to update.

The following rules are no longer recommended:
- `style/noImplicitBoolean`
- `style/noNegationElse`
- `style/useBlockStatements`
- `style/useShorthandArrayType`
- `correctness/useSingleCaseStatement` / `style/useSingleCaseStatement`
- `style/noShoutyConstants`

The styling decisions imposed by these rules were not deemed to be idiomatic enough in the JavaScript ecosystem to be enabled by default. If you do want to enforce those rules in your project, you will have to enable them manually in you configuration file:

```json
{
"linter": {
"rules": {
"style": {
"useBlockStatements": "warn"
}
}
}
}
```

Finally, the following new rules have been introduced to the nursery group in this release:
- [`nursery/noAccessKey`](https://docs.rome.tools/lint/rules/noAccessKey)
- [`nursery/noConditionalAssignment`](https://docs.rome.tools/lint/rules/noConditionalAssignment)
- [`nursery/noConstEnum`](https://docs.rome.tools/lint/rules/noConstEnum)
- [`nursery/noConstructorReturn`](https://docs.rome.tools/lint/rules/noConstructorReturn)
- [`nursery/noDistractingElements`](https://docs.rome.tools/lint/rules/noDistractingElements)
- [`nursery/noDuplicateObjectKeys`](https://docs.rome.tools/lint/rules/noDuplicateObjectKeys)
- [`nursery/noEmptyInterface`](https://docs.rome.tools/lint/rules/noEmptyInterface)
- [`nursery/noExtraNonNullAssertion`](https://docs.rome.tools/lint/rules/noExtraNonNullAssertion)
- [`nursery/noHeaderScope`](https://docs.rome.tools/lint/rules/noHeaderScope)
- [`nursery/noNonNullAssertion`](https://docs.rome.tools/lint/rules/noNonNullAssertion)
- [`nursery/noPrecisionLoss`](https://docs.rome.tools/lint/rules/noPrecisionLoss)
- [`nursery/noRedundantUseStrict`](https://docs.rome.tools/lint/rules/noRedundantUseStrict)
- [`nursery/noSetterReturn`](https://docs.rome.tools/lint/rules/noSetterReturn)
- [`nursery/noStringCaseMismatch`](https://docs.rome.tools/lint/rules/noStringCaseMismatch)
- [`nursery/noUnsafeFinally`](https://docs.rome.tools/lint/rules/noUnsafeFinally)
- [`nursery/noVoidTypeReturn`](https://docs.rome.tools/lint/rules/noVoidTypeReturn)
- [`nursery/useDefaultSwitchClauseLast`](https://docs.rome.tools/lint/rules/useDefaultSwitchClauseLast)
- [`nursery/useNumericLiterals`](https://docs.rome.tools/lint/rules/useNumericLiterals)
- [`nursery/useAriaPropTypes`](https://docs.rome.tools/lint/rules/useAriaPropTypes)
- [`nursery/useAriaPropsForRole`](https://docs.rome.tools/lint/rules/useAriaPropsForRole)
- [`nursery/noVar`](https://docs.rome.tools/lint/rules/noVar)
- [`nursery/useConst`](https://docs.rome.tools/lint/rules/useConst)

Please give them a try by manually enabling them in your configuration and please share your feedback on the rule, diagnostics, and code fixes.

### Parser

- Added support for `JSON`;
- Added support `satisfies` keyword;
- Fixed parse for `async` used as label [#3612](https://github.com/rome/tools/issues/3612)
- Fixed parse of `export default function` in `d.ts` files [#3485](https://github.com/rome/tools/issues/3485)
- Improved the parsing of `await` in non-async contexts [#2479](https://github.com/rome/tools/issues/2479)

### VSCode

- Removed the "preview" label from the extension;

### JavaScript APIs

#### Breaking change

- The concept of `backend` has been removed, in favor of the concept of `distribution`.
- Removed the possibility to connect to the daemon, for the time being.
- The APIs are asynchronous anymore.

#### Other changes

- The package has been marked as unstable and in alpha state.

## 10.0.1

### CLI
Expand Down
2 changes: 1 addition & 1 deletion crates/rome_cli/src/commands/help.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const FORMAT_OPTIONS: Markup = markup! {
"<Dim>"--indent-style <tabs|space>"</Dim>" Change the indention character (default: tabs)
"<Dim>"--indent-size <number>"</Dim>" If the indentation style is set to spaces, determine how many spaces should be used for indentation (default: 2)
"<Dim>"--line-width <number>"</Dim>" Change how many characters the formatter is allowed to print in a single line (default: 80)
"<Dim>"--quote-style <single|double>"</Dim>" Changes the quotation character for strings (default: \")
"<Dim>"--quote-style <single|double>"</Dim>" Changes the quotation character for strings (default: double)
"<Dim>"--quote-properties <as-needed|preserve>"</Dim>" Changes when properties in object should be quoted (default: as-needed)
"<Dim>"--trailing-comma <all|es5|none>"</Dim>" Changes trailing commas in multi-line comma-separated syntactic structures (default: all)
"<Dim>"--semicolons <always|as-needed>"</Dim>" Changes when to print semicolons for statements (default: always)
Expand Down
14 changes: 14 additions & 0 deletions editors/vscode/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,20 @@ To format a text range, select the text you want to format, open the _Command Pa

Rome respects VS Code's _Format on Save_ setting. To enable format on save, open the settings (_File_ -> _Preferences_ -> _Settings_), search for `editor.formatOnSave`, and enable the option.

### Imports Sorting [Experimental]

The Rome VS Code extension has experimental support for imports sorting through the "Organize Imports" code action. By default this action can be run using the <kbd title="Shift">⇧</kbd>+<kbd>Alt</kbd>+<kbd>O</kbd> keyboard shortcut, or is accessible through the _Command Palette_ (<kbd>Ctrl</kbd>/<kbd title="Cmd">⌘</kbd>+<kbd title="Shift">⇧</kbd>+<kbd>P</kbd>) by selecting _Organize Imports_.

If you want this action to be run automatically when you save instead of having to call it manually, you can add the following to your editor configuration:

```json
{
"editor.codeActionsOnSave":{
"source.organizeImports.rome": true
}
}
```

## Extension Settings

### `rome.lspBin`
Expand Down
53 changes: 53 additions & 0 deletions website/src/pages/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,22 @@ Here's an example:

This configuration file enables the formatter and sets the preferred indent style and width. The linter is disabled.

## `$schema`

Allows to pass a path to a JSON schema file.

Since version `11.0.0`, a JSON schema file for the `rome.json` is published.

You can specify a relative path to the schema of the `rome` npm package if `rome` is installed in the `nodue_modules` folder:

<CodeBlockHeader filename="rome.json" />

```json
{
"$schema": "./node_modules/rome/configuration_schema.json"
}
```

## `files`

### `files.maxSize`
Expand All @@ -46,6 +62,21 @@ this limit will be ignored for performance reason.

> Default: 1024*1024 (1MB)

### `files.ignore`

A list of Unix shell style patterns. Rome ignores files and folders that
match these patterns.

<CodeBlockHeader filename="rome.json" />

```json
{
"files": {
"ignore": ["scripts/*.js"]
}
}
```

## `linter`

### `linter.enabled`
Expand Down Expand Up @@ -167,3 +198,25 @@ Print trailing commas wherever possible in multi-line comma-separated syntactic
- `none`, trailing commas are never added

> Default: `all`

### `javascript.formatter.semicolon`

It configures where the formatter prints semicolons:
- `always`, the semicolons is always added at the end of each statement;
- `as-needed`, the semicolons are added only in places where it's needed, to protect from [ASI](https://en.wikibooks.org/wiki/JavaScript/Automatic_semicolon_insertion)
Copy link
Contributor

@MichaReiser MichaReiser Dec 6, 2022

Choose a reason for hiding this comment

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

The value is asNeeded (only the cli option is as-needed).


> Default: `always`

Example:

<CodeBlockHeader filename="rome.json" />

```json
{
"javascript": {
"formatter": {
"semicolons": "asNeeded"
}
}
}
```
7 changes: 5 additions & 2 deletions website/src/pages/formatter/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,15 @@ USAGE:
OPTIONS:
--write Edit the files in place (beware!) instead of printing the diff to the console
--skip-errors Skip over files containing syntax errors instead of emitting an error diagnostic.
--indent-style <tab|space> Change the indention character (default: tab)
--max-diagnostics Cap the amount of diagnostics displayed (default: 50)
--verbose Print additional verbose advices on diagnostics
--indent-style <tabs|space> Change the indention character (default: tabs)
--indent-size <number> If the indentation style is set to spaces, determine how many spaces should be used for indentation (default: 2)
--line-width <number> Change how many characters the formatter is allowed to print in a single line (default: 80)
--quote-style <single|double> Changes the quotation character for strings (default: ")
--quote-style <single|double> Changes the quotation character for strings (default: double)
--quote-properties <as-needed|preserve> Changes when properties in object should be quoted (default: as-needed)
--trailing-comma <all|es5|none> Changes trailing commas in multi-line comma-separated syntactic structures (default: all)
--semicolons <always|as-needed> Changes when to print semicolons for statements (default: always)
--stdin-file-path <string> A file name with its extension to pass when reading from standard in, e.g. echo 'let a;' | rome format --stdin-file-path file.js
```

Expand Down
2 changes: 1 addition & 1 deletion website/src/pages/internals/language_support.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ description: Languages and features supported by Rome.
| [JavaScript](#javascript-support) | <span aria-label="Supported" role="img">✅</span> | <span aria-label="Supported" role="img">✅</span> | <span aria-label="Supported" role="img">✅</span> |
| [TypeScript](#typescript-support) | <span aria-label="Supported" role="img">✅</span> | <span aria-label="Supported" role="img">✅</span> | <span aria-label="Supported" role="img">✅</span> |
| JSX | <span aria-label="Supported" role="img">✅</span> | <span aria-label="Supported" role="img">✅</span> | <span aria-label="Supported" role="img">✅</span> |
| JSON | <span aria-label="Not in Progress" role="img">🚫</span> | <span aria-label="Not in Progress" role="img">🚫</span> | <span aria-label="Not in Progress" role="img">🚫</span> |
| JSON | <span aria-label="Supported" role="img"></span> | <span aria-label="In progress" role="img">💻</span> | <span aria-label="Not in Progress" role="img">🚫</span> |
| HTML | <span aria-label="Not in Progress" role="img">🚫</span> | <span aria-label="Not in Progress" role="img">🚫</span> | <span aria-label="Not in Progress" role="img">🚫</span> |
| CSS | <span aria-label="Not in progress" role="img">🚫</span> | <span aria-label="Not in Progress" role="img">🚫</span> | <span aria-label="Not in Progress" role="img">🚫</span> |
| Markdown | <span aria-label="Not in progress" role="img">🚫</span> | <span aria-label="Not in Progress" role="img">🚫</span> | <span aria-label="Not in Progress" role="img">🚫</span> |
Expand Down