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-patch] ESLint 9 - Failed to patch ESLint because the calling module was not recognized. #4965

Open
Bwvolleyball opened this issue Oct 10, 2024 · 5 comments

Comments

@Bwvolleyball
Copy link

Summary

Trying to use ESLint 9 with this plugin, which supposedly it should support now, but I can't get it to work.

Repro steps

Trying to import the plugin from eslint.config.mjs:

import '@rushstack/eslint-patch/eslint-bulk-suppressions.js';

but all I get when I run eslint \"src/**/*.{ts,tsx,js}\" is:

Oops! Something went wrong! :(

ESLint: 9.12.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
    at Object.<anonymous> (/Users/brandon.ward/Code/raptor-ui/node_modules/@rushstack/eslint-patch/lib/_patch-base.js:167:19)
    at Module._compile (node:internal/modules/cjs/loader:1364:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
    at Module.load (node:internal/modules/cjs/loader:1203:32)
    at Module._load (node:internal/modules/cjs/loader:1019:12)
    at Module.require (node:internal/modules/cjs/loader:1231:19)
    at require (node:internal/modules/helpers:177:18)
    at Object.<anonymous> (/Users/brandon.ward/Code/raptor-ui/node_modules/@rushstack/eslint-patch/lib/modern-module-resolution.js:11:23)
    at Module._compile (node:internal/modules/cjs/loader:1364:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)

Details

We migrated ESLint to Version 9, and then this patch plugin started breaking.

Standard questions

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

Question Answer
Package name: @rushstack/eslint-patch
Package version? 1.10.4
Operating system? Mac
Would you consider contributing a PR? Maybe? I don't understand the issue though
Node.js version (node -v)? 18.20.4
@iclanton
Copy link
Member

Yeah eslint-bulk-suppressions currently don't support ESLint 9. @octogonz - can your team take a look at this?

@iclanton iclanton moved this from Needs triage to Low priority in Bug Triage Oct 23, 2024
@kachkaev
Copy link

kachkaev commented Oct 28, 2024

Possibly related issue: eslint/config-inspector#70 (see reproduction steps in the third comment).

@kirill-konshin
Copy link

kirill-konshin commented Oct 30, 2024

@iclanton can you please elaborate why this ticket was marked as low priority?

It also fails in basic scenario of shareable config with ESLint 9...

Here's an example of such config: https://www.npmjs.com/package/@kirill.konshin/eslint-config-next-custom?activeTab=code

This is the usage:

import defaultConfig from '@kirill.konshin/eslint-config-next-custom';

export default [
  ...defaultConfig,
  {
    ignores: [ ... ],
  },
];

Error:

Error: Cannot read config file: /x/node_modules/eslint-config-next/index.js
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
Referenced from: 
    at Object.<anonymous> (/x/node_modules/@rushstack/eslint-patch/lib/_patch-base.js:167:19)

@kirill-konshin
Copy link

Related issue #4635 (comment) — I have added reproducible scenarios. It seems it has something to do with Yarn Berry.

@boringplay
Copy link

I also encountered the same error.

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

No branches or pull requests

5 participants