Skip to content

feat(build): migrate custom lint rule to Oxlint - #44201

Open
hainenber wants to merge 5 commits into
masterfrom
feat/migrate-eslint-custom-rules-to-oxlint
Open

feat(build): migrate custom lint rule to Oxlint#44201
hainenber wants to merge 5 commits into
masterfrom
feat/migrate-eslint-custom-rules-to-oxlint

Conversation

@hainenber

Copy link
Copy Markdown
Contributor

feat(build): migrate custom lint rule to Oxlint

SUMMARY

Migrate existing lint rule from ESLint-based to Oxlint-based. Well, not that much of a refactor since Oxlint folks provides excellent compatibility with custom ESLint plugin API. A bit of shame that module-level, Typescript-based custom JS plugin support for Oxlint is not yet mature so I had to use jsdoc to annotate typing for TS-to-JS plugin files but not a dealbreaker, tbh.

I also fixed the typescript rule in existing oxlint.json from @typescript-eslint to typescript prefix. The ESLint config and script to run and parse Oxlint for metrics uploader is also revamped since we consolidate to Oxlint finally, reducing code paths.

npm run check:custom-rules is still good. The plugin files are still intact with their logic
image

Running rule tests with native node:test is super fun and good, ensuring no regression
image

Running the lint config only for custom rules is also all fine and dandy. It detected correctly violations
image

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N/A

TESTING INSTRUCTIONS

Green CI

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

…to Oxlint

Signed-off-by: hainenber <dotronghai96@gmail.com>
Signed-off-by: hainenber <dotronghai96@gmail.com>
… equivalent

Signed-off-by: hainenber <dotronghai96@gmail.com>
"@apache-superset/core": ["./packages/superset-core/src"],
"@apache-superset/core/*": ["./packages/superset-core/src/*"],
"@superset-ui/plugin-chart-*": ["./plugins/plugin-chart-*/src"],
"@superset-ui/plugin-chart-*": ["./plugins/plugin-chart-*/src"],

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is a duplication of above entry. Remove to avoid red underlining in IDEs

@bito-code-review

Copy link
Copy Markdown
Contributor

The requested file superset-frontend/tsconfig.json is not present in the provided pull request diff. As a result, I cannot verify or provide a correction for the duplication you mentioned.

