jsx-eslint/eslint-plugin-react

Add `reactLibrary` setting

Open

#2.904 geöffnet am 17. Jan. 2021

Auf GitHub ansehen
 (3 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)JavaScript (2.797 Forks)batch import
enhancementhelp wanted

Repository-Metriken

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

Beschreibung

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.

Contributor Guide