leo-buneev / eslint-plugin-md

Allows you to lint markdown code in your *.md files.
16 stars 5 forks source link

`lint-no-missing-blank-lines` doesn't play nice with this plugin #14

Open ericcornelissen opened 3 years ago

ericcornelissen commented 3 years ago

I was trying to use the lint-no-missing-blank-lines rule with this package, but ran into some problems. Given a Markdown file with the following content:

# Example

foobar

```js
let x = 42;
console.log(x);
```

Using this plugin with ESLint

module.exports = {
  overrides: [
    {
      files: ["**/*.md"],
      parser: "markdown-eslint-parser",
      extends: [
        "plugin:md/recommended",
      ],
      rules: {
        "md/remark": ["error",{
          plugins: [
            ["lint-no-missing-blank-lines"],
          ]
      },
    },
  ],
};

Gives the following errors:

  6:1  error  Missing blank line before block node (no-missing-blank-lines)  md/remark
  7:1  error  Missing blank line before block node (no-missing-blank-lines)  md/remark
  8:1  error  Missing blank line before block node (no-missing-blank-lines)  md/remark

Whereas a similar setup using remark-lint directly reports no errors, see https://codesandbox.io/s/remark-debug-forked-w8w1w?file=/src/index.js

I'm guessing this plugin/ESLint is doing something to the file that confuses remark, but I wasn't able to figure out what...