Skip to content

ROX-37653: Rewrite ESLint config as ECMAScript module - #23503

Open
pedrottimark wants to merge 2 commits into
masterfrom
ROX-37653-eslint.config.mjs
Open

pedrottimark wants to merge 2 commits into
masterfrom
ROX-37653-eslint.config.mjs

Conversation

@pedrottimark

@pedrottimark pedrottimark commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Description

Problems

  1. ESLint 9 reached End of Life (EOL) status on 2026-07-10

    https://eslint.org/version-support/

  2. Plugins not compatible with ESLint 10

  3. Plugin replacements support for CommonJS require

    • eslint-plugin-import-x package does support require

      const { importX: pluginImportX } = require('eslint-plugin-import-x');
    • @eslint-react/eslint-plugin package does not support require

      Neither without nor with .default

      const pluginReact = require('@eslint-react/eslint-plugin');

      Oops! Something went wrong! :(

      ESLint: 10.13.0

      Error ERR_PACKAGE_PATH_NOT_EXPORTED: No "exports" main defined in ui/apps/platform/node_modules/@eslint-react/eslint-plugin/package.json

Analysis

  1. ECMAScript modules

    https://nodejs.org/api/esm.html

    ECMAScript modules are the official standard format to package JavaScript code for reuse.

    Authors can tell Node.js to interpret JavaScript as an ES module via the .mjs file extension, the package.json "type" field with a value "module"

    Inversely, authors can explicitly tell Node.js to interpret JavaScript as CommonJS via the .cjs file extension, the package.json "type" field with a value "commonjs"

  2. Find in Files require( in ui/apps/platform has 58 results in 16 files

    Alternative to type: "module" in package.json file which would imply changes:

    • Replace require with import and add file extensions
    • Replace exports with export
  3. ESLint supports eslint.config.mjs file name:

    https://eslint.org/docs/latest/use/configure/configuration-files#configuration-file

  4. Search Use of .mjs extension in Node.js project that has type commonjs

    .mjs file can seamlessly import your traditional CommonJS files. However, you must use import syntax and provide the exact file extension.

Solution

  1. Rename and rewrite eslint.config.mjs file

    • Replace require with import statement
    • Replace module.exports with export default statement
    • Replace __dirname with import.meta.dirname

User-facing documentation

  • CHANGELOG.md update is not needed
  • documentation PR is not needed

Testing and quality

  • the change is production ready: the change is GA
  • CI results are inspected

Automated testing

  • added unit tests
  • added e2e tests
  • added regression tests
  • added compatibility tests
  • modified existing tests

How I validated my change

  1. npm run tsc in ui/apps/platform folder.
  2. npm run lint:fast-dev in ui/apps/platform folder.

@pedrottimark
pedrottimark requested a review from a team as a code owner October 19, 2026 18:30
@codecov

codecov Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 51.96%. Comparing base (0ce23fd) to head (d48b862).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #23503      +/-   ##
==========================================
- Coverage   52.01%   51.96%   -0.05%     
==========================================
  Files        2914     2914              
  Lines      183753   183753              
==========================================
- Hits        95574    95495      -79     
- Misses      79835    79895      +60     
- Partials     8344     8363      +19     
Flag Coverage Δ
go-unit-tests 51.96% <ø> (-0.05%) ⬇️

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:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

🚀 Build Images Ready

Images are ready for commit d48b862. To use with deploy scripts:

export MAIN_IMAGE_TAG=5.1.x-306-gd48b862788

@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Central YAML (base), Organization UI (inherited)
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 95e65fa6-3cc7-45da-8d85-229c57aa11df
📥 Commits

Reviewing files that changed from the base of the PR and between 0ce23fd and d48b862.

📒 Files selected for processing: 2
  • tools/allowed-large-files
  • ui/apps/platform/eslint.config.mjs

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

📝 Summary

Summary by CodeRabbit

  • Chores
    • Updated the platform app’s linting configuration format. Existing lint rules and app behavior remain unchanged, so there are no visible changes to the user experience.

The platform ESLint configuration was converted from CommonJS to ECMAScript modules. Path references now use import.meta.dirname, and the large-file allowlist points to eslint.config.mjs.

Changes: Platform ESLint configuration

Layer / File(s) Summary
Convert the ESLint configuration to ECMAScript modules
ui/apps/platform/eslint.config.mjs, tools/allowed-large-files
The configuration uses ESM imports and a default export. Path references use import.meta.dirname. The allowlist entry now names eslint.config.mjs.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Refactor

Suggested reviewers: dvail

Merge Risk: ⚪ Minimal · up to d48b8

The configuration conversion has no identified merge-blocking issue; it is ready for normal checks.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: rewriting the ESLint configuration as an ECMAScript module.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The pull request description is complete and follows the repository template. It explains the problem and solution, documents user-facing impact, records testing and quality checks, and lists validati…
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1 files. (1 skipped: 1 unsupported.)

Full details: Description check

Explanation

The pull request description is complete and follows the repository template. It explains the problem and solution, documents user-facing impact, records testing and quality checks, and lists validation commands. No automated tests were added, but the validation section identifies the checks that were run.

✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

This branch has not been deployed

No deployments
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