Skip to content
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

[eslint-config] Failed to patch ESLint because the calling module was not recognized using @rushstack/eslint-patch with ESLint 9.17.0 #5075

Closed
TkachenkoKaterina opened this issue Jan 11, 2025 · 5 comments
Labels
effort: medium Needs a somewhat experienced developer help wanted If you're looking to contribute, this issue is a good place to start!

Comments

@TkachenkoKaterina
Copy link

Summary

I encountered an issue when trying to run ESLint with @rushstack/eslint-patch. The following error is thrown:
Error: Failed to patch ESLint because the calling module was not recognized.
If you are using a newer ESLint version that may be unsupported, please create a GitHub issue:
https://github.com/microsoft/rushstack/issues

Repro steps

1.Install dependencies
npm install [email protected] [email protected] @rushstack/[email protected]
2.Create eslint.config.js with the following content
import tailwindcss from "eslint-plugin-tailwindcss";
import eslintConfigNext from "eslint-config-next";

export default [
...eslintConfigNext().flatMap((config) => config),

{
files: ["**/*.{js,jsx,ts,tsx}"],
plugins: {
tailwindcss,
},
rules: {
"tailwindcss/classnames-order": "warn",
"tailwindcss/no-custom-classname": "off",
},
settings: {
"import/resolver": {
typescript: {},
},
},
},
];
3.Run ESLint:
npx eslint . --fix

Expected result:
ESLint should run successfully and apply linting rules as per the configuration.
Actual result:
The following error is thrown:
Oops! Something went wrong! :(

ESLint: 9.17.0

Error: Failed to patch ESLint because the calling module was not recognized.
If you are using a newer ESLint version that may be unsupported, please create a GitHub issue:
https://github.com/microsoft/rushstack/issues

Details

The issue appears to be related to @rushstack/eslint-patch not recognizing the calling module. I have ensured that the installed versions of eslint, eslint-config-next, and @rushstack/eslint-patch are compatible based on their peer dependency requirements.

Installed dependencies:
npm list eslint eslint-config-next @rushstack/eslint-patch
├── @rushstack/[email protected]
├─┬ [email protected]
│ ├── @rushstack/[email protected] deduped
│ ├─┬ @typescript-eslint/[email protected]
│ │ ├─┬ @typescript-eslint/[email protected]
│ │ │ └── [email protected] deduped
│ │ ├─┬ @typescript-eslint/[email protected]
│ │ │ └── [email protected] deduped
│ │ └── [email protected] deduped
│ ├─┬ @typescript-eslint/[email protected]
│ │ └── [email protected] deduped
│ ├─┬ [email protected]
│ │ └── [email protected] deduped
│ ├─┬ [email protected]
│ │ └── [email protected] deduped
│ ├─┬ [email protected]
│ │ └── [email protected] deduped
│ ├─┬ [email protected]
│ │ └── [email protected] deduped
│ ├─┬ [email protected]
│ │ └── [email protected] deduped
│ └── [email protected] deduped
└─┬ [email protected]
└─┬ @eslint-community/[email protected]
└── [email protected] deduped

I have also tried removing and reinstalling these dependencies, but the issue persists.

Standard questions

Please answer these questions to help us investigate your issue more quickly:

Question Answer
@rushstack/eslint-config version? N/A
Operating system? MacOS
Would you consider contributing a PR? No
TypeScript compiler version? 5.7.3
Node.js version (node -v)? v20.14.0
@lumirlumir
Copy link

lumirlumir commented Jan 11, 2025

I have the same problem. Now I'm using ESLint v9.17.0 too.

@iclanton
Copy link
Member

Something probably changed in a minor version of ESLint. Which patch are you trying to apply? You aren't importing anything from @rushstack/eslint-patch in your ESLint config.

We also don't explicitly support flat ESLint configs yet, although it may work in some cases.

@iclanton iclanton moved this from Needs triage to Needs Investigation in Bug Triage Jan 13, 2025
@iclanton
Copy link
Member

@D4N14L, if you have some time would you mind taking a look at this? We could start by putting together a build-tests/eslint-9-test project in this repo and working through issues. It's probably also time to start exploring explicitly supporting flat config for the bulk suppressions patch (the modern-module-resolution patch isn't necessary in a flat config).

@iclanton iclanton added help wanted If you're looking to contribute, this issue is a good place to start! effort: medium Needs a somewhat experienced developer labels Jan 13, 2025
@iclanton
Copy link
Member

Looks like eslint-config-next is pulling in @rushstack/eslint-patch/modern-module-resolution internally.

@iclanton
Copy link
Member

Closing this as a duplicate of #5049.

@github-project-automation github-project-automation bot moved this from Needs Investigation to Closed in Bug Triage Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort: medium Needs a somewhat experienced developer help wanted If you're looking to contribute, this issue is a good place to start!
Projects
Status: Closed
Development

No branches or pull requests

3 participants