Skip to content

Conversation

@rusackas
Copy link
Member

SUMMARY

Third batch of lint cleanup to reduce tech debt and enforce stricter patterns.

Rules upgraded to error:

  1. unicorn/no-new-array - Prefer Array.from({ length: n }, callback) over new Array(n).fill().map()
  2. @typescript-eslint/no-use-before-define - Previously at warn, now error (no violations found)
  3. react-you-might-not-need-an-effect/no-adjust-state-on-prop-change - New rule added
  4. react-you-might-not-need-an-effect/no-pass-data-to-parent - New rule added

Fixes applied:

Fixed all unicorn/no-new-array violations across 17 files by replacing:

  • new Array(n).fill().map(callback)Array.from({ length: n }, callback)
  • new Array(n).fill(0).join('')'0'.repeat(n)
  • new Array(n).fill().forEach(callback)for loop

Why prefer Array.from?

new Array(n).fill().map() has several issues:

  1. Creates a sparse array first, then fills it, then maps - three operations instead of one
  2. .fill() alone creates holes that behave unexpectedly with array methods
  3. Array.from({ length: n }, callback) is more readable and direct

BEFORE/AFTER

Before:

const items = new Array(10).fill(undefined).map((_, i) => ({ id: i }));

After:

const items = Array.from({ length: 10 }, (_, i) => ({ id: i }));

TESTING INSTRUCTIONS

These are lint rule changes. CI will verify all linting passes.

ADDITIONAL INFORMATION

🤖 Generated with Claude Code

- Upgrade unicorn/no-new-array to error (all violations fixed)
- Upgrade @typescript-eslint/no-use-before-define from warn to error
- Add react-you-might-not-need-an-effect plugin with rules:
  - no-adjust-state-on-prop-change: error
  - no-pass-data-to-parent: error

Fixed unicorn/no-new-array violations by replacing:
- new Array(n).fill().map() with Array.from({ length: n }, callback)
- new Array(n).fill().join() with String.repeat()
- new Array(n).fill().forEach() with for loops

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 #6a62f8

Actionable Suggestions - 0
Review Details
  • Files reviewed - 18 · Commit Range: 6c75540..6c75540
    • superset-frontend/.eslintrc.js
    • superset-frontend/plugins/legacy-preset-chart-deckgl/src/utils.ts
    • superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformers.ts
    • superset-frontend/plugins/plugin-chart-table/src/DataTable/components/Pagination.tsx
    • superset-frontend/src/SqlLab/fixtures.ts
    • superset-frontend/src/SqlLab/utils/emptyQueryResults.test.ts
    • superset-frontend/src/components/FacePile/FacePile.stories.tsx
    • superset-frontend/src/components/FacePile/FacePile.test.tsx
    • superset-frontend/src/components/FacePile/utils.tsx
    • superset-frontend/src/components/ListView/CardCollection.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/FilterControls.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FilterConfigPane.test.tsx
    • superset-frontend/src/pages/ExecutionLogList/ExecutionLogList.test.tsx
    • superset-frontend/src/pages/Home/index.tsx
    • superset-frontend/src/pages/RolesList/RolesList.test.tsx
    • superset-frontend/src/pages/SavedQueryList/SavedQueryList.test.tsx
    • superset-frontend/src/pages/UserRegistrations/UserRegistrations.test.tsx
    • superset-frontend/src/pages/UsersList/UsersList.test.tsx
  • Files skipped - 1
    • superset-frontend/oxlint.json - Reason: Filter setting
  • Tools
    • Eslint (Linter) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ 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/TypeScript/react-effect rules and applies automated fixes across the codebase—primarily replacing unsafe new Array(...) patterns with Array.from / String.repeat / for-loops—so lint now reports zero violations and CI passes.

sequenceDiagram
    participant Developer
    participant Repo
    participant LinterConfig as "ESLint & oxlint"
    participant CodeMods as "Codemods/Manual Edits"
    participant CI

    Developer->>Repo: Update lint config (rules -> error) and apply fixes
    Repo->>CodeMods: Run codemods / replace new Array(...) patterns
    CodeMods-->>Repo: Commit transformed files (Array.from, '0'.repeat, for-loops)
    Repo->>LinterConfig: Lint rules now stricter (unicorn/no-new-array, @typescript-eslint, react-effect)
    CI->>Repo: Run lint checks
    LinterConfig-->>CI: No violations
    CI-->>Developer: Merge/CI passes (lint green)
Loading

Generated by CodeAnt AI

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

Labels

change:frontend Requires changing the frontend plugins size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants