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: lefthookの設定を追加 #13

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

imaimai17468
Copy link
Collaborator

lefthookの設定をbasesに追加

やったこと

  • basesにlefthookディレクトリを追加
    • readme
    • eslint, prettier / biome それぞれのymlファイルの追加

考慮点

  • pre-push必要?
  • pre-pushにtscやbuildなどを入れたほうがいいか

@imaimai17468 imaimai17468 self-assigned this May 10, 2024
@strozw
Copy link
Collaborator

strozw commented May 13, 2024

pre-push必要?

本リポジトリの config はどれも設定例なので、利用されるプロジェクトの判断で採用・不採用してもらえればよいと思いますし、選択肢の提示という意味で記載しておいて良いと思いました。

Comment on lines +4 to +8
pre-commit:
commands:
fix:
glob: "*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}"
run: npx biome check --apply --no-errors-on-unmatched --files-ignore-unknown=true <files> && git update-index --again
Copy link
Collaborator

Choose a reason for hiding this comment

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

[imo]
設定に隠蔽できるなら可能な限りオプションは減らしたい気持ち

https://biomejs.dev/ja/reference/configuration/#filesignoreunknown

Suggested change
pre-commit:
commands:
fix:
glob: "*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}"
run: npx biome check --apply --no-errors-on-unmatched --files-ignore-unknown=true <files> && git update-index --again
pre-commit:
commands:
fix:
glob: "*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}"
run: npx biome check --apply --files-ignore-unknown=true <files> && git update-index --again

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

これで秘匿できるのって--files-ignore-unknown=trueですよね
提示されたdiffだと--no-errors-on-unmatchedが減ってるんですが、これはミスですか?

Comment on lines +4 to +8
pre-commit:
commands:
fix:
glob: "*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}"
run: npx biome check --apply --no-errors-on-unmatched --files-ignore-unknown=true <files> && git update-index --again
Copy link
Collaborator

Choose a reason for hiding this comment

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

[ask]
apply-unsafe有効にしていないのは意図的です?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

安全でない習性はpre-commitで行うべきではないかな〜と思います!

pre-commit:
commands:
fix:
glob: '*.{js,jsx,ts,tsx}'
Copy link
Collaborator

Choose a reason for hiding this comment

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

[ask]

対象がbiome寄り少ないのはeslintが対応していないとかですかね?
parallel付けなければ順次実行できるはずなので、prettierとeslintの実行を分割してそれぞれ対象を最大化しておくと良さそう

Suggested change
glob: '*.{js,jsx,ts,tsx}'
glob: '*.{js,jsx,ts,tsx}'

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

parallelつけたらですかね?
その場合はeslintとprettierが分割して実行できるので良いと思います!
修正DONEdesu

Comment on lines 5 to 9
1. CLIをインストールする

```bash
brew install lefthook
```
Copy link
Collaborator

Choose a reason for hiding this comment

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

[imo]
一応npx経由の実行でも全て問題なく実行できた気がするんですよね
好みの問題かもしれないですが、個人的には全てnpx(bunxなど)経由の実装でいいのかなーと

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

修正しました〜

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.

None yet

3 participants