chore(lint): enforce more strict eslint/oxlint rules (batch 2) #37884
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.
SUMMARY
Second batch of lint rule upgrades from warn to error, continuing to reduce tech debt.
Rules upgraded from warn → error
unicorn/no-useless-length-check.length === 0checks before.every()no-constant-binary-expressionNumber(x) ?? 0→Number(x ?? 0), extract test booleans to variablesno-unsafe-optional-chaining?.on always-defined properties, use!assertion in testsNew rules added (set to error)
storybook/prefer-pascal-casereact-you-might-not-need-an-effect/no-reset-all-state-on-prop-changereact-you-might-not-need-an-effect/no-chain-state-updatesreact-you-might-not-need-an-effect/no-event-handlerreact-you-might-not-need-an-effect/no-derived-stateNotable fixes
Useless length check:
arr.length === 0 || arr.every(...)is redundant sinceevery()returnstruefor empty arraysConstant binary expression:
Number(formData?.row_limit) ?? 0never uses the fallback sinceNumber()always returns a number (possibly NaN). Fixed toNumber(formData?.row_limit ?? 0)Unsafe optional chaining:
window?.document?.documentElementwith destructuring is unsafe. In browser context, these are always defined, so removed the optional chaining.BEFORE/AFTER SCREENSHOTS OR COVERAGE
N/A - lint configuration changes only
TESTING INSTRUCTIONS
npx oxlint -c oxlint.json- should have no errors for upgraded rulesnpm run lint- should pass🤖 Generated with Claude Code