Skip to content

fix(linter/unicorn/no-useless-undefined): report guarded indexed access - #29014

Merged
graphite-app[bot] merged 1 commit into
mainfrom
codex/28988-guarded-index-access
Nov 7, 2026
Merged

graphite-app[bot] merged 1 commit into
mainfrom
codex/28988-guarded-index-access

Conversation

@camc314

@camc314 camc314 commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Report redundant undefined branches in bounds guards such as i >= 0 ? a[i] : undefined, including equivalent upper bounds and offset indices, matching Unicorn.

Offer suggestions that preserve TypeScript assertions, while excluding side effects and withholding replacements that would remove comments or change reference behavior.

Fixes #28988

Copilot AI balanced review requested due to automatic review settings November 7, 2026 18:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Codex Review Summary: βœ… Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
πŸ“ Code Review βœ… Completed 2026-11-07T19:04:21.990506Z 6dc3963 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with πŸ‘€ while any review is running, comments if it has suggestions, and reacts with πŸ‘ once all reviews finish with no findings.

@github-actions github-actions Bot added the A-linter Area - Linter (oxlint): rules, config, diagnostics, fixes. Add L-* labels for details label Nov 7, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

πŸ’‘ Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5b1972a129

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with πŸ‘.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@codspeed

codspeed Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

βœ… 5 untouched benchmarks
⏩ 101 skipped benchmarks1


Comparing codex/28988-guarded-index-access (6dc3963) with main (76c53ce)

Open in CodSpeed

Footnotes

  1. 101 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@camc314 camc314 added the 0-merge Merge with Graphite Merge Queue label Nov 7, 2026

camc314 commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor Author

Merge activity

…ss (#29014)

Report redundant `undefined` branches in bounds guards such as `i >= 0 ? a[i] : undefined`, including equivalent upper bounds and offset indices, matching Unicorn.

Offer suggestions that preserve TypeScript assertions, while excluding side effects and withholding replacements that would remove comments or change reference behavior.

Fixes #28988
@graphite-app
graphite-app Bot force-pushed the codex/28988-guarded-index-access branch from 6dc3963 to 2487360 Compare November 7, 2026 22:21
@graphite-app
graphite-app Bot merged commit 2487360 into main Nov 7, 2026
33 checks passed
@graphite-app graphite-app Bot removed the 0-merge Merge with Graphite Merge Queue label Nov 7, 2026
@graphite-app
graphite-app Bot deleted the codex/28988-guarded-index-access branch November 7, 2026 22:24
graphite-app Bot pushed a commit that referenced this pull request Nov 9, 2026
# Oxlint
### πŸš€ Features

- 6195265 linter/promise/prefer-catch: Implement suggestion (#28919) (Mikhail Baev)

### πŸ› Bug Fixes

- 9c62d2a linter/eslint/no-unreachable-loop: Ignore enclosing finalizers for continues (#29004) (camc314)
- 6303df1 jsdoc: Preserve param tags after unmatched description delimiters (#28923) (Vishal Punjabi)
- fe66fa7 linter/eslint/no-lone-blocks: Report redundant blocks in function bodies (#29043) (camc314)
- e1694bd linter/unicorn/no-useless-undefined: Preserve shadowed bindings (#29046) (camc314)
- 791b5f5 linter/unicorn/prefer-regexp-test: Restrict automatic argument swaps (#29045) (camc314)
- e7654f6 linter/react/display-name: Ignore unrelated memo and forwardRef calls (#29005) (camc314)
- 2487360 linter/unicorn/no-useless-undefined: Report guarded indexed access (#29014) (camc314)
- a791a5b cfg: Resolve continues through stacked loop labels (#29016) (camc314)
- 287ba19 linter/eslint/id-length: Ignore TypeScript qualified references (#29037) (camc314)
- b71234f cfg: Skip labeled contexts for unlabeled jumps (#29001) (camc314)
- bb21a3c linter/import/no-anonymous-default-export: Report parenthesized exports (#29002) (camc314)
- f38f738 linter/eslint/prefer-destructuring: Skip fixes that remove comments (#29003) (camc314)
- bf11006 linter/react/exhaustive-deps: Suggest dependency removals (#28925) (camc314)
- 6bbb92a linter: Remove unused `oxlint-disable` directives with `--fix` (#27698) (Ryan Tsao)
- 3b35cb6 linter/disable-directives: Preserve separators and disable spans (#28921) (camc314)
- 1253445 linter/eslint/no-restricted-imports: Report re-exported imports once (#28920) (Ramy Akin Saidi)

### ⚑ Performance

- da620e6 linter: Start tsgolint before the regular lint pass (#28824) (Max Schwenk)
# Oxfmt
### πŸ› Bug Fixes

- 449e91f oxfmt: Format ts-in-astro as TSX (#29080) (leaysgur)
- 8d8845e formatter/jsdoc: Strip `*` prefixes from multiline default value (#28910) (leaysgur)
- cdb1501 formatter/jsdoc: Handle every line terminator in multi-line JSDoc types (#28909) (leaysgur)
- fd51bff jsdoc: Handle every line terminators as newline (#28902) (leaysgur)
- 2f80765 formatter_toml: Format whitespace-only document to empty (#28899) (leaysgur)
- 5e1e02c formatter_graphql: Allow empty document (#28898) (leaysgur)
- 06e72c0 formatter/tailwind: Normalize CR in Tailwind template with `preserveWhitespace` (#28896) (leaysgur)

### ⚑ Performance

- 934ca98 formatter: Use `Arc` for tailwind options across embedding (#29079) (leaysgur)
- dde9c5c formatter_htmlish: Skip `</script` escape if possible (#29078) (leaysgur)
- dc4d918 formatter: Format embedded expr of one name without parsing (#29077) (leaysgur)

### πŸ“š Documentation

- eb2eb2d formatter_htmlish: Cover block elements in `DIVERGENCES.md#interpolation-element-as-text` (#28901) (leaysgur)
- 0f4ec80 formatter/tailwind: Note Tailwind sorting tears escaped whitespace apart (#28900) (leaysgur)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-linter Area - Linter (oxlint): rules, config, diagnostics, fixes. Add L-* labels for details

Projects

None yet

Development

Successfully merging this pull request may close these issues.

linter(unicorn/no-useless-undefined): guarded indexed access (i >= 0 ? a[i] : undefined) is not reported

2 participants