Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions .eslintrc.cjs

This file was deleted.

47 changes: 47 additions & 0 deletions eslint.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
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.


const globals = require("globals");
const tsParser = require("@typescript-eslint/parser");
const typescriptEslint = require("@typescript-eslint/eslint-plugin");
const js = require("@eslint/js");

const { FlatCompat } = require("@eslint/eslintrc");

const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});

module.exports = defineConfig([
...compat.extends(
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
),
{
files: ["**/*.ts", "**/*.tsx"],
languageOptions: {
globals: {
...globals.browser,
},

parser: tsParser,
ecmaVersion: "latest",
sourceType: "module",
parserOptions: {},
},
plugins: {
"@typescript-eslint": typescriptEslint,
},
rules: {},
},
{
files: ["**/.eslintrc.{js,cjs}"],
languageOptions: {
globals: {
...globals.node,
},
sourceType: "script",
},
},
]);
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^12.1.2",
"@types/node": "^20.10.7",
"@typescript-eslint/eslint-plugin": "^7.6.0",
"@typescript-eslint/parser": "^7.6.0",
"@typescript-eslint/eslint-plugin": "^8.46.1",
"@typescript-eslint/parser": "^8.46.1",
"@vitest/coverage-v8": "^1.4.0",
"eslint": "^8.57.0",
"eslint": "^9.37.0",
"eslint-config-standard-with-typescript": "^43.0.1",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-n": "^16.6.2",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-import": "^2.32.0",
"eslint-plugin-n": "^17.23.1",
"eslint-plugin-promise": "^7.2.1",
"genversion": "^3.2.0",
"prettier": "^3.2.5",
"release-it": "^17.1.1",
Expand Down
Loading