jsx-eslint/eslint-plugin-react

Add `reactLibrary` setting

Open

#2904 aperta il 17 gen 2021

Vedi su GitHub
 (3 commenti) (0 reazioni) (0 assegnatari)JavaScript (2797 fork)batch import
enhancementhelp wanted

Metriche repository

Star
 (8630 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

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.

Guida contributor