rushstack icon indicating copy to clipboard operation
rushstack copied to clipboard

[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

Open Ahmed-Hesham123 opened this issue 2 years ago • 9 comments

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

Ahmed-Hesham123 avatar Aug 30 '23 18:08 Ahmed-Hesham123

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

AYColumbia avatar Sep 05 '23 14:09 AYColumbia

@octogonz - care to take a look at this?

iclanton avatar Oct 09 '23 18:10 iclanton

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

dilshad17 avatar Oct 30 '23 11:10 dilshad17

@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 avatar Nov 01 '23 22:11 octogonz

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

https://github.com/microsoft/rushstack/pull/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 avatar Nov 01 '23 23:11 octogonz

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 avatar Nov 07 '23 00:11 AYColumbia

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.

AYColumbia avatar Nov 20 '23 14:11 AYColumbia

Is there any update on that issue?

rgrzesk avatar Aug 19 '24 11:08 rgrzesk

??

Loque18 avatar Jun 11 '25 02:06 Loque18