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 1 commit
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
Prev Previous commit
Next Next commit
chore: add semicolon and schema options
  • Loading branch information
ematipico committed Nov 30, 2022
commit f3a3def4fef912e459820bcb80b9ac3336d61742
8 changes: 2 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
- the new global argument `--colors` now accepts `force`, useful to force colors when
Rome is spawned as a process;




### Configuration

- Added a `$schema` property, where users can add the JSON schema. This feature provides
Expand All @@ -46,7 +43,7 @@
- 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)
- [#3824])https://github.com/rome/tools/pull/3824)
- [#3824](https://github.com/rome/tools/pull/3824)
- Fixed an issue where infinite parentheses were wrongly inserted [#3735](https://github.com/rome/tools/issues/3735)
- Better formatting for `jestEach` templates

Expand Down Expand Up @@ -96,7 +93,7 @@
### Parser

- Added support for `JSON`;
- Added support satisfiesifies` keyword;
- 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)
Expand All @@ -118,7 +115,6 @@
- The APIs are asynchronous anymore.



## 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
54 changes: 54 additions & 0 deletions website/src/pages/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,23 @@ 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.

If you installed Rome via a package manager and present inside the
`node_modules` folder, you can add it like this:

<CodeBlockHeader filename="rome.json" />

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

## `files`

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

> Default: 1024*1024 (1MB)

### `files.ignore`

A list of Unix shell style patterns. Rome tools will ignore files/folders that will
match these patterns

<CodeBlockHeader filename="rome.json" />

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

## `linter`

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

> Default: `all`

### `javascript.formatter.semicolon`

Print trailing commas wherever possible in multi-line comma-separated syntactic structures. Possible values:
- `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