diff --git a/CHANGELOG.md b/CHANGELOG.md index 82d084793412..cefa945e8c3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -99,6 +99,28 @@ Read our [guidelines for writing a good changelog entry](https://github.com/biom ### JavaScript APIs ### Linter +#### Promoted rules + +- [complexity/noExcessiveCognitiveComplexity](https://biomejs.dev/linter/rules/no-excessive-cognitive-complexity) +- [complexity/noVoid](https://biomejs.dev/linter/rules/no-void) +- [correctness/useExhaustiveDependencies](https://biomejs.dev/linter/rules/use-exhaustive-dependencies) +- [correctness/useHookAtTopLevel](https://biomejs.dev/linter/rules/use-hook-at-top-level) +- [performance/noAccumulatingSpread](https://biomejs.dev/linter/rules/no-accumulating-spread) +- [style/useCollapsedElseIf](https://biomejs.dev/linter/rules/use-collapsed-else-if) +- [suspicious/noConfusingVoidType](https://biomejs.dev/linter/rules/no-confusing-void-type) +- [suspicious/noFallthroughSwitchClause](https://biomejs.dev/linter/rules/no-fallthrough-switch-clause) +- [suspicious/noGlobalIsFinite](https://biomejs.dev/linter/rules/no-global-is-finite) +- [suspicious/noGlobalIsNan](https://biomejs.dev/linter/rules/no-global-is-nan) +- [suspicious/useIsArray](https://biomejs.dev/linter/rules/use-is-array) + +The following rules are now recommended: + +- [noAccumulatingSpread](https://biomejs.dev/linter/rules/) +- [noConfusingVoidType](https://biomejs.dev/linter/rules/no-confusing-void-type) +- [noFallthroughSwitchClause](https://biomejs.dev/linter/rules/no-fallthrough-switch-clause) +- [noForEach](https://biomejs.dev/linter/rules/no-for-each) + + #### Bug fixes - Fix [#243](https://github.com/biomejs/biome/issues/243) a false positive case where the incorrect scope was defined for the `infer` type. in rule [noUndeclaredVariables](https://biomejs.dev/linter/rules/no-undeclared-variables/). Contributed by @denbezrukov @@ -174,6 +196,8 @@ Read our [guidelines for writing a good changelog entry](https://github.com/biom - [useValidAriaProps](https://biomejs.dev/linter/rules/use-valid-aria-props) now provides an unsafe code fix that removes invalid properties. Contributed by @vasucp1207 +- `noExcessiveComplexity` was renamed to `noExcessiveCognitiveComplexity` + #### Bug fixes - Fix [#294](https://github.com/biomejs/biome/issues/294). [noConfusingVoidType](https://biomejs.dev/linter/rules/no-confusing-void-type/) no longer reports false positives for return types. Contributed by @b4s36t4 @@ -862,9 +886,9 @@ New rules are promoted, please check [#4750](https://github.com/rome/tools/discu The following rules are now recommended: -- [noUselessFragments](https://biomejs.dev/linter/rules/no-useless-fragments/) +**- [noUselessFragments](https://biomejs.dev/linter/rules/no-useless-fragments/) - [noRedundantUseStrict](https://biomejs.dev/linter/rules/no-redundant-use-strict/) -- [useExponentiationOperator](https://biomejs.dev/linter/rules/use-exponentiation-operator/) +- [useExponentiationOperator](https://biomejs.dev/linter/rules/use-exponentiation-operator/)** #### Other changes diff --git a/crates/biome_cli/tests/commands/check.rs b/crates/biome_cli/tests/commands/check.rs index 0a093b01bf26..807f67cabb38 100644 --- a/crates/biome_cli/tests/commands/check.rs +++ b/crates/biome_cli/tests/commands/check.rs @@ -2491,49 +2491,6 @@ array.map((sentence) => sentence.split(" ")).flat(); )); } -#[test] -fn should_not_enable_nursery_rules() { - let mut fs = MemoryFileSystem::default(); - let mut console = BufferConsole::default(); - - let configuration = r#" { - "organizeImports": { - "enabled": false - }, - "linter": { - "enabled": true, - "rules": { - "recommended": true, - "nursery": { - "noAccumulatingSpread": "error" - } - } - } -}"#; - - let configuration_path = Path::new("biome.json"); - fs.insert(configuration_path.into(), configuration.as_bytes()); - - let file_path = Path::new("fix.ts"); - fs.insert(file_path.into(), r#"let confusingVoidType: void;"#); - - let result = run_cli( - DynRef::Borrowed(&mut fs), - &mut console, - Args::from([("check"), file_path.as_os_str().to_str().unwrap()].as_slice()), - ); - - assert!(result.is_err(), "run_cli returned {result:?}"); - - assert_cli_snapshot(SnapshotPayload::new( - module_path!(), - "should_not_enable_nursery_rules", - fs, - console, - result, - )); -} - #[test] fn apply_bogus_argument() { let mut fs = MemoryFileSystem::default(); diff --git a/crates/biome_cli/tests/commands/lint.rs b/crates/biome_cli/tests/commands/lint.rs index 02536abf8913..bfc05eb9b78a 100644 --- a/crates/biome_cli/tests/commands/lint.rs +++ b/crates/biome_cli/tests/commands/lint.rs @@ -2101,49 +2101,6 @@ array.map((sentence) => sentence.split(" ")).flat(); )); } -#[test] -fn should_not_enable_nursery_rules() { - let mut fs = MemoryFileSystem::default(); - let mut console = BufferConsole::default(); - - let configuration = r#" { - "organizeImports": { - "enabled": false - }, - "linter": { - "enabled": true, - "rules": { - "recommended": true, - "nursery": { - "noAccumulatingSpread": "error" - } - } - } -}"#; - - let configuration_path = Path::new("biome.json"); - fs.insert(configuration_path.into(), configuration.as_bytes()); - - let file_path = Path::new("fix.ts"); - fs.insert(file_path.into(), r#"let confusingVoidType: void;"#); - - let result = run_cli( - DynRef::Borrowed(&mut fs), - &mut console, - Args::from([("lint"), file_path.as_os_str().to_str().unwrap()].as_slice()), - ); - - assert!(result.is_ok(), "run_cli returned {result:?}"); - - assert_cli_snapshot(SnapshotPayload::new( - module_path!(), - "should_not_enable_nursery_rules", - fs, - console, - result, - )); -} - #[test] fn apply_bogus_argument() { let mut fs = MemoryFileSystem::default(); diff --git a/crates/biome_cli/tests/snapshots/main_commands_check/should_not_enable_nursery_rules.snap b/crates/biome_cli/tests/snapshots/main_commands_check/should_not_enable_nursery_rules.snap deleted file mode 100644 index 1f47cbf8f66b..000000000000 --- a/crates/biome_cli/tests/snapshots/main_commands_check/should_not_enable_nursery_rules.snap +++ /dev/null @@ -1,67 +0,0 @@ ---- -source: crates/biome_cli/tests/snap_test.rs -expression: content ---- -## `biome.json` - -```json -{ - "organizeImports": { - "enabled": false - }, - "linter": { - "enabled": true, - "rules": { - "recommended": true, - "nursery": { - "noAccumulatingSpread": "error" - } - } - } -} -``` - -## `fix.ts` - -```ts -let confusingVoidType: void; -``` - -# Termination Message - -```block -check ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Some errors were emitted while running checks. - - - -``` - -# Emitted Messages - -```block -fix.ts format ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - i Formatter would have printed the following content: - - 1 │ - let·confusingVoidType:·void; - 1 │ + let·confusingVoidType:·void; - 2 │ + - - -``` - -```block -fix.ts check ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × The file contains diagnostics that needs to be addressed. - - -``` - -```block -Checked 1 file(s) in