-
-
Notifications
You must be signed in to change notification settings - Fork 119
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: update eslint + prettier rules #254
Conversation
Thanks! I hope it was clear in the issue, but the scope of #253 also contains fixing the ~500 linting issues we have now. |
Hey there, |
Ah, I see! I would still prefer 1 PR for all this, because I will not merge a PR with a red CI. |
Ahh okay okay, just wait for it (please). I'll fix here =) |
Hello @amaurymartiny, I have a few doubts about this linting issues, let me know what do you think about them: Some of the most common errors:
Some of the most common warnings:
In the file App/Screens/Search/fetchAlgolia.ts#47, we have the following problem: |
This one is important! It might catch some bugs, so I wish to keep it. Basically, for example https://github.com/amaurymartiny/shoot-i-smoke/blob/9641cf6437f9043fd95295a67f8ebcb77687fdc0/App/Screens/Home/Home.tsx#L44 you would need to write: if (!api) {
throw new Error('Home.tsx only reachable when `api` is defined.'); // Or some message like this
}
const cigarettesPerDay = api.shootISmoke.cigarettes;
I would like to keep these two too. I didn't find where they were, if you need help for those two I can have a look too.
This PR seems bigger than I thought. In this case you can do
for now in .eslintrc.js, we can do those in a separate PR.
Algolia gives snake_case here, so here the only solution would be a |
add rule to avoid warnings with: - @typescript-eslint/explicit-function-return-type - @typescript-eslint/no-explicit-any - react/prop-types
I found these errors:
Do you have any suggestion or would you like to fix them? |
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.
This is very, very, very cool. Thanks a lot 🎉
Some little nits:
- replace all
&& ||
with?:
- replace
if (currentLocation === undefined || !Object.keys(currentLocation).length)
with simplyif(!currentLocation)
is enough
App/stores/fetchGpsPosition/fetchGpsPosition.ts
You can remove the as Location
cast
App/Screens/Screens.tsx
You can replace the function with
function stackNavigatorOptions(
initialRouteName: string
): CreateNavigatorConfig<
NavigationStackConfig,
NavigationStackRouterConfig,
NavigationStackOptions,
NavigationStackProp<NavigationRoute, any>
> {
return {
cardStyle: {
backgroundColor: theme.backgroundColor
},
headerMode: 'none',
initialRouteName,
defaultNavigationOptions: {
// FIXME the `headerVisible` field has been moved away from this config
// @ts-ignore
headerVisible: false
}
};
}
And after that I think we're ready to merge!
Co-Authored-By: Amaury Martiny <[email protected]>
Co-Authored-By: Amaury Martiny <[email protected]>
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.
Looks good! Just tested the code, nothing broke, so that's perfect.
I'll merge once the CLA is signed and conflicts solved.
Time to merge my friend 🦄 |
Thanks, almost there but not yet! There are 2 errors on Travis, surely because of the master merge. The |
My bad, I did merge using GitHub instead of the command-line interface, but I hope that it's correct now 🚀 🔬 |
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.
There are some regression errors due to merge.
Co-Authored-By: Amaury Martiny <[email protected]>
Co-Authored-By: Amaury Martiny <[email protected]>
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.
Sorry, 2 more merge errors. Should be the last 2 ones!
I will never merge again using GitHub 🐛 |
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.
This time everything looks good! A huge thanks to you @ftonato
Summary:
Closes #253