eslint / markdown

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

feat: add `meta` property #233

Closed mdjermanovic closed 9 months ago

mdjermanovic commented 9 months ago

Adds meta property to the plugin object and the processor object, for serialization purposes.

With this config:

// eslint.config.js
import markdown from "eslint-plugin-markdown";

export default [
    {
        files: ["**/*.md"],
        plugins: { markdown },
        processor: "markdown/markdown"
    }
];

eslint --print-config foo.md will print:

{
  "languageOptions": {
    "ecmaVersion": "latest",
    "sourceType": "module",
    "parser": "espree@9.6.1",
    "parserOptions": {},
    "globals": {}
  },
  "processor": "markdown/markdown",
  "plugins": [
    "@",
    "markdown:eslint-plugin-markdown@3.0.1"
  ],
  "rules": {}
}

With this config (processor is used directly):

// eslint.config.js
import markdown from "eslint-plugin-markdown";

export default [
    {
        files: ["**/*.md"],
        processor: markdown.processors.markdown
    }
];

eslint --print-config foo.md will print:

{
  "languageOptions": {
    "ecmaVersion": "latest",
    "sourceType": "module",
    "parser": "espree@9.6.1",
    "parserOptions": {},
    "globals": {}
  },
  "processor": "eslint-plugin-markdown/markdown@3.0.1",
  "plugins": [
    "@"
  ],
  "rules": {}
}