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

fix(rome_service): correctly load recommended rules #4490

Merged
merged 1 commit into from
May 17, 2023
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
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,18 @@


### Configuration

#### Other changes

- Fix an issue where Rome was loading incorrectly recommended rule [#4479](https://github.com/rome/tools/issues/4479) [#4488](https://github.com/rome/tools/issues/4488)

### Editors
### Formatter
### Linter

#### Other changes

- Fixed an issue where the `noAssignInExpressions` rule replaced the operator with an invalid token, which caused other lint rules to crash. [#4464](https://github.com/rome/tools/issues/4464)
- Fix an issue where the `noAssignInExpressions` rule replaced the operator with an invalid token, which caused other lint rules to crash. [#4464](https://github.com/rome/tools/issues/4464)
- Fix an issue that [`noUnusedVariables`](https://docs.rome.tools/lint/rules/nounusedvariables/) rule did not correctly detect exports when a variable and an `interface` had the same name [#4468](https://github.com/rome/tools/pull/4468)

### Parser
Expand Down
58 changes: 58 additions & 0 deletions crates/rome_cli/tests/commands/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2112,3 +2112,61 @@ fn apply_unsafe_no_assign_in_expression() {
result,
));
}

#[test]
fn should_not_enable_all_recommended_rules() {
let mut fs = MemoryFileSystem::default();
let mut console = BufferConsole::default();

let configuration = r#" {
"$schema": "https://docs.rome.tools/schemas/12.1.0/schema.json",
"organizeImports": {
"enabled": false
},
"linter": {
"enabled": true,
"rules": {
"recommended": false,
"a11y": {},
"complexity": {},
"correctness": {},
"performance": {},
"security": {},
"style": {},
"suspicious": {}
}
}
}"#;

let configuration_path = Path::new("rome.json");
fs.insert(configuration_path.into(), configuration.as_bytes());

let file_path = Path::new("fix.js");
fs.insert(
file_path.into(),
r#"
LOOP: for (const x of xs) {
if (x > 0) {
break;
}
f(x);
}
"#,
);

let result = run_cli(
DynRef::Borrowed(&mut fs),
&mut console,
Args::from(&[("check"), file_path.as_os_str().to_str().unwrap()]),
);

assert!(result.is_ok(), "run_cli returned {result:?}");

assert_cli_snapshot(SnapshotPayload::new(
module_path!(),
"should_not_enable_all_recommended_rules",
fs,
console,
result,
));
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
source: crates/rome_cli/tests/snap_test.rs
expression: content
---
## `rome.json`

```json
{
"$schema": "https://docs.rome.tools/schemas/12.1.0/schema.json",
"organizeImports": {
"enabled": false
},
"linter": {
"enabled": true,
"rules": {
"recommended": false,
"a11y": {},
"complexity": {},
"correctness": {},
"performance": {},
"security": {},
"style": {},
"suspicious": {}
}
}
}
```

## `fix.js`

```js

LOOP: for (const x of xs) {
if (x > 0) {
break;
}
f(x);
}

```

# Emitted Messages

```block
Checked 1 file(s) in <TIME>
```


Loading
Loading