-
- Notifications
You must be signed in to change notification settings - Fork 169
Closed
Description
Action
$ pnpm exec eslint (from PowerShell on Windows 10)
Expected behavior
ESLint runs correctly.
Actual behavior
Oops! Something went wrong! :( ESLint: 9.29.0 Error [ERR_REQUIRE_ESM]: require() of ES Module C:\...\node_modules\.pnpm\are-docs-informative@0.1.1\node_modules\are-docs-informative\lib\index.js from C:\...\node_modules\.pnpm\eslint-plugin-jsdoc@51.0.1_eslint@9.29.0\node_modules\eslint-plugin-jsdoc\dist\rules\informativeDocs.cjs not supported. Instead change the require of index.js in C:\...\node_modules\.pnpm\eslint-plugin-jsdoc@51.0.1_eslint@9.29.0\node_modules\eslint-plugin-jsdoc\dist\rules\informativeDocs.cjs to a dynamic import() which is available in all CommonJS modules. at Object.<anonymous> (C:\...\node_modules\.pnpm\eslint-plugin-jsdoc@51.0.1_eslint@9.29.0\node_modules\eslint-plugin-jsdoc\dist\rules\informativeDocs.cjs:8:27) ESLint Config
// eslint.config.mjs import { defineConfig } from "eslint/config"; import jsdoc from "eslint-plugin-jsdoc"; import path from "node:path"; import { fileURLToPath } from "node:url"; import js from "@eslint/js"; import { FlatCompat } from "@eslint/eslintrc"; import tsParser from "@typescript-eslint/parser"; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); const compat = new FlatCompat({ baseDirectory: __dirname, recommendedConfig: js.configs.recommended, allConfig: js.configs.all }); export default defineConfig([{ languageOptions: { parser: tsParser, }, extends: compat.extends("plugin:jsdoc/recommended"), plugins: { jsdoc, }, files: ["**/*.ts"] }]);Solution
Instead of using recommended rules I used list of rules from npm eslint-plugin-jsdoc webpage and commented out rule jsdoc/informative-docs.
Environment
- Node version: 20.17.0
- ESLint version 9.29.0
eslint-plugin-jsdocversion: 51.0.1