firecamp icon indicating copy to clipboard operation
firecamp copied to clipboard

feat: common configuration of husky, eslint and prettier across all packages

Open Nishchit14 opened this issue 2 years ago • 20 comments

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.

Nishchit14 avatar Sep 18 '23 11:09 Nishchit14

i can give this issue a try, if it's still available

nagy-nabil avatar Sep 28 '23 15:09 nagy-nabil

@nagy-nabil yes, you can share the PR.

Nishchit14 avatar Sep 28 '23 17:09 Nishchit14

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?

bathini79 avatar Oct 04 '23 05:10 bathini79

yes, you're right @bathini79

Nishchit14 avatar Oct 06 '23 11:10 Nishchit14

Thanks for the conformation! I started working on it

bathini79 avatar Oct 07 '23 05:10 bathini79

Thanks for the conformation! I started working on it

Great, eager to see it in action. I am more excited about this issue. @bathini79

Nishchit14 avatar Oct 07 '23 07:10 Nishchit14

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 avatar Oct 07 '23 12:10 bathini79

@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

  1. eslint config
  2. prettier config
  3. anything else?

Nishchit14 avatar Oct 07 '23 13:10 Nishchit14

oh! That makes so much sense now, Thanks !

bathini79 avatar Oct 07 '23 13:10 bathini79

@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?

bathini79 avatar Oct 08 '23 20:10 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 packages folder at the root)

  • [ ] 1. @firecamp/eslint (folder name firecamp-eslint)
  • [ ] 2. @firecamp/prettier (folder name firecamp-prettier)
  • [ ] 3. @firecamp/tsconfig (folder name firecamp-tsconfig)

Later we'll figure out the place to keep those config packages separately

Here are some reference packages from other friend oss projects

  1. https://github.com/calcom/cal.com/tree/main/packages/tsconfig
  2. https://github.com/calcom/cal.com/tree/main/packages/config
  3. https://github.com/calcom/cal.com/tree/main/packages/eslint-plugin
  4. https://github.com/documenso/documenso/tree/feat/refresh/packages/eslint-config
  5. 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.

Nishchit14 avatar Oct 09 '23 07:10 Nishchit14

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

bathini79 avatar Oct 09 '23 08:10 bathini79

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.

image

step

  1. fork the repo
  2. create packages/firecamp-eslintfolder
  3. init the package with npm init or just copy the sibling package and rename it to @firecamp/eslint, remove extra code
  4. setup the eslint configuration
  5. 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

Nishchit14 avatar Oct 09 '23 09:10 Nishchit14

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 name firecamp-eslint)
  • [ ] 2. @firecamp/prettier (folder name firecamp-prettier)
  • [ ] 3. @firecamp/tsconfig (folder name firecamp-tsconfig)

Later we'll figure out the place to keep those config packages separately

Here are some reference packages from other friend oss projects

  1. https://github.com/calcom/cal.com/tree/main/packages/tsconfig
  2. https://github.com/calcom/cal.com/tree/main/packages/config
  3. https://github.com/calcom/cal.com/tree/main/packages/eslint-plugin
  4. https://github.com/documenso/documenso/tree/feat/refresh/packages/eslint-config
  5. 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.

Dhoni77 avatar Oct 09 '23 09:10 Dhoni77

That's the plan now, thank you @Dhoni77

Nishchit14 avatar Oct 09 '23 10:10 Nishchit14

@bathini79 are you working on it?

Nishchit14 avatar Oct 10 '23 08:10 Nishchit14

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

bathini79 avatar Oct 10 '23 09:10 bathini79

Sure, let's keep eslint and prettier combined in one package and tsconfig as another package. @bathini79

Nishchit14 avatar Oct 11 '23 05:10 Nishchit14

Okay. I've raised an initial pr.

bathini79 avatar Oct 11 '23 10:10 bathini79

That's great @bathini79, I'll review it by tonight.

Nishchit14 avatar Oct 11 '23 11:10 Nishchit14