Skip to content

Conversation

@p-stam001
Copy link

This PR updates ESLint from v8 to v9 and migrates the config to a flat ES5/CommonJS format.

And it updates all dependencies related also.

TypeScript support via @typescript-eslint/parser and plugin is preserved.

Browser and Node globals are included.

Overrides for ESLint config files (.eslintrc.js/.cjs) added.

Removed the need for --legacy-config in pnpm lint.

Linting passes locally and in CI. No runtime or functional changes.

Also this PR includes the changes of these PRs #56 #51 #52 #53

@p-stam001 p-stam001 requested a review from a team as a code owner October 14, 2025 14:59
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 14, 2025

Walkthrough

Adds a new flat ESLint config eslint.config.cjs exporting two layered configs via defineConfig/FlatCompat (TypeScript/browser and Node/ESLint-config files) and removes the legacy .eslintrc.cjs file. No custom rule overrides were introduced.

Changes

Cohort / File(s) Summary
ESLint flat config (added)
eslint.config.cjs
Adds eslint.config.cjs exporting defineConfig([...]) via module.exports. Provides two configs merged with FlatCompat: (1) targets **/*.{ts,tsx} using @typescript-eslint/parser, ecmaVersion: "latest", sourceType: "module", env.browser: true, extends eslint:recommended and plugin:@typescript-eslint/recommended, and registers @typescript-eslint plugin; (2) targets **/.eslintrc.{js,cjs} with env.node: true, sourceType: "script", and applies ESLint JS config utilities. No custom rules.
ESLint legacy config (removed)
.eslintrc.cjs
Removes the legacy .eslintrc.cjs which previously exported an ESLint configuration (env, extends, overrides for .eslintrc.{js,cjs}, @typescript-eslint/parser, parserOptions, plugins, rules).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Review eslint.config.cjs to confirm layered targets and correct usage of FlatCompat/defineConfig.
  • Verify removal of .eslintrc.cjs doesn't leave tooling expecting the old format (CI/editor integrations).

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The pull request title "migrated eslint from v8 to v9 and updated dependencies version related" directly describes the main changes in the changeset. The raw summary confirms that the PR involves replacing the old .eslintrc.cjs configuration (v8 format) with a new eslint.config.cjs file (v9 flat configuration format), which aligns precisely with the title's claim of migrating ESLint from v8 to v9. The title is clear, specific, and accurately summarizes the primary change without unnecessary noise or vague language.
Description Check ✅ Passed The pull request description is clearly related to the changeset and provides meaningful information about the migration. It explains the upgrade from ESLint v8 to v9, the configuration format change to flat ES5/CommonJS, dependency updates, preservation of TypeScript support, and the removal of the --legacy-config flag requirement. All described aspects align with the actual changes shown in the raw summary, and the description adds helpful context about the rationale and status of the changes.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 513d8f3 and 822014e.

📒 Files selected for processing (1)
  • .eslintrc.cjs (0 hunks)
💤 Files with no reviewable changes (1)
  • .eslintrc.cjs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (2)
eslint.config.cjs (2)

26-26: Remove redundant empty parserOptions.

The empty parserOptions: {} objects on lines 26 and 47 serve no purpose and can be removed for cleaner code.

Apply this diff:

       parser: tsParser,
       ecmaVersion: "latest",
       sourceType: "module",
-      parserOptions: {},
     },

And:

       },
 
       sourceType: "script",
-      parserOptions: {},
     },

Also applies to: 47-47


16-52: Consider adding ignore patterns.

The configuration lacks ignore patterns for common directories that should not be linted, such as node_modules, dist, build, or coverage directories.

Add an ignores configuration:

module.exports = defineConfig([
  {
    ignores: ["node_modules/", "dist/", "build/", "coverage/", "*.config.js"],
  },
  // ... rest of configs
]);
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a93e6fa and 922f647.

⛔ Files ignored due to path filters (2)
  • package.json is excluded by !**/*.json
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml, !**/*.yaml
📒 Files selected for processing (1)
  • eslint.config.cjs (1 hunks)

@@ -0,0 +1,52 @@
const { defineConfig } = require("eslint/config");
Copy link
Contributor

@coderabbitai coderabbitai bot Oct 14, 2025

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Fix the import path for defineConfig.

In ESLint v9, defineConfig is exported from "eslint" directly, not from "eslint/config". This will cause a module resolution error.

Apply this diff:

-const { defineConfig } = require("eslint/config");
+const { defineConfig } = require("eslint");
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const { defineConfig } = require("eslint/config");
const { defineConfig } = require("eslint");
🤖 Prompt for AI Agents
In eslint.config.cjs around line 1, the require currently imports defineConfig
from "eslint/config" which causes module resolution errors in ESLint v9; update
the import to require defineConfig from "eslint" instead (replace
require("eslint/config") with require("eslint")) so defineConfig is loaded from
the correct module.

Copy link
Author

Choose a reason for hiding this comment

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

That's is not correct in eslint v9

we should keep this line.

const { defineConfig } = require("eslint/config");

Copy link
Contributor

Choose a reason for hiding this comment

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

🧩 Analysis chain

🌐 Web query:

ESLint v9 defineConfig import path eslint/config

💡 Result:

Use the flat-config helper exported from "eslint/config". Example:

import { defineConfig } from "eslint/config";

export default defineConfig([
{ files: ["**/*.js"], rules: { semi: "error" } },
]);

(ESLint docs show defineConfig imported from "eslint/config".) [1][2]

Sources:
[1] ESLint — Configuration files.
[2] ESLint — Configuration migration guide.


@p-stam001, you're absolutely right, and I apologize for the incorrect suggestion. In ESLint v9, defineConfig is indeed exported from "eslint/config", not from "eslint" directly. The original line in your PR is correct:

const { defineConfig } = require("eslint/config");

According to the ESLint v9 documentation, the flat-config helper defineConfig should be imported from "eslint/config". Thank you for the correction!


✏️ Learnings added
Learnt from: p-stam001
PR: kinde-oss/kinde-remix-sdk#59
File: eslint.config.cjs:1-1
Timestamp: 2025-10-22T05:59:01.328Z
Learning: In ESLint v9, the `defineConfig` helper is exported from `"eslint/config"`, not from `"eslint"` directly. The correct import is: `const { defineConfig } = require("eslint/config");` for CommonJS or `import { defineConfig } from "eslint/config";` for ES modules.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

@Koosha-Owji
Copy link

@p-stam001 I think we can safely go ahead and delete the old .eslintrc.cjs here

@p-stam001
Copy link
Author

@p-stam001 I think we can safely go ahead and delete the old .eslintrc.cjs here

yea, then I will commit after delete the old .eslintrc.cjs

@codecov
Copy link

codecov bot commented Nov 11, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@onderay onderay requested a review from DanielRivers November 11, 2025 05:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants