Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: move getShortLang outside markdown processor #291

Merged
merged 2 commits into from
Mar 19, 2021
Merged

Conversation

JounQin
Copy link
Member

@JounQin JounQin commented Mar 18, 2021

  1. {index}_ prefix is hard coded at https://github.com/eslint/eslint/blob/master/lib/linter/linter.js#L1303
  2. provide ability to disable or custom language mapper, see also Update: compatibility with eslint-mdx eslint/markdown#178 (comment)

@JounQin JounQin self-assigned this Mar 18, 2021
@JounQin JounQin added the 🏡 area/internal This affects the hidden internals label Mar 18, 2021
@JounQin JounQin changed the title chore: improve regexp of possible error from code blocks refactor: move getShortLang outside markdown Mar 18, 2021
@JounQin JounQin changed the title refactor: move getShortLang outside markdown refactor: move getShortLang outside markdown processor Mar 18, 2021
@@ -49,6 +49,9 @@ ESLinter.prototype.verify = function (
{}

processorOptions.lintCodeBlocks = settings['mdx/code-blocks'] === true
processorOptions.languageMapper = settings[
'mdx/language-mapper'
] as ProcessorOptions['languageMapper']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense for languageMapper to have it's own type/interface which could be used directly in this cast?

Copy link
Member Author

@JounQin JounQin Mar 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a ESLintMdxSettings interface

https://github.com/mdx-js/eslint-mdx/pull/291/files#diff-942bc9ad585a6cef970e63062046e66eebb59a85e131d0894e5b7db3391541baR20-R23

But after digging some other plugins like https://github.com/yannickcr/eslint-plugin-react#configuration or https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-extraneous-import.md#shared-settings, a namespaced object settings could be used easyier.

{
  "settings": {
    "mdx": {
      "codeBlocks": true,
      "languageMapper": {}
    }
  }
}

What do you think? And I don't know if it should be considered as BREAKING CHANGE, because it's very easy to migrate.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JounQin JounQin merged commit f5d288a into master Mar 19, 2021
@JounQin JounQin deleted the chore/regexp branch March 19, 2021 00:32
@wooorm
Copy link
Member

wooorm commented Mar 21, 2021

Released!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏡 area/internal This affects the hidden internals
Development

Successfully merging this pull request may close these issues.

3 participants