-
-
Notifications
You must be signed in to change notification settings - Fork 447
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
feat: optional react support #326
Conversation
package.json
Outdated
@@ -56,6 +56,8 @@ | |||
"eslint-plugin-n": "^16.3.1", | |||
"eslint-plugin-no-only-tests": "^3.1.0", | |||
"eslint-plugin-perfectionist": "^2.4.0", | |||
"eslint-plugin-react": "^7.33.2", | |||
"eslint-plugin-react-hooks": "^4.6.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to keep them as optional peer deps, and ask ppl to explicitly install them when they want to use react. This way we don't introduce those deps to every user of this config.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved them to optional peer deps. Should I leave them in devDeps for dev?
src/configs/react.ts
Outdated
rules: { | ||
// recommended rules react | ||
...pluginReact.configs.recommended.rules as any, | ||
...pluginReactHooks.configs.recommended.rules as any, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to avoid referencing configs presets, but rather flatten them as inline to have better control.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By flattening + inline, do you mean copy the config over?
Hi👋 @suppayami , can you add |
@usercao I put |
@suppayami You're right, I'm sorry I didn't think carefully. Have you been using |
export default antfu(
{
"vue": true,
"react": false,
"typescript": true,
"styled-components": true,
},
) I respect your idea, just hope that only one |
@suppayami you may use feature flag, same as typescript config has for project (type aware rules won't be enabled if you don't set the tsconfig location) |
@Dimava Do you mean |
@suppayami No I don't mean anything specific, I didn't use React ever 😂 |
@antfu I think feature-wise this is ready to go, please have a review when you have time |
I updated the PR to not have auto-detection, instead asking users to turn it on manually. Also, it will prompt users to auto-install necessary deps if missing. |
Description
Added basic support for react, using eslint-plugin-react and eslint-plugin-react-hooks.
Linked Issues
Closes #282