Skip to content

[eslint-mdx] Make ESLint aware of common components of MDXProvider #1505

Answered by JounQin
kelvindecosta asked this question in Q&A
Discussion options

You must be logged in to vote

Just add globals setting for those files.

https://eslint.org/docs/user-guide/configuring/language-options#using-configuration-files-1

If you're using mutilate components for some package, you can use the helper like following.

const { getGlobals } = require('eslint-plugin-mdx/lib/helpers')

module.exports = {
  overrides: [
    {
      files: '*.mdx',
      globals: getGlobals(require(path of package of components'), {
        // other globals
      })
    }
  ]
}

You can check the helper source at https://github.com/mdx-js/eslint-mdx/blob/master/packages/eslint-plugin-mdx/src/helpers.ts

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@kelvindecosta
Comment options

@kelvindecosta
Comment options

@JounQin
Comment options

JounQin Mar 29, 2021
Collaborator

@kelvindecosta
Comment options

Answer selected by kelvindecosta
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants