eslint / eslint-plugin-markdown

Lint JavaScript code blocks in Markdown documents

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Skip parsing disabled code sections

ehmicky opened this issue · comments

Let's say I have a module dummy that returns a promise. I might want to document it like this:

`dummy` returns a promise and take an options object as argument:

``​`js
const returnValue = await dummy(options)
``​`

This throws an exception because espree does not allow top-level await.

A possible solution to this problem would be to skip parsing code sections that are skipped with a <!-- eslint-disable --> comment. Any other solution to this problem would work as well :)

It seems like you're looking for the <!-- eslint-skip --> directive -- based on the readme, it seems like that directive has the effect of not parsing the code sample.

Thanks @not-an-aardvark! Sorry for not reading the README properly :/