jsx-eslint/eslint-plugin-react

Ignore nested components in no-multi-comp

開放

#2,842 建立於 2020年10月24日

 (2 則留言) (1 個反應) (0 位負責人)JavaScript (2,733 個分叉)batch import
help wanted

倉庫指標

星標
 (9,293 顆星)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

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.

貢獻者指南