Qard / remark-lint-code

Lint fenced code blocks by corresponding language tags
12 stars 1 forks source link

Let plug-ins decide which language flags they support #1

Open wooorm opened 8 years ago

wooorm commented 8 years ago

Currently, users have to specify which language flags should be given to which remark-lint-code plug-in.

remark.use(lint, {
  'lint-code': {
    js: eslint
  }
}).process('```js\nvar foo = "bar"\n```')

I think it would be more friendly to let the plug-in decide that, so users can do the following:

remark.use(lint, {
  'lint-code': [
    eslint
  ]
}).process('```js\nvar foo = "bar"\n```')

To get that working, maybe a languages property on remark-lint-code plug-ins?

eslint.languages = [
  'js',
  'javascript',
  'es6',
  'jake'
];

(useful: linguist)

As a side effect, this would fix (I think, it’s purely theoretical now) multiple code-lint plug-ins for the same language (e.g., both jscs and eslint).