mdx-js / eslint-mdx

ESLint Parser/Plugin for MDX
https://npmjs.org/eslint-plugin-mdx
MIT License
259 stars 29 forks source link

Sub-components as `<Component.SubComponent>` trig eslint errors in MDX files #445

Closed vripoche closed 1 year ago

vripoche commented 1 year ago

Initial checklist

Affected packages and versions

2.x.x

Link to runnable example

No response

Steps to reproduce

Create a MDX file with imported Component that have sub-components as:

doc.mdx:

import { DefinitionList } from `./DefinitionList`

<DefinitionList>
   <DefinitionList.Title>Hello World !</DefinitionList.Title>
<DefinitionList>

And DefinitionList component: DefinitionList.js:

import React from 'react'

export const DefinitionList = ({ children }) => <dl>{children}</dl>
DefinitionList.Title =  ({ children }) => <dt>{children}</dt>

Expected behavior

Should not be any eslint errors

Actual behavior

On MDX linting (eslint ./doc.mdx), we have this error: error 'DefinitionList.Title' is not defined react/jsx-no-undef.

Note: no errors were triggered on last 1.17.1 version.

Runtime

Node v17

Package manager

npm v6

OS

macOS

Build and bundle tools

webpack

oliviadawd commented 1 year ago

im getting this error as well!