Bug: Node 22 - "Could not find exported rules
object in ESLint plugin." error
#615
Labels
bug
Something isn't working
rules
object in ESLint plugin." error
#615
I have updated Node to v22.x and I started to get
Could not find exported rules object in ESLint plugin.
error.Note
I'm able to reproduce the issue only using Node 22.13.0.
On Node 20.17.0 the issue is not present.
This PR contains a successful run and a failed run to show the issue
You can check node version inside "Install dependencies" step
Steps to reproduce the issue
pnpm install
pnpm run lint:docs
, no error should be presentpnpm run lint:docs
, the error should be presentInitial investigation
From my initial investigation the problem seems originated from
loadPlugin
function:eslint-doc-generator/lib/package-json.ts
Line 35 in a88f8cb
Inside the
require()
try
for CommonJSeslint-doc-generator/lib/package-json.ts
Lines 37 to 41 in a88f8cb
On Node 20 the
require
throws an error and the code inside the catch is executed.On the contrary, on Node 22 the
require
doesn't throw an error, and the plugin module is resolved.However the module itself is an ESModule, so instead of the plugin object the
loadPlugin
functionreturns a
{ __esModule: true, default: { /** plugin */ } }
I attached a screenshot of the debugger in this scenario
The text was updated successfully, but these errors were encountered: