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

Commit

Permalink
release: 12.1.0 (#4344)
Browse files Browse the repository at this point in the history
  • Loading branch information
ematipico authored May 13, 2023
1 parent 5fa5dd1 commit 22ce6c6
Show file tree
Hide file tree
Showing 101 changed files with 2,286 additions and 1,763 deletions.
1 change: 1 addition & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ codegen = "run -p xtask_codegen --"
codegen-configuration = "run -p xtask_codegen --features configuration -- configuration"
codegen-schema = "run -p xtask_codegen --features schema -- schema"
codegen-bindings = "run -p xtask_codegen --features schema -- bindings"
codegen-website = "run -p xtask_codegen --features website -- website"
lintdoc = "run -p xtask_lintdoc --"
documentation = """
doc \
Expand Down
3 changes: 2 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ crates/rome_js_analyze/src/semantic_analyzers/*.rs linguist-generated=true text=
crates/rome_js_analyze/src/registry.rs linguist-generated=true text=auto eol=lf
crates/rome_service/src/configuration/linter/rules.rs linguist-generated=true text=auto eol=lf
npm/backend-jsonrpc/src/workspace.ts linguist-generated=true text=auto eol=lf
website/src/docs/lint/rules/**/*.md linguist-generated=true text=auto eol=lf
website/src/pages/lint/rules/**/*.md linguist-generated=true text=auto eol=lf
website/src/components/generated/.astro linguist-generated=true text=auto eol=lf
npm/rome/configuration_schema.json linguist-generated=true text=auto eol=lf
editors/vscode/configuration_schema.json linguist-generated=true text=auto eol=lf
crates/rome_service/src/configuration/parse/json/rules.rs linguist-generated=true text=auto eol=lf
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,9 @@ jobs:
- name: Run the bindings codegen
run: cargo codegen-bindings
- name: Run the website codegen
run: cargo lintdoc
run: |
cargo lintdoc
cargo codegen-website
- name: Check for git diff
run: |
if [[ `git status --porcelain` ]]; then
Expand Down
109 changes: 64 additions & 45 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

## [Unreleased]

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

## 12.1.0

### CLI

#### Other changes
Expand All @@ -10,21 +21,61 @@
output. [#4405](https://github.com/rome/tools/pull/4405).
- The command `rome check` can accept input from `stdin`.
- Add the argument `--stdin-file-path` to use when running `rome check` via `stdin`.
- Add the argument `--formatter-enabled` to control the formatter via CLI.
- Add the argument `--linter-enabled` to control the linter via CLI.
- Add the argument `--organize-imports-enabled` to control the import sorting via CLI.
- Add the argument `--formatter-enabled` to the command `rome check` to control the formatter via CLI.
- Add the argument `--linter-enabled` to the command `rome check` to control the linter via CLI.
- Add the argument `--organize-imports-enabled` to the command `rome check` to control the import sorting via CLI.
- Add new command `rome migrate` the transform the configuration file `rome.json`
when there are breaking changes.

### Configuration

- Add `vcs` property, to opt in the VCS integration:
- `vcs.enabled`, to enable or not the integration;
- `vcs.clientKind`, the supported clients;
- `vcs.useIgnoreFile`, to ignore the files/paths inside the file;
- `vcs.root`, an optional path to the root of the VCS;

### Editors

#### Other changes

- Fix an issue where the VSCode extension duplicates text when using VSCode git utilities [#4338](https://github.com/rome/tools/issues/4338)
- Remove code assists from being added to the code actions when apply fixes;
- When requesting code actions, ignored files should not throw errors. Fixes [#4434](https://github.com/rome/tools/issues/4434)

### Formatter

#### Other changes

- Fix an issue where formatting of JSX string literals property values were using incorrect quotes [#4054](https://github.com/rome/tools/issues/4054)
- Changed import assertion grammar to the new import attribute assertion
```diff
- import "module" assert {}
+ import "module" with {}
```
- Fix an issue where JSON formatter does not respect `lineWidth` for arrays [#4351](https://github.com/rome/tools/issues/4351)
- Add support for decorators

### Linter

#### New rules

- [`noConfusingArrow`](https://docs.rome.tools/lint/rules/noConfusingArrow/)
- [`noRedundantRoles`](https://docs.rome.tools/lint/rules/noRedundantRoles/)
- [`noNoninteractiveTabindex`](https://docs.rome.tools/lint/rules/noNoninteractiveTabindex/)
- [`noAriaUnsupportedElements`](https://docs.rome.tools/lint/rules/noAriaUnsupportedElements/)
- [`noConsoleLog`](https://docs.rome.tools/lint/rules/noConsoleLog/)
- [`noForEach`](https://docs.rome.tools/lint/rules/noForEach/)
- [`useLiteralKeys`](https://docs.rome.tools/lint/rules/useLiteralKeys/)
- [`noConstantCondition`](https://docs.rome.tools/lint/rules/noConstantCondition/)
- [`useGroupedTypeImport`](https://docs.rome.tools/lint/rules/useGroupedTypeImport/)
- [`noUselessConstructor`](https://docs.rome.tools/lint/rules/noUselessConstructor/)
- [`useLiteralEnumMembers`](https://docs.rome.tools/lint/rules/useLiteralEnumMembers/)
- [`useHeadingContent`](https://docs.rome.tools/lint/rules/useHeadingContent/)
- [`noAccumulatingSpread`](https://docs.rome.tools/lint/rules/noAccumulatingSpread/)
- [`useSimpleNumberKeys`](https://docs.rome.tools/lint/rules/useSimpleNumberKeys/)


#### Promoted rules

New rules are promoted, please check [#4431](https://github.com/rome/tools/pull/4431) for more details.
Expand Down Expand Up @@ -72,8 +123,12 @@ Note that, `noExtraSemicolons` and `noExtraLabels` are renamed to `noExtraSemico

#### Other changes

- Add new command `rome migrate` the transform the configuration file `rome.json`
when there are breaking changes.
- Code actions are formatted using Rome's formatter. If the formatter is disabled,
the code action is not formatted.
- Fixed an issue that [`useShorthandArrayType`](https://docs.rome.tools/lint/rules/useShorthandArrayType) rule did not handle nested ReadonlyArray types correctly and erroneously reported TsObjectType [#4354](https://github.com/rome/tools/issues/4353).
- [`noUndeclaredVariables`](https://docs.rome.tools/lint/rules/noUndeclaredVariables) detects globals based on the file type.
- Fix an issue when `noUndeclaredVariables` incorrectly identifies `AggregateError` as an undeclared variable. [#4365](https://github.com/rome/tools/issues/4365)
- Fix an issue that `useLiteralKeys` rule doesn't ignore valid uses of square bracket notation. [#4370](https://github.com/rome/tools/issues/4370)
- Fix [#4348](https://github.com/rome/tools/issues/4348) that caused [`noNonNullAssertion`](https://docs.rome.tools/lint/rules/nononnullassertion/) to emit incorrect code action
- Fix [#4410](https://github.com/rome/tools/issues/4410) that caused [`useButtonType`](https://docs.rome.tools/lint/rules/usebuttontype/) to miss some cases
- Fix false positive diagnostics that [`useCamelCase`](https://docs.rome.tools/lint/rules/usecamelcase/) caused to default exported components
Expand All @@ -83,59 +138,23 @@ when there are breaking changes.
- Fix false positive diagnostics that [`noHeadeScope`](https://docs.rome.tools/lint/rules/noheaderscope/) caused to custom components
- Fix false negative diagnostics that [`noNoninteractiveElementToInteractiveRole`](https://docs.rome.tools/lint/rules/nononinteractiveelementtointeractiverole/) and [`noNoninteractiveTabindex`](https://docs.rome.tools/lint/rules/nononinteractivetabindex/) caused to non-interactive elements.

### Configuration
### Editors

#### Other changes

- Fix an issue where the VSCode extension duplicates text when using VSCode git utilities [#4338](https://github.com/rome/tools/issues/4338)
- Remove code assists from being added to the code actions when apply fixes;
- When requesting code actions, ignored files should not throw errors. Fixes [#4434](https://github.com/rome/tools/issues/4434)


### Formatter

- Fix an issue where formatting of JSX string literals property values were using incorrect quotes [#4054](https://github.com/rome/tools/issues/4054)
- Changed import assertion grammar to the new import attribute assertion
```diff
- import "module" assert {}
+ import "module" with {}
```
- Fix an issue where JSON formatter does not respect `lineWidth` for arrays [#4351](https://github.com/rome/tools/issues/4351)

### Linter
### Parser

#### Other changes

- Code actions are formatted using Rome's formatter. If the formatter is disabled,
the code action is not formatted.
- Fixed an issue that [`useShorthandArrayType`](https://docs.rome.tools/lint/rules/useShorthandArrayType) rule did not handle nested ReadonlyArray types correctly and erroneously reported TsObjectType [#4354](https://github.com/rome/tools/issues/4353).
- [`noUndeclaredVariables`](https://docs.rome.tools/lint/rules/noUndeclaredVariables) detects globals based on the file type.
- Fix an issue when `noUndeclaredVariables` incorrectly identifies `AggregateError` as an undeclared variable. [#4365](https://github.com/rome/tools/issues/4365)
- Fix an issue that `useLiteralKeys` rule doesn't ignore valid uses of square bracket notation. [#4370](https://github.com/rome/tools/issues/4370)

#### New rules
- [`noConfusingArrow`](https://docs.rome.tools/lint/rules/noConfusingArrow/)
- [`noRedundantRoles`](https://docs.rome.tools/lint/rules/noRedundantRoles/)
- [`noNoninteractiveTabindex`](https://docs.rome.tools/lint/rules/noNoninteractiveTabindex/)
- [`noAriaUnsupportedElements`](https://docs.rome.tools/lint/rules/noAriaUnsupportedElements/)
- [`noConsoleLog`](https://docs.rome.tools/lint/rules/noConsoleLog/)
- [`noForEach`](https://docs.rome.tools/lint/rules/noForEach/)
- [`useLiteralKeys`](https://docs.rome.tools/lint/rules/useLiteralKeys/)
- [`noConstantCondition`](https://docs.rome.tools/lint/rules/noConstantCondition/)

### Parser

- Allow module syntax in `cts` files
- Changed import assertion grammar to the new import attribute assertion
```diff
- import "module" assert {}
+ import "module" with {}
```
- Allow decorators before `export` and `export default`. [#4252](https://github.com/rome/tools/issues/4252)
- Add support for Stage 3 decorators

### VSCode
### JavaScript APIs

- `requireConfiguration` is set to `true` by default

## 12.0.0

Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ edition = "2021"
authors = ["Rome Tools Developers and Contributors"]
license = "MIT"
repository = "https://github.com/rome/tools"
homepage = "https://rome.tools"

[profile.release-with-debug]
inherits = "release"
Expand Down
8 changes: 4 additions & 4 deletions crates/rome_analyze/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[package]
name = "rome_analyze"
version = "0.0.0"
edition = { workspace = true }
authors = { workspace = true }
repository = { workspace = true }
license = { workspace = true }
edition.workspace = true
authors.workspace = true
repository.workspace = true
license.workspace = true

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
8 changes: 4 additions & 4 deletions crates/rome_aria/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[package]
name = "rome_aria"
version = "0.0.0"
edition = { workspace = true }
authors = { workspace = true }
repository = { workspace = true }
license = { workspace = true }
edition.workspace = true
authors.workspace = true
repository.workspace = true
license.workspace = true

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
8 changes: 4 additions & 4 deletions crates/rome_aria_metadata/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[package]
name = "rome_aria_metadata"
version = "0.0.0"
edition = { workspace = true }
authors = { workspace = true }
repository = { workspace = true }
license = { workspace = true }
edition.workspace = true
authors.workspace = true
repository.workspace = true
license.workspace = true

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
8 changes: 4 additions & 4 deletions crates/rome_cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[package]
name = "rome_cli"
version = "0.0.0"
edition = { workspace = true }
authors = { workspace = true }
repository = { workspace = true }
license = { workspace = true }
edition.workspace = true
authors.workspace = true
repository.workspace = true
license.workspace = true

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[[bin]]
Expand Down
3 changes: 2 additions & 1 deletion crates/rome_cli/src/execute/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ impl Execution {
}
}

#[derive(Debug)]
pub(crate) enum TraversalMode {
/// This mode is enabled when running the command `rome check`
Check {
Expand Down Expand Up @@ -207,7 +208,7 @@ pub(crate) fn execute_mode(
// don't do any traversal if there's some content coming from stdin
if let Some((path, content)) = mode.as_stdin_file() {
let rome_path = RomePath::new(path);
std_in::run(session, &mode, rome_path, content.as_str())
std_in::run(session, &mode, rome_path, content.as_str(), cli_options)
} else if let TraversalMode::Migrate {
write,
configuration_path,
Expand Down
53 changes: 44 additions & 9 deletions crates/rome_cli/src/execute/std_in.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@ use crate::{CliDiagnostic, CliSession};
use rome_console::{markup, ConsoleExt};
use rome_fs::RomePath;

use crate::cli_options::CliOptions;
use crate::execute::diagnostics::{ContentDiffAdvice, FormatDiffDiagnostic};
use rome_diagnostics::{PrintDiagnostic, MAXIMUM_DISPLAYABLE_DIAGNOSTICS};
use rome_service::workspace::{
ChangeFileParams, FeatureName, FeaturesBuilder, FixFileParams, FormatFileParams, Language,
OpenFileParams, OrganizeImportsParams, SupportsFeatureParams,
OpenFileParams, OrganizeImportsParams, PullDiagnosticsParams, RuleCategories,
SupportsFeatureParams,
};
use std::borrow::Cow;

Expand All @@ -16,6 +20,7 @@ pub(crate) fn run<'a>(
mode: &'a Execution,
rome_path: RomePath,
content: &'a str,
cli_options: &CliOptions,
) -> Result<(), CliDiagnostic> {
let workspace = &*session.app.workspace;
let console = &mut *session.app.console;
Expand Down Expand Up @@ -47,6 +52,7 @@ pub(crate) fn run<'a>(
})
}
} else if mode.is_check() {
let mut diagnostics = Vec::new();
let mut new_content = Cow::Borrowed(content);

workspace.open_file(OpenFileParams {
Expand Down Expand Up @@ -96,25 +102,54 @@ pub(crate) fn run<'a>(
}
}
}

if !mode.is_check_apply_unsafe() {
let result = workspace.pull_diagnostics(PullDiagnosticsParams {
categories: RuleCategories::LINT | RuleCategories::SYNTAX,
path: rome_path.clone(),
max_diagnostics: cli_options
.max_diagnostics
.unwrap_or(MAXIMUM_DISPLAYABLE_DIAGNOSTICS)
as u64,
})?;
diagnostics.extend(result.diagnostics);
}

if file_features.supports_for(&FeatureName::Format) {
let printed = workspace.format_file(FormatFileParams { path: rome_path })?;
if printed.as_code() != new_content {
new_content = Cow::Owned(printed.into_code());
let printed = workspace.format_file(FormatFileParams {
path: rome_path.clone(),
})?;
if mode.is_check_apply() || mode.is_check_apply_unsafe() {
if printed.as_code() != new_content {
new_content = Cow::Owned(printed.into_code());
}
} else {
let diagnostic = FormatDiffDiagnostic {
file_name: &rome_path.display().to_string(),
diff: ContentDiffAdvice {
new: printed.as_code(),
old: content,
},
};
diagnostics.push(rome_diagnostics::serde::Diagnostic::new(diagnostic));
}
}

match new_content {
Cow::Borrowed(original) => {
console.append(markup! {
{original}
});
}
Cow::Borrowed(_) => {}
Cow::Owned(new_content) => {
console.append(markup! {
{new_content}
});
}
}
if !diagnostics.is_empty() {
for diag in diagnostics {
console.error(markup! {
{PrintDiagnostic::simple(&diag)}
})
}
}
}
Ok(())
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ Available options:
--vcs-use-ignore-file <true|false> Whether Rome should use the VCS ignore file. When [true],
Rome will ignore the files specified in the ignore file.
--vcs-root <PATH> The folder where Rome should check for VCS files. By default, Rome will
use the same folder where `rome.json` was found. If Rome can't fine the
use the same folder where `rome.json` was found. If Rome can't find the
configuration, it will attempt to use the current working directory. If no
current working directory can't be found, Rome won't use the VCS integration.
current working directory can't be found, Rome won't use the VCS integration,
and a diagnostic will be emitted
--files-max-size <NUMBER> The maximum allowed size for source code files in bytes. Files
above this limit will be ignored for performance reason. Defaults to 1 MiB
--indent-style <tab|space> The indent style.
Expand Down
5 changes: 3 additions & 2 deletions crates/rome_cli/tests/snapshots/main_commands_ci/ci_help.snap
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ Available options:
--vcs-use-ignore-file <true|false> Whether Rome should use the VCS ignore file. When [true],
Rome will ignore the files specified in the ignore file.
--vcs-root <PATH> The folder where Rome should check for VCS files. By default, Rome will
use the same folder where `rome.json` was found. If Rome can't fine the
use the same folder where `rome.json` was found. If Rome can't find the
configuration, it will attempt to use the current working directory. If no
current working directory can't be found, Rome won't use the VCS integration.
current working directory can't be found, Rome won't use the VCS integration,
and a diagnostic will be emitted
--files-max-size <NUMBER> The maximum allowed size for source code files in bytes. Files
above this limit will be ignored for performance reason. Defaults to 1 MiB
--indent-style <tab|space> The indent style.
Expand Down
Loading

0 comments on commit 22ce6c6

Please sign in to comment.