feat: common configuration of husky, eslint and prettier across all packages
Is your feature request related to a problem? Please describe. Currently, the code formatting is implemented package-wise as the majority of packages were independent repos before the OSS launch. So there is no code formatting, prettify and commit standards are defined for the whole app as a common config file/package.
Describe the solution you'd like
There should be a common package like @firecamp/eslint, or @firecamp/prettify available. we can install them in the mono repo to maintain the standards and reuse the same configuration across all packages.
i can give this issue a try, if it's still available
@nagy-nabil yes, you can share the PR.
So, As Far As I understand . We're a expecting a mono repo with common configurations in packages folder. ANd Inject this with dependencies in all other mono repos?
yes, you're right @bathini79
Thanks for the conformation! I started working on it
Thanks for the conformation! I started working on it
Great, eager to see it in action. I am more excited about this issue. @bathini79
I have a follow up question now, If we could simply configure this at root level . And then it would be applicable accross all the mono repos , then what is the need of this kind of configuration? @Nishchit14
@bathini79 we need to create an independent package for code quality standards. so we can reuse it everywhere (backend, frontend, plugins, npm packages, oss/non-oss packages). we need to prepare a package once and then reuse it anywhere.
this package would be exporting
- eslint config
- prettier config
- anything else?
oh! That makes so much sense now, Thanks !
@Nishchit14 This is my first working with this kind of setup. Do I need Push the code for just the lint -manager and get a repo created and then i can install where ever we want?
I am happy that you're showing good courage to work on this issue being a first-time contributor. Let me bring some help for you.
We can create the following new packages (under the packages folder at the root)
- [ ] 1.
@firecamp/eslint(folder namefirecamp-eslint) - [ ] 2.
@firecamp/prettier(folder namefirecamp-prettier) - [ ] 3.
@firecamp/tsconfig(folder namefirecamp-tsconfig)
Later we'll figure out the place to keep those config packages separately
Here are some reference packages from other friend oss projects
- https://github.com/calcom/cal.com/tree/main/packages/tsconfig
- https://github.com/calcom/cal.com/tree/main/packages/config
- https://github.com/calcom/cal.com/tree/main/packages/eslint-plugin
- https://github.com/documenso/documenso/tree/feat/refresh/packages/eslint-config
- https://github.com/documenso/documenso/tree/feat/refresh/packages/tsconfig
I see @dhoni77 has contributed in cal.com, if you can guide or correct us here then it would be a great help @dhoni77
@bathini79 you can start with creating the first package @firecamp/eslint, if you have any questions or need help then feel free to ask anytime here or in Discord.
Hey @Nishchit14 I'm good with creating the files and setting up the config. But how do I push these changes that's thing I'm wondering. I've tried with git submodule . But it's not working as expected . It's just saying that it is a submodule and does not show any code in the git
All folders under the packages folder will be considered as packages. we're using the pnpm workspace mono repo. here you don't need git submodule.
you can learn more about pnpm workspace from here https://pnpm.io/workspaces
All these are independent packages.
step
- fork the repo
- create
packages/firecamp-eslintfolder - init the package with
npm initor just copy the sibling package and rename it to@firecamp/eslint, remove extra code - setup the eslint configuration
- create PR.
Do not run the lint command on the whole project, it'll change many file formats, we'll do it once the package is published and all other PRs will get merged
@bathini79
I am happy that you're showing good courage to work on this issue being a first-time contributor. Let me bring some help for you.
We can create the following new packages (under the
packagesfolder at the root)
- [ ] 1.
@firecamp/eslint(folder namefirecamp-eslint)- [ ] 2.
@firecamp/prettier(folder namefirecamp-prettier)- [ ] 3.
@firecamp/tsconfig(folder namefirecamp-tsconfig)Later we'll figure out the place to keep those config packages separately
Here are some reference packages from other friend oss projects
- https://github.com/calcom/cal.com/tree/main/packages/tsconfig
- https://github.com/calcom/cal.com/tree/main/packages/config
- https://github.com/calcom/cal.com/tree/main/packages/eslint-plugin
- https://github.com/documenso/documenso/tree/feat/refresh/packages/eslint-config
- https://github.com/documenso/documenso/tree/feat/refresh/packages/tsconfig
I see @Dhoni77 has contributed in cal.com, if you can guide or correct us here then it would be a great help @Dhoni77
@bathini79 you can start with creating the first package
@firecamp/eslint, if you have any questions or need help then feel free to ask anytime here or in Discord.
Hi @Nishchit14 In cal.com they have configured prettier and eslint in a single package and exported it and referenced it in other packages if required. May be we could also create new packages like you have suggested above and reference it across all packages.
That's the plan now, thank you @Dhoni77
@bathini79 are you working on it?
Yes I'm working on it . And do we want to include all the above configs in one repo or multiple repo . And I managed to get the files. Earlier it was not showing in my git diff
Sure, let's keep eslint and prettier combined in one package and tsconfig as another package. @bathini79
Okay. I've raised an initial pr.
That's great @bathini79, I'll review it by tonight.