Skip to content

Automatically execute Lint before commit with lint-staged and huskey #125

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

Closed
potato4d opened this issue Feb 16, 2019 · 2 comments · Fixed by #126
Closed

Automatically execute Lint before commit with lint-staged and huskey #125

potato4d opened this issue Feb 16, 2019 · 2 comments · Fixed by #126

Comments

@potato4d
Copy link
Member

About

翻訳のレビュー開始時に CI のステータスが Failed の状態からはじまることが稀にあります。
多くは TextLint の実行漏れによるもので、 Lint 方法についてはガイドに書かれているものの、貢献者も人間ですので、忘れることがあるかと思います。

対処方法として、 Git の pre-commit フックを利用して特定の NPM Scripts を実行可能な husky と、その実行対象をコミット対象のファイルに限定できる lint-staged を組み合わせて、 Lint にコケるコミットを打てなくする方法を提案したいです。

何度か入れたことがあるので、近い内に例の Pull Request を出しておきます。

議論点

鬱陶しくないか

個人的には全員が十分に意識できる環境であればノイズとなるだけなのでこれは必要ないと思っています。
しかし、 OSS はその性質上入れておくメリットのほうが煩雑さを上回ることができるため、これを導入できればと思います。

どうしてもノイズとなる場合は、 git commit -n を行うことによって、スキップできますので、一応その道も用意されています。

@smikitky
Copy link
Member

いいと思います。やるのは lint:text だけでですか?

@potato4d
Copy link
Member Author

そうですね。 JavaScript のエラーも検出できるのは利点となる一方で、翻訳だけしにきたにも関わらずなにかの都合や環境依存でコケてしまった場合にストレスになると思うので、最小限にしておくとよいかと思っています。

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 a pull request may close this issue.

2 participants