diff --git a/.changeset/spotty-buckets-hang.md b/.changeset/spotty-buckets-hang.md new file mode 100644 index 000000000000..49aa1fd5b43b --- /dev/null +++ b/.changeset/spotty-buckets-hang.md @@ -0,0 +1,33 @@ +--- +"@biomejs/biome": major +--- + +Reworked some recommended rules recommended to be less pedantic and blocking. This is a **breaking change** if your project relied on those rules to block the CI in case of violations; if that's the case, you should raise their severity level to **error**. + +Some rules aren't recommended anymore, and some others return a different severity. + +The following rules return a **warning** diagnostic: +- `noDelete` +- `noForEach` +- `noSuspiciousSemicolonInJsx` +- `noThisInStatic` +- `noUnusedLabels` + +The following rules return an **information** diagnostic: +- `noUselessCatch` +- `noUselessConstructor` +- `noUselessEmptyExport` +- `noUselessFragments` +- `noUselessLabel` +- `noUselessLoneBlockStatements` +- `noUselessSwitchCase` +- `noUselessTernary` +- `noUselessThisAlias` +- `noUselessTypeConstraint` +- `noFlatMapIdentity` + +The following rules aren't recommended anymore: +- `noDelete` +- `noForEach` + +The rule `noRenderReturnValue` is only recommended when the `react` domain is enabled. diff --git a/crates/biome_analyze/src/rule.rs b/crates/biome_analyze/src/rule.rs index acc1a8f0f282..c7b9f267b85e 100644 --- a/crates/biome_analyze/src/rule.rs +++ b/crates/biome_analyze/src/rule.rs @@ -414,7 +414,7 @@ impl RuleSource { pub fn to_rule_url(&self) -> String { match self { - Self::Clippy(rule_name) => format!("https://rust-lang.github.io/rust-clippy/master/#/{rule_name}"), + Self::Clippy(rule_name) => format!("https://rust-lang.github.io/rust-clippy/master/#{rule_name}"), Self::Eslint(rule_name) => format!("https://eslint.org/docs/latest/rules/{rule_name}"), Self::EslintGraphql(rule_name) => format!("https://the-guild.dev/graphql/eslint/rules/{rule_name}"), Self::EslintGraphqlSchemaLinter(rule_name) => format!("https://github.com/cjoudrey/graphql-schema-linter?tab=readme-ov-file#{rule_name}"), diff --git a/crates/biome_cli/tests/snapshots/main_cases_handle_vue_files/check_stdin_write_unsafe_successfully.snap b/crates/biome_cli/tests/snapshots/main_cases_handle_vue_files/check_stdin_write_unsafe_successfully.snap index d15b62375da3..91822fc61114 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_handle_vue_files/check_stdin_write_unsafe_successfully.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_handle_vue_files/check_stdin_write_unsafe_successfully.snap @@ -1,6 +1,7 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) +snapshot_kind: text --- # Input messages @@ -21,7 +22,7 @@ delete a.c; import * as vueUse from "vue-use"; import { Button } from "./components/Button.vue"; -a.c = undefined; +delete a.c; ``` diff --git a/crates/biome_cli/tests/snapshots/main_cases_handle_vue_files/lint_stdin_write_unsafe_successfully.snap b/crates/biome_cli/tests/snapshots/main_cases_handle_vue_files/lint_stdin_write_unsafe_successfully.snap index c96e463df16a..e0c8b332bc38 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_handle_vue_files/lint_stdin_write_unsafe_successfully.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_handle_vue_files/lint_stdin_write_unsafe_successfully.snap @@ -1,6 +1,6 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) snapshot_kind: text --- # Input messages @@ -20,7 +20,7 @@ var foo: string = ""; ```block diff --git a/crates/biome_cli/tests/snapshots/main_cases_handle_vue_files/lint_vue_js_files.snap b/crates/biome_cli/tests/snapshots/main_cases_handle_vue_files/lint_vue_js_files.snap index bef9edfe5b10..4f0135b53d0d 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_handle_vue_files/lint_vue_js_files.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_handle_vue_files/lint_vue_js_files.snap @@ -1,6 +1,6 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) snapshot_kind: text --- ## `file.vue` @@ -55,30 +55,7 @@ file.vue:2:3 lint/suspicious/noDoubleEquals FIXABLE ━━━━━━━━ ``` -```block -file.vue:3:1 lint/performance/noDelete FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × Avoid the delete operator which can impact performance. - - 1 │ @@ -146,7 +147,7 @@ invalid.jsx:7:2 lint/a11y/noAriaUnsupportedElements FIXABLE ━━━━━━ ``` invalid.jsx:8:2 lint/a11y/noAriaUnsupportedElements FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - ! Avoid the role attribute and aria-* attributes when using meta, html, script, and style elements. + × Avoid the role attribute and aria-* attributes when using meta, html, script, and style elements. 6 │ 7 │ @@ -167,7 +168,7 @@ invalid.jsx:8:2 lint/a11y/noAriaUnsupportedElements FIXABLE ━━━━━━ ``` invalid.jsx:9:2 lint/a11y/noAriaUnsupportedElements FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - ! Avoid the role attribute and aria-* attributes when using meta, html, script, and style elements. + × Avoid the role attribute and aria-* attributes when using meta, html, script, and style elements. 7 │ 8 │ @@ -184,5 +185,3 @@ invalid.jsx:9:2 lint/a11y/noAriaUnsupportedElements FIXABLE ━━━━━━ │ ------------ ``` - - diff --git a/crates/biome_js_analyze/tests/specs/a11y/noAutofocus/invalid.jsx.snap b/crates/biome_js_analyze/tests/specs/a11y/noAutofocus/invalid.jsx.snap index ee01682a964a..dada8634ac6f 100644 --- a/crates/biome_js_analyze/tests/specs/a11y/noAutofocus/invalid.jsx.snap +++ b/crates/biome_js_analyze/tests/specs/a11y/noAutofocus/invalid.jsx.snap @@ -1,6 +1,7 @@ --- source: crates/biome_js_analyze/tests/spec_tests.rs expression: invalid.jsx +snapshot_kind: text --- # Input ```jsx @@ -25,7 +26,7 @@ expression: invalid.jsx ``` invalid.jsx:2:13 lint/a11y/noAutofocus FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - ! Avoid the autoFocus attribute. + × Avoid the autoFocus attribute. 1 │ <> > 2 │