chore(eslint): disable unicorn autofix rules that break TS typing#463
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Same guard as coreui-vue. Four
unicornrules have autofixes that produce type-breaking rewrites in this TS codebase. The lib already trips three of them, so aeslint --fixwould silently break compilation. This turns them off.Why (each verified against the lib)
prefer-at(6 in lib) —.at(i)returnsT | undefinedwherearr[i]returnsT; breaks strict-null where the result feeds a non-nullable position.prefer-spread(8 in lib) —Array.from(NodeList)→[...NodeList]narrowsHTMLElement[]toElement[].prefer-global-this(23 in lib) —window→globalThisrewrite known to break code.no-useless-undefined(0 in lib, preventive) —() => undefined→() => {}flips the return type tovoid.Config-only change — no source touched.
Note
This does not fix React's other pre-existing lint debt (
yarn lintis red onmainwith ~400 errors, mostly inpackages/docs). It only stops the unsafe autofixes from being applied. Cleaning up the rest is a separate effort.