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-plugin-packlets] Failed to patch ESLint because the calling module was not recognized. If you are using a newer ESLint version that may be unsupported #4301

Open
Ahmed-Hesham123 opened this issue Aug 30, 2023 · 8 comments
Labels
needs more info We can't proceed because we need a better repro or an answer to a question

Comments

@Ahmed-Hesham123
Copy link

Summary

Cannot read config file: node_modules\eslint-config-react-app\jest.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

Repro steps

Expected result:
Successfully
Actual result:
Cannot read config file: 01-starting-project 2\node_modules\eslint-config-react-app\jest.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: 01-starting-project 2\package.json

Details

At first when I was tried to install styled component to react project I forget d and write style instead of styled then I installed it again.

Standard questions

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

Question Answer
@rushstack/eslint-plugin-packlets version?
Operating system? Windows
Would you consider contributing a PR?
TypeScript compiler version?
Node.js version (node -v)? 20.5.0
@AYColumbia
Copy link

I'm not sure if I should create a new issue or add to this one as they seem to be part of the same underlying problem. Let me know if you want mine as a separate report.

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: ...\node_modules\eslint-config-react-app\index.js

My eslint modules/plugins and versions installed:
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]

The error occurred after I opened my babel.config.js. This was also done after I had cleaned out eslint via:

  • delete package-lock.json
  • delete .eslintrc.js
  • remove eslint entries from package.json
  • run npm install
  • run npm install with the eslint modules

OS: Windows 10 22H2
Node: 20.5.1

I also tried to use the JSON format instead, i.e., renamed babel.config.js to babel.config.json (and changed content to match format) but VS now keeps reporting it can't find babel.config.json, e.g., when I open App.js it reports:

Severity	Code	Description	Project	File	Line	Suppression State
Error (active)	(ESLint) 	Parsing error: Cannot find module 'babel.config.json'
Require stack:
- ...\auth-react-app\node_modules\@babel\core\lib\config\files\configuration.js
- ...\auth-react-app\node_modules\@babel\core\lib\config\files\index.js
- ...\auth-react-app\node_modules\@babel\core\lib\index.js
- ...\auth-react-app\node_modules\@babel\eslint-parser\lib\worker\babel-core.cjs
- ...\auth-react-app\node_modules\@babel\eslint-parser\lib\worker\handle-message.cjs
- ...\auth-react-app\node_modules\@babel\eslint-parser\lib\client.cjs
- ...\auth-react-app\node_modules\@babel\eslint-parser\lib\index.cjs
- ...\auth-react-app\node_modules\eslint\node_modules\@eslint\eslintrc\dist\eslintrc.cjs	auth-react-app	...\auth-react-app\src\App.js

@iclanton iclanton moved this to Needs triage in Bug Triage Oct 2, 2023
@iclanton
Copy link
Member

iclanton commented Oct 9, 2023

@octogonz - care to take a look at this?

@iclanton iclanton moved this from Needs triage to Needs Investigation in Bug Triage Oct 9, 2023
@dilshad17
Copy link

I am also getting same error while running code climate

