jsx-eslint/eslint-plugin-react

Add `reactLibrary` setting

Open

#2,904 创建于 2021年1月17日

在 GitHub 查看
 (3 评论) (0 反应) (0 负责人)JavaScript (8,630 star) (2,797 fork)batch import
enhancementhelp wanted

描述

Add a reactLibrary setting for the name of the React library (defaults to 'react'). This would be helpful for Preact users.

Currently, the jsx-fragments rule (set to syntax) doesn't warn about this:

import {Fragment} from 'preact'

const foo = <Fragment>foo</Fragment>

Checking for the configured reactLibrary setting instead of the hard-coded 'react' would make this rule (and possibly others, I haven't really looked into this plugin that much) more flexible.

贡献者指南