Skip to content
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

[fix] Update eslint and prettier configs #22

Merged
merged 1 commit into from
Oct 18, 2023
Merged

Conversation

surajr10
Copy link
Contributor

@surajr10 surajr10 commented Oct 17, 2023

What's new in this PR

Removed the Calblueprint Eslint and Prettier packages along with all their peer dependencies and replaced with the Eslint and Prettier configs that are listed in the Expo docs. Also added an Eslint ignore field and removed the organizeImports field in VSCode settings fiel. Then fixed all Eslint and Prettier issues in the project.

Description

This remedy was sought after due to a version mismatch for Typscript, where Expo wanted Typescript version 5 and our Calblueprint eslint config package was using a lower version. Due to the difficulty of keeping up the Calblueprint eslint and prettier packages to match with changes in other packages and version matching with tools such as Expo and NextJS, I felt it best to just use the maintained packages that were recommended on the Expo docs for this PR as they encompassed most, if not all, the rules we were requiring.

The Eslint ignore file was added to speed up running eslint by not running it on unnecessary folders. The organizeImports field on the VSCode settings.json file was removed because it was conflicting with the Eslint import order rules.

How to review

Once devs have rebased or pulled changes from main, run npm install to get all the new packages for the project.

Try to run the following commands:

  • npx eslint . (checks to see if eslint is working on your project. may output nothing if your code is clean, so you can manually try switching up some imports or writing something that shouldn't make sense to test it out)
  • npx prettier --check . (checks to see if prettier is working on your project. this should output something like "All matched files use Prettier code style" even if your code is clean)

Also just check to make sure that if you're using VSCode, that saving a file with prettier errors like mis-aligned tabs, etc. get fixed upon saving a file.

I also linted the repo with the new rules, and so I had to manually change a little bit in the files of supabase.ts, Account.tsx, signup.tsx, and onboarding.tsx. So maybe make sure those are working as expected, although I expect them to be.

Next steps

You all on your project may find that certain Eslint and Prettier rules are not ideal (usually these are on the styling end of the spectrum) or you would like to have some other ones that may be missing, so feel free to play around with the .eslintrc.js and .prettier.js or install other eslint packages to help get you to a code ruleset that feels right for you.

Relevant Links

https://docs.expo.dev/guides/using-eslint/
https://www.headway.io/blog/react-native-quick-start-expo-eslint-typescript-and-prettier

Online sources

Related PRs

CC: @akshaynthakur

@akshaynthakur akshaynthakur changed the title Update Eslint and Prettier configs [chore] Update eslint and prettier configs Oct 18, 2023
Copy link
Collaborator

@akshaynthakur akshaynthakur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you so much for this 😭😭😭

@akshaynthakur akshaynthakur changed the title [chore] Update eslint and prettier configs [fix] Update eslint and prettier configs Oct 18, 2023
@akshaynthakur akshaynthakur merged commit 0f24043 into main Oct 18, 2023
2 checks passed
@akshaynthakur akshaynthakur deleted the suraj/fixEslint branch December 1, 2023 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants