From 49ade42d4f1d11f9c07dda408efd7e7cd256f74e Mon Sep 17 00:00:00 2001 From: Tobias Barsnes Date: Thu, 15 Aug 2024 09:01:12 +0200 Subject: [PATCH] chore: enable `noAccumulatingSpread` in biome (#2252) resolves #2246 --- biome.jsonc | 3 --- packages/cli/src/tokens/formats/css.ts | 14 ++++++-------- .../react/src/components/Table/Table.stories.tsx | 3 ++- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/biome.jsonc b/biome.jsonc index 2f9cb075bf..0b66172bd5 100644 --- a/biome.jsonc +++ b/biome.jsonc @@ -76,9 +76,6 @@ "suspicious": { "noArrayIndexKey": "off", "noDoubleEquals": "off" // TODO: Enable this rule - }, - "performance": { - "noAccumulatingSpread": "off" // TODO: Enable this rule } }, "ignore": [] diff --git a/packages/cli/src/tokens/formats/css.ts b/packages/cli/src/tokens/formats/css.ts index 0312ff2054..9cb48b618d 100644 --- a/packages/cli/src/tokens/formats/css.ts +++ b/packages/cli/src/tokens/formats/css.ts @@ -148,11 +148,10 @@ export const typography: Format = { font-weight: ${getValue(token)}; }`; - return { - ...acc, + return Object.assign(acc, { variables: [...acc.variables, format(token)], classes: [...acc.classes, className], - }; + }); } if (typeEquals('lineheight', token)) { @@ -161,11 +160,10 @@ export const typography: Format = { line-height: ${getValue(token)}; }`; - return { - ...acc, + return Object.assign(acc, { variables: [...acc.variables, format(token)], classes: [...acc.classes, className], - }; + }); } if (typeEquals('typography', token)) { @@ -194,10 +192,10 @@ export const typography: Format = { ${letterSpacingVar ? `letter-spacing: ${letterSpacingVar};` : ''} }`; - return { ...acc, classes: [className, ...acc.classes] }; + return Object.assign(acc, { classes: [className, ...acc.classes] }); } - return { ...acc, variables: [...acc.variables, format(token)] }; + return Object.assign(acc, { variables: [...acc.variables, format(token)] }); }, { variables: [], classes: [] }, ), diff --git a/packages/react/src/components/Table/Table.stories.tsx b/packages/react/src/components/Table/Table.stories.tsx index 16d57894c1..b724d91ac4 100644 --- a/packages/react/src/components/Table/Table.stories.tsx +++ b/packages/react/src/components/Table/Table.stories.tsx @@ -208,7 +208,8 @@ export const WithFormElements: Story = (args) => { setHeaderChecked(event.target.checked); setCheckedItems( rows.reduce( - (acc: CheckedItems, row) => ({ ...acc, [row]: event.target.checked }), + (acc: CheckedItems, row) => + Object.assign(acc, { [row]: event.target.checked }), {}, ), );