Skip to content

Conversation

@rusackas
Copy link
Member

SUMMARY

Second batch of lint rule upgrades from warn to error, continuing to reduce tech debt.

Rules upgraded from warn → error

Rule Fix Applied
unicorn/no-useless-length-check Remove redundant .length === 0 checks before .every()
no-constant-binary-expression Fix Number(x) ?? 0Number(x ?? 0), extract test booleans to variables
no-unsafe-optional-chaining Remove unnecessary ?. on always-defined properties, use ! assertion in tests

New rules added (set to error)

  • storybook/prefer-pascal-case
  • react-you-might-not-need-an-effect/no-reset-all-state-on-prop-change
  • react-you-might-not-need-an-effect/no-chain-state-updates
  • react-you-might-not-need-an-effect/no-event-handler
  • react-you-might-not-need-an-effect/no-derived-state

Notable fixes

  1. Useless length check: arr.length === 0 || arr.every(...) is redundant since every() returns true for empty arrays

  2. Constant binary expression: Number(formData?.row_limit) ?? 0 never uses the fallback since Number() always returns a number (possibly NaN). Fixed to Number(formData?.row_limit ?? 0)

  3. Unsafe optional chaining: window?.document?.documentElement with 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

  1. Run npx oxlint -c oxlint.json - should have no errors for upgraded rules
  2. Run npm run lint - should pass

🤖 Generated with Claude Code

Upgrade more lint rules from warn to error:
- unicorn/no-useless-length-check
- no-constant-binary-expression
- no-unsafe-optional-chaining

Add new rules:
- storybook/prefer-pascal-case
- react-you-might-not-need-an-effect/no-reset-all-state-on-prop-change
- react-you-might-not-need-an-effect/no-chain-state-updates
- react-you-might-not-need-an-effect/no-event-handler
- react-you-might-not-need-an-effect/no-derived-state

Fix violations:
- state.ts: Remove redundant array length checks (every() handles empty arrays)
- buildQuery.ts: Move nullish coalescing inside Number() call
- Modal.tsx: Remove unnecessary optional chaining on document.documentElement
- Layout.test.tsx: Extract boolean to variable to avoid constant expression
- transformProps.test.ts: Use non-null assertion instead of optional chaining

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@bito-code-review
Copy link
Contributor

bito-code-review bot commented Feb 11, 2026

Code Review Agent Run #9ab59a

Actionable Suggestions - 0
Review Details
  • Files reviewed - 7 · Commit Range: 2c36133..2c36133
    • superset-frontend/.eslintrc.js
    • superset-frontend/packages/superset-ui-core/src/components/Layout/Layout.test.tsx
    • superset-frontend/packages/superset-ui-core/src/components/Modal/Modal.tsx
    • superset-frontend/plugins/plugin-chart-ag-grid-table/src/buildQuery.ts
    • superset-frontend/plugins/plugin-chart-echarts/test/BigNumber/transformProps.test.ts
    • superset-frontend/plugins/plugin-chart-table/src/buildQuery.ts
    • superset-frontend/src/dashboard/components/nativeFilters/state.ts
  • Files skipped - 1
    • superset-frontend/oxlint.json - Reason: Filter setting
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • Eslint (Linter) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@dosubot dosubot bot added the change:frontend Requires changing the frontend label Feb 11, 2026
@codeant-ai-for-open-source
Copy link
Contributor

Sequence Diagram

This PR tightens ESLint/oxlint rules and applies minimal code fixes (remove redundant length checks, fix nullish/coercion order, remove unsafe optional chaining, and update tests) so linting passes. The diagram shows the main developer → linter → code → tests flow.

sequenceDiagram
    participant Dev as Developer
    participant Config as Lint Config (oxlint/.eslintrc)
    participant Repo as Codebase
    participant Linter as Lint Runner (npx oxlint / npm run lint)
    participant Tests as Test Runner

    Dev->>Config: Upgrade rules to errors (no-unsafe-optional-chaining, no-constant-binary-expression, unicorn/no-useless-length-check, add react-you-might-not-need-an-effect, storybook rule)
    Dev->>Repo: Apply focused fixes (remove .length checks, move ?? inside Number(), remove ?., adjust tests)
    Dev->>Linter: Run linter
    Linter->>Repo: Analyze code against updated rules
    Repo-->>Linter: No lint errors (fixes applied)
    Dev->>Tests: Run tests
    Tests-->>Dev: Tests pass
Loading

Generated by CodeAnt AI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant