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

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

Open
Nishchit14 opened this issue Sep 18, 2023 · 20 comments
Assignees
Labels
good first issue Good for newcomers hacktoberfest Issue that are part of Hacktoberfest

Comments

@Nishchit14
Copy link
Contributor

Nishchit14 commented Sep 18, 2023

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.

@nagy-nabil
Copy link

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

@Nishchit14
Copy link
Contributor Author

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

@shreya-gr shreya-gr added the hacktoberfest Issue that are part of Hacktoberfest label Sep 29, 2023
@bathini79
Copy link
Contributor

bathini79 commented Oct 4, 2023

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?

@Nishchit14
Copy link
Contributor Author

yes, you're right @bathini79

@bathini79
Copy link
Contributor

Thanks for the conformation! I started working on it

@Nishchit14
Copy link
Contributor Author

Thanks for the conformation! I started working on it

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

@bathini79
Copy link
Contributor

bathini79 commented Oct 7, 2023

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

@Nishchit14
Copy link
Contributor Author

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

@bathini79
Copy link
Contributor

oh! That makes so much sense now, Thanks !

@bathini79
Copy link
Contributor

bathini79 commented Oct 8, 2023

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

@Nishchit14
Copy link
Contributor Author

Nishchit14 commented Oct 9, 2023

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.

@bathini79
Copy link
Contributor

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

@Nishchit14
Copy link
Contributor Author

Nishchit14 commented Oct 9, 2023

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

@Dhoni77
Copy link
Contributor

Dhoni77 commented Oct 9, 2023

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.

@Nishchit14
Copy link
Contributor Author

That's the plan now, thank you @Dhoni77

@Nishchit14 Nishchit14 changed the title common configuration of husky, eslint and prettier across all packages feat: common configuration of husky, eslint and prettier across all packages Oct 10, 2023
@Nishchit14
Copy link
Contributor Author

@bathini79 are you working on it?

@bathini79
Copy link
Contributor

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

@Nishchit14
Copy link
Contributor Author

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

@bathini79
Copy link
Contributor

Okay. I've raised an initial pr.

@Nishchit14
Copy link
Contributor Author

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

bathini79 added a commit to bathini79/firecamp that referenced this issue Nov 5, 2023
bathini79 added a commit to bathini79/firecamp that referenced this issue Nov 5, 2023
bathini79 added a commit to bathini79/firecamp that referenced this issue Nov 5, 2023
bathini79 added a commit to bathini79/firecamp that referenced this issue Nov 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers hacktoberfest Issue that are part of Hacktoberfest
Projects
None yet
Development

No branches or pull requests

5 participants