eslint / markdown

Lint JavaScript code blocks in Markdown documents
MIT License
391 stars 60 forks source link

Change Request: Move the `language` option to `settings.language`. #277

Closed m1rn closed 3 weeks ago

m1rn commented 3 weeks ago

Environment

Node version: v22.1.0 npm version: v10.7.0 Local ESLint version: v9.9.1 (Currently used) Global ESLint version: Not found Operating System: win32 10.0.22631

What problem do you want to solve?

@eslint/markdown and @eslint/json both have a language option that needs to be defined within the ESLint configuration object. However, this property is not actually documented in the ESLint configuration object documentation, leading to editor complaints when using TypeScript. I would prefer that such custom fields be defined in settings, for example:

import markdown from '@eslint/markdown';

export default [
  {
    files: ['**/*.md'],
    plugins: {
      markdown,
    },
    rules: {
      'markdown/fenced-code-language': 2
    },
    processor: 'markdown/markdown',
    settings: {
      language: 'markdown/commonmark',
    }
  }
];

What do you think is the correct solution?

-

Participation

Additional comments

No response

nzakas commented 3 weeks ago

This is the standard way ESLint switches languages. It's mentioned in the ESLint docs: https://eslint.org/docs/latest/use/configure/plugins#specify-a-language

@types/eslint isn't actually maintained by us, that's why it's not there yet, but we can take a look to see if we can get it added.