$ docker pull --quiet "$CODE_QUALITY_IMAGE"
registry.gitlab.com/gitlab-org/ci-cd/codequality:0.96.0
$ docker run --rm \ # collapsed multi-line command
error: (CC::CLI::Analyze::EngineFailure) engine eslint failed with status 1 and stderr
/usr/local/node_modules/@rushstack/eslint-patch/lib/_patch-base.js:164
throw new Error('Failed to patch ESLint because the calling module was not recognized.\n' +
^
Error: Cannot read config file: /code/.eslintrc.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
at Object. (/usr/local/node_modules/@rushstack/eslint-patch/lib/_patch-base.js:164:19)
at Module._compile (node:internal/modules/cjs/loader:1097:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1149:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:999:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object. (/usr/local/node_modules/@rushstack/eslint-patch/lib/modern-module-resolution.js:11:23)
at Module._compile (node:internal/modules/cjs/loader:1097:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1149:10)
Node.js v17.3.1
Could not analyze code quality for the repository at /code

@octogonz
Copy link
Collaborator

octogonz commented Nov 1, 2023

@Ahmed-Hesham123 the @rushstack/eslint-plugin-packlets package does not patch ESLint. Is that the right package name?

I think maybe you meant to report an issue for @rushstack/eslint-patch?

@octogonz
Copy link
Collaborator

octogonz commented Nov 1, 2023

I tried to reproduce the error using [email protected] as reported by @AYColumbia by creating this branch:

#4415

...and then running these commands:

rush install
rush build --verbose --to eslint-8-test

However the project lints successfully.

Could someone provide more detailed repro instructions including your exact ESLint version?

@octogonz octogonz added the needs more info We can't proceed because we need a better repro or an answer to a question label Nov 1, 2023
@AYColumbia
Copy link

I tried to reproduce the error using [email protected] as reported by @AYColumbia by creating this branch:

#4415

...and then running these commands:

rush install
rush build --verbose --to eslint-8-test

However the project lints successfully.

Could someone provide more detailed repro instructions including your exact ESLint version?

I'll see what I can do this week to check on this as I've had many updates since I posted my issue. It may be the end of the week though.

@AYColumbia
Copy link

AYColumbia commented Nov 20, 2023

I finally got around to this issue. I reinstalled eslint and babel plugin and am still having problems. The versions are as follows:

+-- [email protected]
+-- [email protected]

babel info:
+-- @babel/[email protected]
+-- @babel/[email protected]
+-- @babel/[email protected]
+-- @babel/[email protected]

I'm still having an issue with the babel.config.js file. In my .eslintrc.js file I have this for my parser options:

  "parserOptions": {
    "allowImportExportEverywhere": true,
    "requireConfigFile": false,
    "babelOptions": {
      "configFile": "babel.config.js",
      "presets": ["@babel/preset-env", "@babel/preset-react"]
    },
    "ecmaVersion": 2020,
    "ecmaFeatures": {
      "impliedStrict": true,
      "jsx": true
    },
    "sourceType": "module"
  },

When I open the babel.config.js file, which has only the code below, I get the error that follows. I'm in Visual Studio 2022.

module.exports = function(api)
{
    api.cache(true);
    const presets = [{
        "presets": ["@babel/preset-env", "@babel/preset-react"]
    }];
    return {
        presets
    };
};

Eslint error when opening babel.config.js

Severity	Code	Description	Project	File	Line	Suppression State
Error (active)	(ESLint) 	Parsing error: Cannot find module 'babel.config.js'
Require stack:
- D:\Client\...\web-ar-app\node_modules\@babel\core\lib\config\files\configuration.js
- D:\Client\...\web-ar-app\node_modules\@babel\core\lib\config\files\index.js
- D:\Client\...\web-ar-app\node_modules\@babel\core\lib\index.js
- D:\Client\...\web-ar-app\node_modules\@babel\eslint-parser\lib\worker\babel-core.cjs
- D:\Client\...\web-ar-app\node_modules\@babel\eslint-parser\lib\worker\handle-message.cjs
- D:\Client\...\web-ar-app\node_modules\@babel\eslint-parser\lib\client.cjs
- D:\Client\...\web-ar-app\node_modules\@babel\eslint-parser\lib\index.cjs
- D:\Client\...\web-ar-app\node_modules\@eslint\eslintrc\dist\eslintrc.cjs	web-ar-app	D:\Client\...\web-ar-app\babel.config.js	1	

Running eslint from the CLI returns 0:0 error Parsing error: Cannot find module 'babel.config.js' for every JS file it tries to lint.

Let me know if any additional info is needed or if you want me to try anything else. Thank you.

@rgrzesk
Copy link

rgrzesk commented Aug 19, 2024

Is there any update on that issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs more info We can't proceed because we need a better repro or an answer to a question
Projects
Status: Needs Investigation
Development

No branches or pull requests

6 participants