chore(lint): enable @typescript-eslint/no-non-null-assertion#36
Open
tupe12334 wants to merge 1 commit into
Open
chore(lint): enable @typescript-eslint/no-non-null-assertion#36tupe12334 wants to merge 1 commit into
tupe12334 wants to merge 1 commit into
Conversation
Forbid non-null assertions (`value!`), which assert non-null to the type checker with no runtime guarantee and turn a wrong assumption into a runtime crash. eslint-config-agent does not ship this rule. Fixes the single violation in use-auto-close.ts by using the existing null-checked clearTimer() helper instead of `clearInterval(intervalRef.current!)`. Closes #35 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Enable the
@typescript-eslint/no-non-null-assertionESLint ruleCloses #35
What
Enables
@typescript-eslint/no-non-null-assertion: "error"ineslint.config.mjs, forbidding the non-null assertion operator (value!).Why
!tells the type checker a value is notnull/undefinedwith no runtime guarantee. A wrong assumption compiles clean and crashes at runtime — the exact bug class the type system exists to catch. The rule forces an explicit guard, optional chaining, or narrowing instead.eslint-config-agentdoes not ship this rule, so!was previously unchecked. Set aterrorso regressions fail lint.Change
eslint.config.mjs: add the rule (with an explanatory comment).src/app/open/use-auto-close.ts: the one violation wasclearInterval(intervalRef.current!). Replaced with the file's existing null-checkedclearTimer()helper, which clears the interval and resets the ref — behavior-preserving and assertion-free.Verification
pnpm lint→ clean (0 errors).tsc --noEmit→ clean.next build→ succeeds (all routes prerendered).No other rules changed.
This pull request was opened by the Add lint rule → issue + PR (owned repos + my orgs) → Slack routine of moadim. cc @tupe12334