eslint / markdown

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

feat: Add Markdown languages #268

Closed nzakas closed 2 months ago

nzakas commented 3 months ago

This pull request adds two markdown languages to the plugin:

It also adds several rules that apply to Markdown content. These are all intended to find problems and not to format the document. I've included documentation for each rule.

I changed the recommended config to be for linting Markdown content, not using the processor. There is a new processor config that implements the old recommended config.

Note on types: Because the @types/eslint package defines types specific to ESTree, I can't really add more types into the rules until we have a more generic type definition for rules. I use RuleModule to ensure that the plugin itself will type check correctly, but that definition doesn't allow visitor methods for non-ESTree values.

Refs #160

nzakas commented 3 months ago

Added a new no-invalid-label-ref rule to account for the cases mentioned in https://github.com/eslint/markdown/pull/268#discussion_r1715472241

nzakas commented 2 months ago

I updated no-invalid-label-refs so that it highlights the brackets rather than the label. I think that makes more sense because it's the brackets that are the problem.

fasttime commented 2 months ago

Just the above note, then LGTM.

nzakas commented 2 months ago

Thanks! Yeah Markdownlint has some other options for these rules that allow for more edge cases, but I wanted to start simple. We can always add more options to the rules as we go.