@biomejs/biome 2.2.5
2.2.5
Patch Changes
-
#7597
5c3d542Thanks @arendjr! - Fixed #6432:useImportExtensionsnow works correctly with aliased paths. -
#7269
f18dac1Thanks @CDGardner! - Fixed #6648, where Biome'snoUselessFragmentscontained inconsistencies with ESLint for fragments only containing text.Previously, Biome would report that fragments with only text were unnecessary under the
noUselessFragmentsrule. Further analysis of ESLint's behavior towards these cases revealed that text-only fragments (<>A</a>,<React.Fragment>B</React.Fragment>,<RenamedFragment>B</RenamedFragment>) would not havenoUselessFragmentsemitted for them.On the Biome side, instances such as these would emit
noUselessFragments, and applying the suggested fix would turn the text content into a proper JS string.// Ended up as: - const t = "Text" const t = <>Text</> // Ended up as: - const e = t ? "Option A" : "Option B" const e = t ? <>Option A</> : <>Option B</> /* Ended up as: function someFunc() { return "Content desired to be a multi-line block of text." } */ function someFunc() { return <> Content desired to be a multi-line block of text. <> }The proposed update was to align Biome's reaction to this rule with ESLint's; the aforementioned examples will now be supported from Biome's perspective, thus valid use of fragments.
// These instances are now valid and won't be called out by noUselessFragments. const t = <>Text</> const e = t ? <>Option A</> : <>Option B</> function someFunc() { return <> Content desired to be a multi-line block of text. <> } -
#7498
002cdedThanks @siketyan! - Fixed #6893: TheuseExhaustiveDependenciesrule now correctly adds a dependency that is captured in a shorthand object member. For example:useEffect(() => { console.log({ firstId, secondId }); }, []);is now correctly fixed to:
useEffect(() => { console.log({ firstId, secondId }); }, [firstId, secondId]); -
#7509
1b61631Thanks @siketyan! - Added a new lint rulenoReactForwardRef, which detects usages offorwardRefthat is no longer needed and deprecated in React 19.For example:
export const Component = forwardRef(function Component(props, ref) { return <div ref={ref} />; });will be fixed to:
export const Component = function Component({ ref, ...props }) { return <div ref={ref} />; };Note that the rule provides an unsafe fix, which may break the code. Don't forget to review the code after applying the fix.
-
#7520
3f06e19Thanks @arendjr! - Added new nursery rulenoDeprecatedImportsto flag imports of deprecated symbols.Invalid example
// foo.js import { oldUtility } from "./utils.js";// utils.js /** * @deprecated */ export function oldUtility() {}Valid examples
// foo.js import { newUtility, oldUtility } from "./utils.js";// utils.js export function newUtility() {} // @deprecated (this is not a JSDoc comment) export function oldUtility() {} -
#7457
9637f93Thanks @kedevked! - AddedstyleandrequireForObjectLiteraloptions to the lint ruleuseConsistentArrowReturn.This rule enforces a consistent return style for arrow functions. It can be configured with the following options:
style: (default:asNeeded)always: enforces that arrow functions always have a block body.never: enforces that arrow functions never have a block body, when possible.asNeeded: enforces that arrow functions have a block body only when necessary (e.g. for object literals).
style: "always"Invalid:
const f = () => 1;Valid:
const f = () => { return 1; };style: "never"Invalid:
const f = () => { return 1; };Valid:
const f = () => 1;style: "asNeeded"Invalid:
const f = () => { return 1; };Valid:
const f = () => 1;style: "asNeeded"andrequireForObjectLiteral: trueValid:
const f = () => { return { a: 1 }; }; -
#7510
527cec2Thanks @rriski! - Implements #7339. GritQL patterns can now use native Biome AST nodes using theirPascalCasenames, in addition to the existing TreeSitter-compatiblesnake_casenames.engine biome(1.0) language js(typescript,jsx) or { // TreeSitter-compatible pattern if_statement(), // Native Biome AST node pattern JsIfStatement() } as $stmt where { register_diagnostic( span=$stmt, message="Found an if statement" ) } -
#7574
47907e7Thanks @kedevked! - Fixed 7574. The diagnostic message for the ruleuseSolidForComponentnow correctly emphasizes<For />and provides a working hyperlink to the Solid documentation. -
#7497
bd70f40Thanks @siketyan! - Fixed #7320: TheuseConsistentCurlyBracesrule now correctly detects a string literal including"inside a JSX attribute value. -
#7522
1af9931Thanks @Netail! - Added extra references to external rules to improve migration for the following rules:noUselessFragments&noNestedComponentDefinitions -
#7597
5c3d542Thanks @arendjr! - Fixed an issue wherepackage.jsonmanifests would not be correctly discovered when evaluating files in the same directory. -
#7565
38d2098Thanks @siketyan! - The resolver can now correctly resolve.ts,.tsx,.d.ts,.jsfiles by.jsextension if exists, based on the file extension substitution in TypeScript.For example, the linter can now detect the floating promise in the following situation, if you have enabled the
noFloatingPromisesrule.foo.tsexport async function doSomething(): Promise<void> {}bar.tsimport { doSomething } from "./foo.js"; // doesn't exist actually, but it is resolved to `foo.ts` doSomething(); // floating promise! -
#7542
cadad2cThanks @mdevils! - Added the rulenoVueDuplicateKeys, which prevents duplicate keys in Vue component definitions.This rule prevents the use of duplicate keys across different Vue component options such as
props,data,computed,methods, andsetup. Even if keys don't conflict in the script tag, they may cause issues in the template since Vue allows direct access to these keys.Invalid examples
<script> export default { props: ["foo"], data() { return { foo: "bar", }; }, }; </script><script> export default { data() { return { message: "hello", }; }, methods: { message() { console.log("duplicate key"); }, }, }; </script><script> export default { computed: { count() { return this.value * 2; }, }, methods: { count() { this.value++; }, }, }; </script>Valid examples
<script> export default { props: ["foo"], data() { return { bar: "baz", }; }, methods: { handleClick() { console.log("unique key"); }, }, }; </script><script> export default { computed: { displayMessage() { return this.message.toUpperCase(); }, }, methods: { clearMessage() { this.message = ""; }, }, }; </script> -
#7546
a683accThanks @siketyan! - Internal data for Unicode strings have been updated to Unicode 17.0. -
#7497
bd70f40Thanks @siketyan! - Fixed #7256: TheuseConsistentCurlyBracesrule now correctly ignores a string literal with braces that contains only whitespaces. Previously, literals that contains single whitespace were only allowed. -
#7565
38d2098Thanks @siketyan! - TheuseImportExtensionsrule now correctly detects imports with an invalid extension. For example, importing.tsfile with.jsextension is flagged by default. If you are using TypeScript with neither theallowImportingTsExtensionsoption nor therewriteRelativeImportExtensionsoption, it's recommended to turn on theforceJsExtensionsoption of the rule. -
#7581
8653921Thanks @lucasweng! - Fixed #7470: solved a false positive fornoDuplicateProperties. Previously, declarations in@containerand@starting-styleat-rules were incorrectly flagged as duplicates of identical declarations at the root selector.For example, the linter no longer flags the
displaydeclaration in@containeror theopacitydeclaration in@starting-style.a { display: block; @container (min-width: 600px) { display: none; } } [popover]:popover-open { opacity: 1; @starting-style { opacity: 0; } } -
#7529
fea905fThanks @qraqras! - Fixed #7517: theuseOptionalChainrule no longer suggests changes for typeof checks on global objects.// ok typeof window !== "undefined" && window.location; -
#7476
c015765Thanks @ematipico! - Fixed a bug where the suppression action fornoPositiveTabindexdidn't place the suppression comment in the correct position. -
#7511
a0039fdThanks @arendjr! - Added nursery rulenoUnusedExpressionsto flag expressions used as a statement that is neither an assignment nor a function call.Invalid examples
f; // intended to call `f()` insteadfunction foo() { 0; // intended to `return 0` instead }Valid examples
f();function foo() { return 0; } -
#7564
40e515fThanks @turbocrime! - Fixed #6617: improveduseIterableCallbackReturnto correctly handle arrow functions with a single-expressionvoidbody.Now the following code doesn't trigger the rule anymore:
[].forEach(() => void null);
What's Changed
- chore: add spanish readme translation by @Terraciano in https://github.com/biomejs/biome/pull/7465
- feat(yaml_parser): parse block scalars by @l0ngvh in https://github.com/biomejs/biome/pull/7417
- docs: improve noDuplicateDependencies by @Netail in https://github.com/biomejs/biome/pull/7471
- chore: repair changelog by @ematipico in https://github.com/biomejs/biome/pull/7477
- fix(noPositiveTabindex): suppression action by @ematipico in https://github.com/biomejs/biome/pull/7476
- fix(lint/useConsistentCurlyBraces): adjust condition to allow removing the braces by @siketyan in https://github.com/biomejs/biome/pull/7497
- fix(lint/useExhaustiveDependencies): correctly fix the dependency list from a shorthand object member by @siketyan in https://github.com/biomejs/biome/pull/7498
- chore(deps): update rust:1.89.0-bullseye docker digest to 8f72d97 by @renovate[bot] in https://github.com/biomejs/biome/pull/7506
- chore(deps): update rust:1.89.0-bookworm docker digest to 948f9b0 by @renovate[bot] in https://github.com/biomejs/biome/pull/7505
- chore(deps): update github-actions by @renovate[bot] in https://github.com/biomejs/biome/pull/7503
- chore(deps): update docker/dockerfile:1 docker digest to dabfc09 by @renovate[bot] in https://github.com/biomejs/biome/pull/7502
- chore(deps): update dependency @changesets/cli to v2.29.7 by @renovate[bot] in https://github.com/biomejs/biome/pull/7507
- chore(deps): update dependency dprint to v0.50.2 by @renovate[bot] in https://github.com/biomejs/biome/pull/7508
- feat(biome-js-analyze): class member references service by @vladimir-ivanov in https://github.com/biomejs/biome/pull/7428
- feat(grit): allow matching native Biome AST nodes by @rriski in https://github.com/biomejs/biome/pull/7510
- feat(linter): implement
noUnusedExpressionsby @arendjr in https://github.com/biomejs/biome/pull/7511 - feat(linter): implement
noDeprecatedImportsby @arendjr in https://github.com/biomejs/biome/pull/7520 - chore: expose preferred indentation by @arendjr in https://github.com/biomejs/biome/pull/7540
- chore: update Unicode table for Unicode 17 by @siketyan in https://github.com/biomejs/biome/pull/7546
- ci: don't run the autofix workflow on an autofix commit by @siketyan in https://github.com/biomejs/biome/pull/7550
- test: fix failing watcher tests on macOS by @siketyan in https://github.com/biomejs/biome/pull/7549
- chore(deps): update github-actions by @renovate[bot] in https://github.com/biomejs/biome/pull/7554
- chore(deps): update rust crate anyhow to 1.0.100 by @renovate[bot] in https://github.com/biomejs/biome/pull/7555
- chore(deps): update rust crate serde_json to 1.0.145 by @renovate[bot] in https://github.com/biomejs/biome/pull/7558
- chore(deps): update rust crate tracing-subscriber to 0.3.20 by @renovate[bot] in https://github.com/biomejs/biome/pull/7560
- chore(deps): update rust crate url to 2.5.7 by @renovate[bot] in https://github.com/biomejs/biome/pull/7561
- chore(deps): update rust crate serde to 1.0.226 by @renovate[bot] in https://github.com/biomejs/biome/pull/7557
- chore(deps): update dependency @types/node to v22.18.6 by @renovate[bot] in https://github.com/biomejs/biome/pull/7563
- chore: add convex to bronze sponsors by @ematipico in https://github.com/biomejs/biome/pull/7566
- feat(resolver): resolve extension alias by @siketyan in https://github.com/biomejs/biome/pull/7565
- feat(lint): add
noReactForwardRefrule by @siketyan in https://github.com/biomejs/biome/pull/7509 - perf: don't allocate when pushing or retrieving globals by @arendjr in https://github.com/biomejs/biome/pull/7569
- feat: add useConsistentArrowReturn options by @kedevked in https://github.com/biomejs/biome/pull/7457
- fix: set correct string for diagnostic by @kedevked in https://github.com/biomejs/biome/pull/7574
- feat(lint): implement
noVueDuplicateKeysrule by @mdevils in https://github.com/biomejs/biome/pull/7542 - chore: add edition 2024 to rustfmt.toml by @turbocrime in https://github.com/biomejs/biome/pull/7591
- fix(lint/suspicious/useIterableCallbackReturn): single-expression void arrow function by @turbocrime in https://github.com/biomejs/biome/pull/7564
- fix(noDuplicateProperties): false positives in
@containerand@starting-styleat-rules by @lucasweng in https://github.com/biomejs/biome/pull/7581 - fix(lint/complexity/noUselessFragments): address inconsistencies against ESLint behavior with fragments only containing text. by @CDGardner in https://github.com/biomejs/biome/pull/7269
- fix(linter): fix aliased paths in
useImportExtensionsby @arendjr in https://github.com/biomejs/biome/pull/7597 - feat(biome-js-analyze): add is_meaningful_read to semantic class reads by @vladimir-ivanov in https://github.com/biomejs/biome/pull/7543
- fix(lint/useOptionalChain): fix incorrect suggestions for
typeofchecks on global objects by @qraqras in https://github.com/biomejs/biome/pull/7529 - chore(deps): update github-actions by @renovate[bot] in https://github.com/biomejs/biome/pull/7611
- docs: extra rule sources by @Netail in https://github.com/biomejs/biome/pull/7522
- chore(deps): update rust crate libc to 0.2.176 by @renovate[bot] in https://github.com/biomejs/biome/pull/7612
- docs: fix correct graphql references by @Netail in https://github.com/biomejs/biome/pull/7623
- ci: release by @github-actions[bot] in https://github.com/biomejs/biome/pull/7478
New Contributors
- @Terraciano made their first contribution in https://github.com/biomejs/biome/pull/7465
- @turbocrime made their first contribution in https://github.com/biomejs/biome/pull/7591
- @CDGardner made their first contribution in https://github.com/biomejs/biome/pull/7269
Full Changelog: https://github.com/biomejs/biome/compare/@biomejs/biome@2.2.4...@biomejs/biome@2.2.5