jsx-eslint/eslint-plugin-react

Ignore nested components in no-multi-comp

Open

#2.842 geöffnet am 24. Okt. 2020

Auf GitHub ansehen
 (2 Kommentare) (1 Reaktion) (0 zugewiesene Personen)JavaScript (2.797 Forks)batch import
help wanted

Repository-Metriken

Stars
 (8.630 Stars)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

I don’t think react/no-multi-comp should trigger on nested components or should have an option to disable it. A practical example:

import { FormattedMessage } from 'react-intl';

export function App() {
  return (
    <FormattedMessage
      values={{
        link:
          // The next line triggers react/no-multi-comp
          (text: string) => <a>{text}</a>,
      }}
    />
  );
}

I suggest to add an option ignoreNested which ignores any components that aren’t declared as part of the Program node body.

Contributor Guide