Comment on lines +175 to +181
const oxlintCustomRuleOutput = execSync(
'npx oxlint --config oxlint.custom-lint-rules.mts --format json src',
{
encoding: 'utf8',
maxBuffer: 50 * 1024 * 1024, // 50MB buffer for large outputs
stdio: ['pipe', 'pipe', 'ignore'], // Ignore stderr
},

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.

Suggestion: This execSync throws whenever custom rules report errors, so the uploader exits before writing any metrics or backlog rows. [error handling]

Assessment: 🟠 Major · 🔁 Occurrence: Sometimes

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset-frontend/scripts/oxlint-metrics-uploader.js
**Line:** 175:181
**Comment:**
	*Error Handling: This `execSync` throws whenever custom rules report errors, so the uploader exits before writing any metrics or backlog rows.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Comment on lines +189 to +192
const {
metricsByRule: metricsByCustomRule,
occurrencesData: customRuleOccurrencesData,
} = parseOxlintResult(results);

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.

Suggestion: Custom diagnostics are parsed from results instead of oxlintCustomRuleResults, so custom-rule findings are omitted and standard findings are counted twice. [incorrect variable usage]

Assessment: 🟠 Major · 🔁 Occurrence: Sometimes

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset-frontend/scripts/oxlint-metrics-uploader.js
**Line:** 189:192
**Comment:**
	*Incorrect Variable Usage: Custom diagnostics are parsed from `results` instead of `oxlintCustomRuleResults`, so custom-rule findings are omitted and standard findings are counted twice.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

run: |
docker run --rm $TAG bash -c \
"npm i && npm run lint"
"npm i && npm run lint && node --import tsx --test custom-lint-rules/**/*.test.ts"

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.

Suggestion: The workflow runs only the standard Oxlint config and unit tests, so custom-rule violations in frontend source no longer fail CI. [incomplete implementation]

Assessment: 🟠 Major · 🔁 Occurrence: Often

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** .github/workflows/superset-frontend.yml
**Line:** 160:160
**Comment:**
	*Incomplete Implementation: The workflow runs only the standard Oxlint config and unit tests, so custom-rule violations in frontend source no longer fail CI.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

@bito-code-review bito-code-review Bot 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.

Code Review Agent Run #75e601

Actionable Suggestions - 1
  • superset-frontend/scripts/oxlint-metrics-uploader.js - 1
Additional Suggestions - 3
  • superset-frontend/oxlint.custom-lint-rules.mts - 1
    • Disable-directive regression · Line 65-65
      Setting `respectEslintDisableDirectives: false` makes oxlint ignore all `eslint-disable` comments. The old ESLint config respected them by default, and `src/visualizations/TimeTable/constants.ts` (lines 29, 31) still carries `eslint-disable-next-line theme-colors/no-literal-colors` suppressions that will now be reported as errors, inflating `lint-stats` metrics. Consider leaving it at the default `true`.
  • superset-frontend/scripts/oxlint-metrics-uploader.js - 2
    • Inconsistent log counts · Line 241-241
      The log mixes sources: `Object.keys(metricsByRule)` counts only the first oxlint run, while `finalizedConcurrencesData.length` counts merged occurrences from both runs. Use `Object.keys(mergedMetricsByRule)` so the reported unique-rules count is consistent with the occurrence count.
    • Misspelled variable name · Line 211-211
      `finalizedConcurrencesData` misspells "Occurrences" as "Concurrences", inconsistent with the sibling `occurrencesData`/`mergedOccurrencesData` variables it derives from. Rename to `finalizedOccurrencesData` for consistency and to avoid confusion when reading the merge/upload flow.
Review Details
  • Files reviewed - 5 · Commit Range: 9419f60..f6e9e61
    • superset-frontend/custom-lint-rules/theme-colors/no-literal-colors.test.ts
    • superset-frontend/eslint.config.minimal.js
    • superset-frontend/oxlint.custom-lint-rules.mts
    • superset-frontend/scripts/check-custom-rules.js
    • superset-frontend/scripts/oxlint-metrics-uploader.js
  • Files skipped - 5
    • .github/workflows/superset-frontend.yml - Reason: Filter setting
    • superset-frontend/oxlint.json - Reason: Filter setting
    • superset-frontend/package-lock.json - Reason: Filter setting
    • superset-frontend/package.json - Reason: Filter setting
    • superset-frontend/tsconfig.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 an incremental AI Review.

  • /review full - 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

Comment on lines +190 to +192
metricsByRule: metricsByCustomRule,
occurrencesData: customRuleOccurrencesData,
} = parseOxlintResult(results);

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.

Wrong variable in parse call

parseOxlintResult is called with results (the first oxlint run) instead of oxlintCustomRuleResults. The custom-rules run is parsed and logged but never processed, so metricsByCustomRule/customRuleOccurrencesData duplicate the main run's data and the custom rules are double-counted in mergedOccurrencesData. Pass oxlintCustomRuleResults.

Code suggestion
Check the AI-generated fix before applying
Suggested change
metricsByRule: metricsByCustomRule,
occurrencesData: customRuleOccurrencesData,
} = parseOxlintResult(results);
metricsByRule: metricsByCustomRule,
occurrencesData: customRuleOccurrencesData,
} = parseOxlintResult(oxlintCustomRuleResults);

Code Review Run #75e601


Should Bito avoid suggestions like this for future reviews? (Manage Rules)

  • Yes, avoid them

@codecov

codecov Bot commented Sep 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.15%. Comparing base (8e66145) to head (2fcc80e).

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #44201      +/-   ##
==========================================
- Coverage   80.17%   80.15%   -0.02%     
==========================================
  Files        2925     2925              
  Lines      172670   172533     -137     
  Branches    40087    40051      -36     
==========================================
- Hits       138435   138301     -134     
+ Misses      31638    31635       -3     
  Partials     2597     2597              
Flag Coverage Δ
javascript 75.66% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Signed-off-by: hainenber <dotronghai96@gmail.com>
@bito-code-review

bito-code-review Bot commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #2b6c69

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: f6e9e61..f2d02ff
    • superset-frontend/scripts/oxlint-metrics-uploader.js
  • Files skipped - 0
  • 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 an incremental AI Review.

  • /review full - 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

Signed-off-by: hainenber <dotronghai96@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies:npm github_actions Pull requests that update GitHub Actions code size/XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant