Skip to content

Update eslint configuration to use new flat config instead of rushstack #12198 #13440

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

yashhash2
Copy link
Contributor

Summary

I have upgraded the old ESLint configuration to the new Flat Config format. The configuration file has been renamed to eslint.config.mjs, and the loading logic in index.js has been updated accordingly. I removed the extends property and replaced overrides with individual entries in the config array, as required by the Flat Config format. The setup has been tested using npx eslint . --debug to ensure it works correctly.

References

Issue #12198

Copy link
Contributor

github-actions bot commented May 31, 2025

@MisRob MisRob requested a review from rtibbles June 2, 2025 02:46
@rtibbles
Copy link
Member

Why has the file been renamed to an mjs file? This is causing issues for non-ESM compliant code in the codebase, so if there's not a compelling reason to do this rename, it might be easier to keep it as a .js file.

Copy link
Member

@rtibbles rtibbles left a comment

Choose a reason for hiding this comment

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

A little bit more cleanup required - some for sure, some I have questions about.

eslint.config.js Outdated
import { modernModuleResolution } from '@rushstack/eslint-patch/modern-module-resolution';
import kolibriConfig from 'kolibri-format/eslint.config.mjs';

modernModuleResolution();
Copy link
Member

Choose a reason for hiding this comment

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

Is this still necessary? We had originally introduced rushstack so as not to update to the flat config just yet, so I was hoping that switching would remove this dependency.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah this is not needed.

@@ -1,5 +1,6 @@
{
Copy link
Member

Choose a reason for hiding this comment

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

I can't comment on the file directly, as it is too large, but you should not commit the package-lock.json.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah maybe due to some bug or error it got commited

eslint.config.js Outdated
@@ -0,0 +1,8 @@
import { modernModuleResolution } from '@rushstack/eslint-patch/modern-module-resolution';
import kolibriConfig from 'kolibri-format/eslint.config.mjs';
Copy link
Member

Choose a reason for hiding this comment

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

I don't see a file called eslint.config.mjs in the kolibri-format package any more, so I suspect this may not be working?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah i changed it.

@@ -1,5 +1,6 @@
{
"name": "kolibri-root",
"type": "module",
Copy link
Member

Choose a reason for hiding this comment

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

Is this update still needed if we have no .mjs files in the package?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need to keep "type": "module" because we're using ESM syntax (e.g., import/export) in .js files. Since we're renaming the config to eslint.config.js and it's written using ESM, this setting is required for Node to interpret it correctly.

@@ -0,0 +1,368 @@
import js from '@eslint/js';
Copy link
Member

Choose a reason for hiding this comment

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

I assume the rename is a convention change for the flat config?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes

@rtibbles rtibbles self-assigned this Jun 19, 2025
try {
esLintConfig = require(`${hostProjectDir}/.eslintrc`);
Copy link
Member

Choose a reason for hiding this comment

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

Did using a dynamic import() statement in place of the require not work here?

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

Successfully merging this pull request may close these issues.

2 participants