bluesky-social / social-app

The Bluesky Social application for Web, iOS, and Android
https://bsky.app
MIT License
11.8k stars 1.51k forks source link

Remove unnecessary prettier/prettier rule due to recent update to @react-native/eslint-config. Fix 2 i18n hooks with unnecessary async #6544

Open PaulACoroneos opened 2 days ago

PaulACoroneos commented 2 days ago

Edit:

See updated comments from https://github.com/bluesky-social/social-app/pull/6544#issuecomment-2487273639. Thank you!

--- Original comments ---

Hello.

As part of the path to eslint v9 we need to remove eslint-config-react-native-community which has not been updated in 2 years. This has been replaced with react-native/eslint-plugin. As part of this migration eslint-plugin-react-hooks is no longer a dependency so I added it as well. (I also have added version detect so the react plugins know what version they are dealing with)

While doing this 2 rules-of-hooks violations were flagged. Both are valid as a hooks should not be called in an asynchronous function. That being said I don't really see a reason for the function to be marked asynchronous in first place. So I have remove the async from each declaration. This resolves the violation.

Finally we are able to formally remove references to prettier in the .eslintrc as the new plugins do not depend on eslint-plugin-prettier. Format concerns are now properly handled by prettier.

I ran yarn lint and validated we only get warnings back. Please let me know if you have any questions or need further details. Thank you!

gaearon commented 2 days ago

needs a rebase pls

PaulACoroneos commented 2 days ago

@gaearon rebase complete

PaulACoroneos commented 2 days ago

@trivikr @gaearon Okay everything is fixed up (and I've now updated title after rebase) . Let me summarize:

I did not rebase tonight before starting work so I didn't see @trivikr beat me to the eslint package update. Thank you for doing that :).

When we made the update as @gaearon wanted we now relied on eslint-config-prettier which by configuration disables style rules such as semi, curly, etc. This is because we prefer to rely on the prettier config file instead. So now there is no need to disable prettier/prettier. I have kept the rules of hooks fixes because they do fail on my local and I think it's the correct thing per my understanding. I have run "yarn lint" locally and it only returns warnings.

My mistake was I accidentally read the docs for @react-natve/eslint-plugin instead of eslint-config. That is my fault and I sincerely apologize. Let me know if there are any further questions.