Skip to content

chore(eslint): disable unicorn autofix rules that break TS typing#463

Merged
mrholek merged 1 commit into
mainfrom
fix/eslint-disable-unsafe-unicorn-autofix
Jun 12, 2026
Merged

chore(eslint): disable unicorn autofix rules that break TS typing#463
mrholek merged 1 commit into
mainfrom
fix/eslint-disable-unsafe-unicorn-autofix

Conversation

@mrholek

@mrholek mrholek commented Jun 12, 2026

Copy link
Copy Markdown
Member

What

Same guard as coreui-vue. Four unicorn rules have autofixes that produce type-breaking rewrites in this TS codebase. The lib already trips three of them, so a eslint --fix would silently break compilation. This turns them off.

Why (each verified against the lib)

  • prefer-at (6 in lib) — .at(i) returns T | undefined where arr[i] returns T; breaks strict-null where the result feeds a non-nullable position.
  • prefer-spread (8 in lib) — Array.from(NodeList)[...NodeList] narrows HTMLElement[] to Element[].
  • prefer-global-this (23 in lib) — windowglobalThis rewrite known to break code.
  • no-useless-undefined (0 in lib, preventive) — () => undefined() => {} flips the return type to void.

Config-only change — no source touched.

Note

This does not fix React's other pre-existing lint debt (yarn lint is red on main with ~400 errors, mostly in packages/docs). It only stops the unsafe autofixes from being applied. Cleaning up the rest is a separate effort.

Same guard as coreui-vue: these unicorn autofixes produce type-breaking
rewrites in this codebase, so turn them off to keep `eslint --fix` safe.
The lib already trips prefer-at (6), prefer-spread (8) and prefer-global-this
(23).

- prefer-at — .at(i) returns T | undefined where arr[i] returns T
- prefer-spread — Array.from(NodeList) -> [...] narrows HTMLElement[] to Element[]
- no-useless-undefined — () => undefined becomes () => {} (void)
- prefer-global-this — window -> globalThis rewrite known to break code
@mrholek mrholek merged commit e06d198 into main Jun 12, 2026
@mrholek mrholek deleted the fix/eslint-disable-unsafe-unicorn-autofix branch June 12, 2026 21:02
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.

1 participant