Skip to content

Commit

Permalink
release: v1.7.0 (#2414)
Browse files Browse the repository at this point in the history
Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
Co-authored-by: Ze-Zheng Wu <zezhengwu@proton.me>
Co-authored-by: Superchupu <53496941+SuperchupuDev@users.noreply.github.com>
  • Loading branch information
4 people committed Apr 15, 2024
1 parent f38b99e commit 2dce6af
Show file tree
Hide file tree
Showing 164 changed files with 4,889 additions and 1,270 deletions.
48 changes: 45 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ New entries must be placed in a section entitled `Unreleased`.
Read
our [guidelines for writing a good changelog entry](https://github.com/biomejs/biome/blob/main/CONTRIBUTING.md#changelog).

## Unreleased
## 1.7.0 (2024-04-15)

### Analyzer

Expand Down Expand Up @@ -205,6 +205,18 @@ our [guidelines for writing a good changelog entry](https://github.com/biomejs/b
- Support `overrides` field in Prettier configuration files when migrating from Prettier.
Contributed by @Conaclos

- Support passing a file path to the `--config-path` flag or the `BIOME_CONFIG_PATH` environment variable.

Now you can pass a `.json`/`.jsonc` file path with any filename to the `--config-path` flag or the
`BIOME_CONFIG_PATH` environment variable. This will disable the configuration auto-resolution and Biome
will try to read the configuration from the said file path ([#2265](https://github.com/biomejs/biome/issues/2265)).

```shell
biome format --config-path=../biome.json ./src
```

Contributed by @Sec-ant

#### Bug fixes

- Biome now tags the diagnostics emitted by `organizeImports` and `formatter` with correct severity levels, so they will be properly filtered by the flag `--diagnostic-level` ([#2288](https://github.com/biomejs/biome/issues/2288)). Contributed by @Sec-ant
Expand All @@ -213,6 +225,8 @@ our [guidelines for writing a good changelog entry](https://github.com/biomejs/b

- Biome now skips traversing `fifo` or `socket` files ([#2311](https://github.com/biomejs/biome/issues/2311)). Contributed by @Sec-ant

- Biome now resolves configuration files exported from external libraries in `extends` from the working directory (CLI) or project root (LSP). This is the documented behavior and previous resolution behavior is considered as a bug ([#2231](https://github.com/biomejs/biome/issues/2231)). Contributed by @Sec-ant

### Configuration

#### Bug fixes
Expand Down Expand Up @@ -273,6 +287,25 @@ our [guidelines for writing a good changelog entry](https://github.com/biomejs/b

### Linter

#### Promoted rules

New rules are incubated in the nursery group.
Once stable, we promote them to a stable group.
The following rules are promoted:

- [complecity/noExcessiveNestedTestSuites](https://biomejs.dev/linter/rules/no-excessive-nested-test-suites)
- [complexity/noUselessTernary](https://biomejs.dev/linter/rules/no-useless-ternary)
- [correctness/useJsxKeyInIterable](https://biomejs.dev/linter/rules/use-jsx-key-in-iterable)
- [performance/noBarrelFile](https://biomejs.dev/linter/rules/no-barrel-file/)
- [performance/noReExportAll](https://biomejs.dev/linter/rules/no-re-export-all/)
- [style/noNamespaceImport](https://biomejs.dev/linter/rules/no-namespace-import/)
- [style/useNodeAssertStrict](https://biomejs.dev/linter/rules/use-node-assert-strict/)
- [suspicious/noDuplicateTestHooks](https://biomejs.dev/linter/rules/no-duplicate-test-hooks/)
- [suspicious/noExportsInTest](https://biomejs.dev/linter/rules/no-exports-in-test/)
- [suspicious/noFocusedTests](https://biomejs.dev/linter/rules/no-focused-tests/)
- [suspicious/noSkippedTests](https://biomejs.dev/linter/rules/no-skipped-tests/)
- [suspicious/noSuspiciousSemicolonInJsx](https://biomejs.dev/linter/rules/no-suspicious-semicolon-in-jsx)

#### New features

- Add a new option `jsxRuntime` to the `javascript` configuration. When set to `reactClassic`, the [noUnusedImports](https://biomejs.dev/linter/rules/no-unused-imports) and [useImportType](https://biomejs.dev/linter/rules/use-import-type) rules use this information to make exceptions for the React global that is required by the React Classic JSX transform.
Expand Down Expand Up @@ -345,7 +378,7 @@ our [guidelines for writing a good changelog entry](https://github.com/biomejs/b
Contributed by @arendjr


## 1.6.4 (2022-04-03)
## 1.6.4 (2024-04-03)

### Analyzer

Expand Down Expand Up @@ -625,7 +658,6 @@ our [guidelines for writing a good changelog entry](https://github.com/biomejs/b
<div></div>
```

- Add lint rule useJsxKeyInIterable from Eslint rule [`react/jsx-key`](https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-key.md). Contributed by @vohoanglong0107
- The analyzer now **infers** the correct quote from `javascript.formatter.quoteStyle`, if set. This means that code fixes suggested by the analyzer will use the same quote of the formatter. Contributed by @ematipico

#### Enhancements
Expand Down Expand Up @@ -788,6 +820,7 @@ our [guidelines for writing a good changelog entry](https://github.com/biomejs/b
```
Contributed by @ematipico

- Fix [#1774](https://github.com/biomejs/biome/issues/1774) by taking into account the option `--no-errors-on-unmatched` when running the CLI using `--changed`. Contributed by @antogyn

#### Enhancements
Expand Down Expand Up @@ -1074,6 +1107,15 @@ Additionally, the following rules are now recommended:
```
Contributed by @togami2864

- Add rule [noReExportAll](https://biomejs.dev/linter/rules/no-re-export-all/) that report `export * from "mod"`.
Contributed by @mdm317

- Add rule [noExcessiveNestedTestSuites](https://biomejs.dev/linter/rules/no-excessive-nested-test-suites/).
Contributed by @vasucp1207

- Add rule [useJsxKeyInIterable](https://biomejs.dev/linter/rules/use-jsx-key-in-iterable/).
Contributed by @vohoanglong0107

#### Enhancements

- [noUselessFragments](https://biomejs.dev/linter/rules/no-useless-fragments/) now rule not triggered for jsx attributes when
Expand Down
13 changes: 7 additions & 6 deletions crates/biome_cli/src/cli_options.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::logging::LoggingKind;
use crate::LoggingLevel;
use biome_configuration::ConfigurationBasePath;
use biome_configuration::ConfigurationPathHint;
use biome_diagnostics::Severity;
use bpaf::Bpaf;
use std::fmt::{Display, Formatter};
Expand All @@ -22,7 +22,8 @@ pub struct CliOptions {
#[bpaf(long("verbose"), switch, fallback(false))]
pub verbose: bool,

/// Set the directory of the biome.json or biome.jsonc configuration file and disable default configuration file resolution.
/// Set the file path to the configuration file, or the directory path to find `biome.json` or `biome.jsonc`.
/// If used, it disables the default configuration file resolution.
#[bpaf(long("config-path"), argument("PATH"), optional)]
pub config_path: Option<String>,

Expand Down Expand Up @@ -86,11 +87,11 @@ pub struct CliOptions {
}

impl CliOptions {
/// Computes the [ConfigurationBasePath] based on the options passed by the user
pub(crate) fn as_configuration_base_path(&self) -> ConfigurationBasePath {
/// Computes the [ConfigurationPathHint] based on the options passed by the user
pub(crate) fn as_configuration_path_hint(&self) -> ConfigurationPathHint {
match self.config_path.as_ref() {
None => ConfigurationBasePath::default(),
Some(path) => ConfigurationBasePath::FromUser(PathBuf::from(path)),
None => ConfigurationPathHint::default(),
Some(path) => ConfigurationPathHint::FromUser(PathBuf::from(path)),
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_cli/src/commands/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ pub(crate) fn check(
};

let loaded_configuration =
load_configuration(&session.app.fs, cli_options.as_configuration_base_path())?;
load_configuration(&session.app.fs, cli_options.as_configuration_path_hint())?;
validate_configuration_diagnostics(
&loaded_configuration,
session.app.console,
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_cli/src/commands/ci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub(crate) fn ci(session: CliSession, payload: CiCommandPayload) -> Result<(), C
setup_cli_subscriber(cli_options.log_level, cli_options.log_kind);

let loaded_configuration =
load_configuration(&session.app.fs, cli_options.as_configuration_base_path())?;
load_configuration(&session.app.fs, cli_options.as_configuration_path_hint())?;

validate_configuration_diagnostics(
&loaded_configuration,
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_cli/src/commands/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pub(crate) fn format(
setup_cli_subscriber(cli_options.log_level, cli_options.log_kind);

let loaded_configuration =
load_configuration(&session.app.fs, cli_options.as_configuration_base_path())?;
load_configuration(&session.app.fs, cli_options.as_configuration_path_hint())?;
validate_configuration_diagnostics(
&loaded_configuration,
session.app.console,
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_cli/src/commands/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pub(crate) fn lint(session: CliSession, payload: LintCommandPayload) -> Result<(
};

let loaded_configuration =
load_configuration(&session.app.fs, cli_options.as_configuration_base_path())?;
load_configuration(&session.app.fs, cli_options.as_configuration_path_hint())?;
validate_configuration_diagnostics(
&loaded_configuration,
session.app.console,
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_cli/src/commands/migrate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub(crate) fn migrate(
write: bool,
sub_command: Option<MigrateSubCommand>,
) -> Result<(), CliDiagnostic> {
let base_path = cli_options.as_configuration_base_path();
let base_path = cli_options.as_configuration_path_hint();
let LoadedConfiguration {
configuration: _,
diagnostics: _,
Expand Down
11 changes: 7 additions & 4 deletions crates/biome_cli/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ pub enum BiomeCommand {
/// Start the Biome daemon server process
#[bpaf(command)]
Start(
/// Allows to set a custom path when discovering the configuration file `biome.json`
/// Allows to set a custom file path to the configuration file,
/// or a custom directory path to find `biome.json` or `biome.jsonc`
#[bpaf(env("BIOME_CONFIG_PATH"), long("config-path"), argument("PATH"))]
Option<PathBuf>,
),
Expand Down Expand Up @@ -271,7 +272,8 @@ pub enum BiomeCommand {
/// Acts as a server for the Language Server Protocol over stdin/stdout
#[bpaf(command("lsp-proxy"))]
LspProxy(
/// Allows to set a custom path when discovering the configuration file `biome.json`
/// Allows to set a custom file path to the configuration file,
/// or a custom directory path to find `biome.json` or `biome.jsonc`
#[bpaf(env("BIOME_CONFIG_PATH"), long("config-path"), argument("PATH"))]
Option<PathBuf>,
/// Bogus argument to make the command work with vscode-languageclient
Expand Down Expand Up @@ -348,7 +350,8 @@ pub enum BiomeCommand {
RunServer {
#[bpaf(long("stop-on-disconnect"), hide_usage)]
stop_on_disconnect: bool,
/// Allows to set a custom path when discovering the configuration file `biome.json`
/// Allows to set a custom file path to the configuration file,
/// or a custom directory path to find `biome.json` or `biome.jsonc`
#[bpaf(env("BIOME_CONFIG_PATH"), long("config-path"), argument("PATH"))]
config_path: Option<PathBuf>,
},
Expand Down Expand Up @@ -482,7 +485,7 @@ fn resolve_manifest(cli_session: &CliSession) -> Result<(), WorkspaceError> {
let workspace = &*cli_session.app.workspace;

let result = fs.auto_search(
fs.working_directory().unwrap_or_default(),
&fs.working_directory().unwrap_or_default(),
&["package.json"],
false,
)?;
Expand Down
4 changes: 2 additions & 2 deletions crates/biome_cli/src/commands/rage.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use biome_configuration::ConfigurationBasePath;
use biome_configuration::ConfigurationPathHint;
use biome_console::fmt::{Display, Formatter};
use biome_console::{fmt, markup, ConsoleExt, HorizontalLine, Markup};
use biome_diagnostics::termcolor::{ColorChoice, WriteColor};
Expand Down Expand Up @@ -184,7 +184,7 @@ impl Display for RageConfiguration<'_, '_> {
fn fmt(&self, fmt: &mut Formatter) -> io::Result<()> {
Section("Biome Configuration").fmt(fmt)?;

match load_configuration(self.fs, ConfigurationBasePath::default()) {
match load_configuration(self.fs, ConfigurationPathHint::default()) {
Ok(loaded_configuration) => {
if loaded_configuration.directory_path.is_none() {
KeyValuePair("Status", markup!(<Dim>"unset"</Dim>)).fmt(fmt)?;
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_cli/src/commands/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub(crate) fn search(
setup_cli_subscriber(cli_options.log_level, cli_options.log_kind);

let loaded_configuration =
load_configuration(&session.app.fs, cli_options.as_configuration_base_path())?;
load_configuration(&session.app.fs, cli_options.as_configuration_path_hint())?;
validate_configuration_diagnostics(
&loaded_configuration,
session.app.console,
Expand Down
45 changes: 9 additions & 36 deletions crates/biome_cli/src/execute/migrate/eslint_any_rule_to_biome.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,18 +285,12 @@ pub(crate) fn migrate_eslint_any_rule(
rule.set_level(rule_severity.into());
}
"barrel-files/avoid-namespace-import" => {
if !options.include_nursery {
return false;
}
let group = rules.nursery.get_or_insert_with(Default::default);
let group = rules.style.get_or_insert_with(Default::default);
let rule = group.no_namespace_import.get_or_insert(Default::default());
rule.set_level(rule_severity.into());
}
"barrel-files/avoid-re-export-all" => {
if !options.include_nursery {
return false;
}
let group = rules.nursery.get_or_insert_with(Default::default);
let group = rules.performance.get_or_insert_with(Default::default);
let rule = group.no_re_export_all.get_or_insert(Default::default());
rule.set_level(rule_severity.into());
}
Expand Down Expand Up @@ -376,10 +370,7 @@ pub(crate) fn migrate_eslint_any_rule(
rule.set_level(rule_severity.into());
}
"jest/max-nested-describe" => {
if !options.include_nursery {
return false;
}
let group = rules.nursery.get_or_insert_with(Default::default);
let group = rules.complexity.get_or_insert_with(Default::default);
let rule = group
.no_excessive_nested_test_suites
.get_or_insert(Default::default());
Expand All @@ -390,10 +381,7 @@ pub(crate) fn migrate_eslint_any_rule(
results.has_inspired_rules = true;
return false;
}
if !options.include_nursery {
return false;
}
let group = rules.nursery.get_or_insert_with(Default::default);
let group = rules.suspicious.get_or_insert_with(Default::default);
let rule = group.no_skipped_tests.get_or_insert(Default::default());
rule.set_level(rule_severity.into());
}
Expand All @@ -410,10 +398,7 @@ pub(crate) fn migrate_eslint_any_rule(
results.has_inspired_rules = true;
return false;
}
if !options.include_nursery {
return false;
}
let group = rules.nursery.get_or_insert_with(Default::default);
let group = rules.suspicious.get_or_insert_with(Default::default);
let rule = group
.no_duplicate_test_hooks
.get_or_insert(Default::default());
Expand All @@ -424,10 +409,7 @@ pub(crate) fn migrate_eslint_any_rule(
results.has_inspired_rules = true;
return false;
}
if !options.include_nursery {
return false;
}
let group = rules.nursery.get_or_insert_with(Default::default);
let group = rules.suspicious.get_or_insert_with(Default::default);
let rule = group.no_exports_in_test.get_or_insert(Default::default());
rule.set_level(rule_severity.into());
}
Expand All @@ -436,10 +418,7 @@ pub(crate) fn migrate_eslint_any_rule(
results.has_inspired_rules = true;
return false;
}
if !options.include_nursery {
return false;
}
let group = rules.nursery.get_or_insert_with(Default::default);
let group = rules.suspicious.get_or_insert_with(Default::default);
let rule = group.no_focused_tests.get_or_insert(Default::default());
rule.set_level(rule_severity.into());
}
Expand Down Expand Up @@ -968,10 +947,7 @@ pub(crate) fn migrate_eslint_any_rule(
rule.set_level(rule_severity.into());
}
"no-unneeded-ternary" => {
if !options.include_nursery {
return false;
}
let group = rules.nursery.get_or_insert_with(Default::default);
let group = rules.complexity.get_or_insert_with(Default::default);
let rule = group.no_useless_ternary.get_or_insert(Default::default());
rule.set_level(rule_severity.into());
}
Expand Down Expand Up @@ -1136,10 +1112,7 @@ pub(crate) fn migrate_eslint_any_rule(
rule.set_level(rule_severity.into());
}
"react/jsx-key" => {
if !options.include_nursery {
return false;
}
let group = rules.nursery.get_or_insert_with(Default::default);
let group = rules.correctness.get_or_insert_with(Default::default);
let rule = group
.use_jsx_key_in_iterable
.get_or_insert(Default::default());
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_cli/src/logging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ impl FromStr for LoggingKind {
"compact" => Ok(Self::Compact),
"pretty" => Ok(Self::Pretty),
"json" => Ok(Self::Json),
_ => Err("This log kind doesn't exists".to_string()),
_ => Err("This log kind doesn't exist".to_string()),
}
}
}

0 comments on commit 2dce6af

Please sign in to comment.