eslint / markdown

Lint JavaScript code blocks in Markdown documents
MIT License
406 stars 63 forks source link

Bug: Error while loading rule 'no-irregular-whitespace': sourceCode.getAllComments is not a function #272

Closed ocavue closed 2 months ago

ocavue commented 2 months ago

Environment

ESLint version: 9.9.0 @eslint/markdown version: 6.0.0 Node version: v18.20.2 npm version: pnpm 8.15.9 Operating System: macOS

Which language are you using?

commonmark

What did you do?

After updating from eslint-plugin-markdown v5 to @eslint/markdown v6, I get the following error:

TypeError: Error while loading rule 'no-irregular-whitespace': sourceCode.getAllComments is not a function

Minimal repo:

What did you expect to happen?

No error.

What actually happened?

TypeError: Error while loading rule 'no-irregular-whitespace': sourceCode.getAllComments is not a function

Link to Minimal Reproducible Example

https://stackblitz.com/github/issueset/eslint-markdown-v6-issue

Participation

Additional comments

No response

fasttime commented 2 months ago

Thanks for the report @ocavue, I can reproduce the issue. There have been some breaking changes in v6, but unfortunately, we haven't added migration instructions for this plugin yet. One of the changes is that what was previously the recommended config is now named processor. The config name was changed to make room for a recommended config that includes language capabilities, one of the newest features in ESLint, also to be documented.

To fix your config file use the processor config instead of recommended for @eslint/markdown v6.

Demo: https://stackblitz.com/edit/github-qwd2hs?file=eslint.config.mjs

ocavue commented 2 months ago

@fasttime Thanks! That works.