keystonejs / keystone

The most powerful headless CMS for Node.js — built with GraphQL and React
https://keystonejs.com
MIT License
8.98k stars 1.13k forks source link

chore: on commit format changed files with prettier #9128

Closed iamandrewluca closed 1 month ago

iamandrewluca commented 2 months ago

It needs to be clarified which format style guide to use in the project. I added the prettier format for only changed files using the default config. I did not run prettier on the entire project, as there are a lot of files (over 1k) to be changed.

Did some tests and changed a little default prettier config, to match more the formatting of current source code.

git st
On branch chore/add-prettier-format-on-commit
Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
    new file:   .husky/pre-commit
    modified:   package.json
    modified:   pnpm-lock.yaml
    modified:   tests/test-projects/live-reloading/schemas/syntax-error.js

git ci -m "chore: on commit format changed files with prettier"

> @keystone-6/mono-repo@0.0.0 npx
> lint-staged

✔ Preparing lint-staged...
✔ Running tasks for staged files...
✔ Applying modifications from tasks...
✔ Cleaning up temporary files...
[chore/add-prettier-format-on-commit a50423f97] chore: on commit format changed files with prettier
 4 files changed, 15295 insertions(+), 8241 deletions(-)
 create mode 100644 .husky/pre-commit
codesandbox-ci[bot] commented 2 months ago

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 61d8db8b312a8f7e59dc01a4f0e101fa42ce223e:

Sandbox Source
@keystone-6/sandbox Configuration
dcousens commented 1 month ago

Superceded by https://github.com/keystonejs/keystone/pull/9144, but thanks @iamandrewluca for pushing this forward, as I know many contributors have been asking about the lack of any rules