-
-
Notifications
You must be signed in to change notification settings - Fork 353
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rule proposal: jsx-import
#155
Comments
I suppose this would have to figure out the pragma (inline and babel's config?) to suggest the right import name (but not the imported module). |
@bfred-it No, I was thinking we just ensure one of the list imports are used. I don't think anyone would use multiple of those, so should be good. No need to overcomplicate it. |
How do you know it's correct though? Is |
No, only named import
Nope, not from the list.
Nope. I think you're misunderstanding, I mean just from the curated list, not random |
Did you have a look at https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/react-in-jsx-scope.md? Only checks for |
@kevva Yup, I'm using it here: https://github.com/xojs/eslint-config-xo-react/blob/6a88098c0a7adac42a3170ca75add48738831b5f/index.js#L37 But I want something that is not just tied to React. Yes you can set the pragma there, but you can't set multiple, and |
I like this rule, it gives users the flexibility to use different libraries corresponding with jsx. |
There's a good starting point in https://github.com/sindresorhus/eslint-plugin-unicorn/pull/162/files if anyone wants to finish it. |
@issuehuntfest has funded $40.00 to this issue. See it on IssueHunt |
@sindresorhus Hi. I wanted work on it. |
@doniyor2109 Go ahead. Please continue based on #162. |
This is up for grabs again. If you want to work on this, you can continue where #220 left off. Make sure you address the review comments from that PR. |
I think this will be made obsolete by "React’s automatic runtime" https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html https://babeljs.io/docs/en/babel-plugin-transform-react-jsx TypeScript issue: microsoft/TypeScript#34547 |
I don't use React, is it mean we can close this? |
@sindresorhus Will you get the bounty back, If I close this directly? |
I can just move it. The bounty here now applies to #1482 |
@sindresorhus has rewarded $36.00 to @fisker. See it on IssueHunt
|
Idea from: https://github.com/sindresorhus/refined-github/pull/1089/files#r168391471
When JSX is detected in the source, require the code to import one of the following imports:
import React from 'react';
import preact from 'preact';
import {h} from 'preact';
import {h} from 'dom-chef';
And if no JSX is is detect, disallow these imports.
Need suggestions for a better rule name.
Thoughts on the rule?
IssueHunt Summary
fisker has been rewarded.
Backers (Total: $40.00)
Submitted pull Requests
no-useless-spread
: Check cloning immediate arraysTips
The text was updated successfully, but these errors were encountered: