-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
chore(eslint): enable react-hooks/recommended #4498
chore(eslint): enable react-hooks/recommended #4498
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@dominikdosoudil let's create a separate PR to rename these functions. I believe the problem is with I suggest:
|
@layershifter That sounds good, however this step will still affect a lot of files as the If that's ok with you, I'll follow the steps and mention the individual PRs here. |
Indeed, but if PRs will be sliced by files' location i.e. all ( |
Can I suggest another approach which would avoid the last big bang? We might create aliases for /**
+ * @deprecated
* Props where only the prop key is used in the className.
* @param {*} val A props value
* @param {string} key A props key
*
* @example
* <Label tag />
* <div class="ui tag label"></div>
*/
export const useKeyOnly = (val, key) => val && key
+ export const getKeyOnly = useKeyOnly; Step 2 - incrementally replace the function name in individual files to make PR less big: export {
- useKeyOnly,
+ getKeyOnly,
- useKeyOrValueAndKey,
+ getKeyOrValueAndKey,
// etc.
} from './classNameBuilders' Step 3 - remove the original functions and inline the aliases: /**
- * @deprecated
* Props where only the prop key is used in the className.
* @param {*} val A props value
* @param {string} key A props key
*
* @example
* <Label tag />
* <div class="ui tag label"></div>
*/
- export const useKeyOnly = (val, key) => val && key
-
- export const getKeyOnly = useKeyOnly;
+ export const getKeyOnly = (val, key) => val && key This way, there should not be the large number of changes in imports after finally renaming the functions in their declarations. |
@dominikdosoudil yeah, that's actually was my proposal 🐱 Sorry if I was unclear :) ^ that would avoid deprecations with the same result, but your proposal is even better :) |
Step 1: #4500 aliases |
@dominikdosoudil it's merged 😉 |
After merging #4505, there will be few warnings and one remaining error:
caused by if (process.env.NODE_ENV !== 'production') {
React.useEffect(() => {
...
}, [exclusive, activeIndex])
} I think that it might be ignored because we are smarter than eslint here and we know that NODE_ENV won't probably change during runtime. |
@dominikdosoudil right, let's use |
81bd945
to
f142394
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #4498 +/- ##
=======================================
Coverage 99.53% 99.53%
=======================================
Files 186 186
Lines 3463 3463
=======================================
Hits 3447 3447
Misses 16 16 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
…ocess.env.NODE_ENV never changes during runtime
f142394
to
43ca40b
Compare
The only problem is that there are few internal functions that have prefix "use" and eslint thinks that they are hooks.
Should the code be refactored along with this PR or it is just ok that some false positive errors would pop up with accepting this PR?