Skip to content

target baseline, lightningcss tweaks, eslint updates, eslint.config.ts, remove 3 @ts-expect-error#4032

Merged
nstepien merged 1 commit intomainfrom
maintenance
Apr 21, 2026
Merged

target baseline, lightningcss tweaks, eslint updates, eslint.config.ts, remove 3 @ts-expect-error#4032
nstepien merged 1 commit intomainfrom
maintenance

Conversation

@nstepien
Copy link
Copy Markdown
Collaborator

@nstepien nstepien commented Apr 21, 2026

@nstepien nstepien self-assigned this Apr 21, 2026
Comment thread .vscode/settings.json
"eslint.options": {
"flags": ["unstable_native_nodejs_ts_config"]
},
"eslint.problems.shortenToSingleLine": true,
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now lints won't span multiple lines anymore, which was inconvenient.
https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint

function rowGrouper(rows: readonly Row[], columnKey: string) {
// @ts-expect-error
return Object.groupBy(rows, (r) => r[columnKey]) as Record<string, readonly R[]>;
return Object.groupBy(rows, (r) => r[columnKey as keyof Row]) as Record<string, readonly Row[]>;
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We used an incorrect R type, which these 3 @ts-expect-errors hid from us

Comment thread eslint.config.ts
// https://react.dev/reference/eslint-plugin-react-hooks
'react-hooks/rules-of-hooks': 1,
'react-hooks/exhaustive-deps': 1,
'react-hooks/component-hook-factories': 1,
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This rule is deprecated and a no-op
facebook/react@bc24980

Comment thread eslint.config.ts
'@eslint-react/jsx-no-useless-fragment': [1, { allowExpressions: false }],
'@eslint-react/jsx-no-key-after-spread': 1,
'@eslint-react/jsx-no-leaked-dollar': 1,
'@eslint-react/jsx-no-leaked-semicolon': 1,
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread src/Cell.tsx
const isEditable = isCellEditableUtil(column, row);

function setActivePositionWrapper(enableEditor?: boolean) {
function setActivePositionWrapper(enableEditor = false) {
Copy link
Copy Markdown
Collaborator Author

@nstepien nstepien Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caught by sonarjs/bool-param-default, decided to keep this rule enabled.

Comment thread tsdown.config.ts

export default defineConfig({
outDir: 'lib',
target: ['baseline-widely-available', 'node24.0.0'],
Copy link
Copy Markdown
Collaborator Author

@nstepien nstepien Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They've added support for baseline-widely-available so I've added it.
Also added node 24 as it's the current LTS version.
There's 0 difference in the output of index.js/index.js.map/index.d.ts.
https://github.com/rolldown/tsdown/releases

ℹ targets: chrome111, edge111, firefox114, safari16.4, ios16.4, node24.0.0

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread tsdown.config.ts
lightningcss: {
// https://github.com/parcel-bundler/lightningcss/issues/873
exclude: Features.Nesting | Features.LightDark
}
Copy link
Copy Markdown
Collaborator Author

@nstepien nstepien Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of changing the css.target to not break light-dark(), I've set this lightningcss configuration.

https://tsdown.dev/options/css#css-target
https://tsdown.dev/options/css#lightning-css

The only before/after difference is this:

Image

Safari only supports the prefixed property, so this is actually a bug fix!

https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/user-select#browser_compatibility

Comment thread vite.config.ts
build: {
modulePreload: { polyfill: false },
sourcemap: true,
reportCompressedSize: false,
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vite is fast now, so I removed reportCompressedSize: false

Comment thread vite.config.ts
groups: [
{
name: 'faker',
test: '@faker-js/faker'
Copy link
Copy Markdown
Collaborator Author

@nstepien nstepien Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Faker is the biggest dependency we have, and it doesn't get updates too often, might be worth splitting it into its own chunk.

dist/assets/faker-DefjNDsx.js                   410.66 kB │ gzip: 153.89 kB │ map:   696.97 kB

https://rolldown.rs/in-depth/manual-code-splitting#improve-loading-performance

Wonder if we should split react/react-dom together too 🤔

Comment thread vite.config.ts
lightningcss: {
// https://github.com/parcel-bundler/lightningcss/issues/873
exclude: Features.Nesting | Features.LightDark
}
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied the same lightningcss strategy here to fix the missing -webkit-user-select property.

@nstepien nstepien marked this pull request as ready for review April 21, 2026 18:28
@nstepien nstepien requested a review from amanmahajan7 as a code owner April 21, 2026 18:28
Copy link
Copy Markdown
Collaborator

@amanmahajan7 amanmahajan7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 👍

Comment thread test/browser/TreeDataGrid.test.tsx
Comment thread tsdown.config.ts

export default defineConfig({
outDir: 'lib',
target: ['baseline-widely-available', 'node24.0.0'],
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nstepien nstepien merged commit da5ab4f into main Apr 21, 2026
2 checks passed
@nstepien nstepien deleted the maintenance branch April 21, 2026 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants