-
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Git Hook: lint-staged #17
Labels
Milestone
Comments
svengreb
added a commit
that referenced
this issue
Jun 20, 2020
Git Hooks [1] are a fantastic way to customize the development workflow of a project to simplify and automate specific tasks that are required when working on the code base. For example, this includes tasks like formatting, "linting" and running tests before pushing a commit to ensure it conforms to the code style and works as expected. Most Git Hooks are not that complex and fullfil a simple purpose while other solutions like Danger [2] can help to manage larger projects and projects that need to scale. This "base" repository template initially uses a Git Hook that automatically runs configured linters on all files that have been staged and that match the configured pattern (file extension, filename etc.). Like documented in GH-15, NodeJS [3] is already a development dependency anyway so the lint-staged [4] NPM package is used for this goal. I've used this package in almost any project and it's again the most stable, production-proven and advanced tool that is currently out there with no comparable alternatives in other languages. >>> Configuration The configuration file `lint-staged.config.js` is placed in the project root and includes the command that should be run for matching file extensions (globs). Initialliy it includes the following three entries with the same order as listed here: 1. `prettier --list-different` - Runs Prettier [5] (GH-13) against `*.{js,json,md,yml}` to ensure all files are formatted correctly. The `--list-different` prints files that are not conform with the Prettier configuration. 2. `remark --no-stdout` - Runs remark-lint [6] (GH-15) against `*.md` to ensure all Markdown files are compliant to the style guide. The `--no-stdout` flag suppresses the output of the parsed file content. [1]: https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks [2]: https://danger.systems [3]: https://nodejs.org [4]: https://github.com/okonet/lint-staged [5]: https://prettier.io [6]: https://github.com/remarkjs/remark-lint GH-17
Merged
svengreb
added a commit
that referenced
this issue
Jun 20, 2020
Git Hooks [1] are a fantastic way to customize the development workflow of a project to simplify and automate specific tasks that are required when working on the code base. For example, this includes tasks like formatting, "linting" and running tests before pushing a commit to ensure it conforms to the code style and works as expected. Most Git Hooks are not that complex and fullfil a simple purpose while other solutions like Danger [2] can help to manage larger projects and projects that need to scale. This "base" repository template initially uses a Git Hook that automatically runs configured linters on all files that have been staged and that match the configured pattern (file extension, filename etc.). Like documented in GH-15, NodeJS [3] is already a development dependency anyway so the lint-staged [4] NPM package is used for this goal. I've used this package in almost any project and it's again the most stable, production-proven and advanced tool that is currently out there with no comparable alternatives in other languages. >>> Configuration The configuration file `lint-staged.config.js` is placed in the project root and includes the command that should be run for matching file extensions (globs). Initialliy it includes the following three entries with the same order as listed here: 1. `prettier --list-different` - Runs Prettier [5] (GH-13) against `*.{js,json,md,yml}` to ensure all files are formatted correctly. The `--list-different` prints files that are not conform with the Prettier configuration. 2. `remark --no-stdout` - Runs remark-lint [6] (GH-15) against `*.md` to ensure all Markdown files are compliant to the style guide. The `--no-stdout` flag suppresses the output of the parsed file content. [1]: https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks [2]: https://danger.systems [3]: https://nodejs.org [4]: https://github.com/okonet/lint-staged [5]: https://prettier.io [6]: https://github.com/remarkjs/remark-lint GH-17
svengreb
added a commit
that referenced
this issue
Jun 20, 2020
Git Hooks [1] are a fantastic way to customize the development workflow of a project to simplify and automate specific tasks that are required when working on the code base. For example, this includes tasks like formatting, "linting" and running tests before pushing a commit to ensure it conforms to the code style and works as expected. Most Git Hooks are not that complex and fullfil a simple purpose while other solutions like Danger [2] can help to manage larger projects and projects that need to scale. This "base" repository template initially uses a Git Hook that automatically runs configured linters on all files that have been staged and that match the configured pattern (file extension, filename etc.). Like documented in GH-15, NodeJS [3] is already a development dependency anyway so the lint-staged [4] NPM package is used for this goal. I've used this package in almost any project and it's again the most stable, production-proven and advanced tool that is currently out there with no comparable alternatives in other languages. >>> Configuration The configuration file `lint-staged.config.js` is placed in the project root and includes the command that should be run for matching file extensions (globs). Initialliy it includes the following three entries with the same order as listed here: 1. `prettier --check` - Runs Prettier [5] (GH-13) to ensure all files are formatted correctly. The `--list-different` prints files that are not conform with the Prettier configuration. 2. `remark --no-stdout` - Runs remark-lint [6] (GH-15) against `*.md` to ensure all Markdown files are compliant to the style guide. The `--no-stdout` flag suppresses the output of the parsed file content. [1]: https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks [2]: https://danger.systems [3]: https://nodejs.org [4]: https://github.com/okonet/lint-staged [5]: https://prettier.io [6]: https://github.com/remarkjs/remark-lint Closes GH-17
Resolved in abae9c2. |
svengreb
added a commit
that referenced
this issue
Jun 20, 2020
In GH-17 lint-staged [1] was added, a Git Hook [2] run linters against staged files before each commit. To automatically run this and other hooks that might be added later on, the hook manager and runner husky [3] is used. Like the already added tools Prettier [4], remark-lint [5] and lint-staged [6] it is (unfortunately) also written in JavaScript again Since NodeJS [7] is therefore already a development dependency it doesn't really matter that husky is another NPM package too. Unlike these previous tools there are indeed alternatives written in Go [8] like lefthook [9] or quickhook [10], but it requires time to test and evaluate them before actually replacing husky. Also a long as there are no comparable alternatives to the already used tools listed above, this template would be more complex by requiring both Node and Go as development dependency. Therefore husky takes over the part as hook manager & runner since it is a stable, production-proven and advanced project that I already use in almost any other project setup. >>> Configuration The `.huskyrc.js` configuration file is placed in the project root and includes the command to run for any supported Git hook [11]. Initially it contains entries for the following hooks: - `pre-commit` - Runs lint-staged (GH-17) before each commit to ensure all staged files are compliant to all style guides. [1]: https://github.com/okonet/lint-staged [2]: https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks [3]: https://github.com/typicode/husky [4]: #13 [5]: #15 [6]: #17 [7]: https://nodejs.org [8]: https://go.dev [9]: https://github.com/Arkweid/lefthook [10]: https://github.com/dirk/quickhook [11]: https://github.com/typicode/husky/blob/master/DOCS.md#supported-hooks GH-19
svengreb
added a commit
that referenced
this issue
Jun 20, 2020
In GH-17 lint-staged [1] was added, a Git Hook [2] run linters against staged files before each commit. To automatically run this and other hooks that might be added later on, the hook manager and runner husky [3] is used. Like the already added tools Prettier [4], remark-lint [5] and lint-staged [6] it is (unfortunately) also written in JavaScript again Since NodeJS [7] is therefore already a development dependency it doesn't really matter that husky is another NPM package too. Unlike these previous tools there are indeed alternatives written in Go [8] like lefthook [9] or quickhook [10], but it requires time to test and evaluate them before actually replacing husky. Also a long as there are no comparable alternatives to the already used tools listed above, this template would be more complex by requiring both Node and Go as development dependency. Therefore husky takes over the part as hook manager & runner since it is a stable, production-proven and advanced project that I already use in almost any other project setup. >>> Configuration The `.huskyrc.js` configuration file is placed in the project root and includes the command to run for any supported Git hook [11]. Initially it contains entries for the following hooks: - `pre-commit` - Runs lint-staged (GH-17) before each commit to ensure all staged files are compliant to all style guides. [1]: https://github.com/okonet/lint-staged [2]: https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks [3]: https://github.com/typicode/husky [4]: #13 [5]: #15 [6]: #17 [7]: https://nodejs.org [8]: https://go.dev [9]: https://github.com/Arkweid/lefthook [10]: https://github.com/dirk/quickhook [11]: https://github.com/typicode/husky/blob/master/DOCS.md#supported-hooks Resolves GH-19
svengreb
added a commit
that referenced
this issue
Aug 22, 2020
Git Hooks [1] are a fantastic way to customize the development workflow of a project to simplify and automate specific tasks that are required when working on the code base. For example, this includes tasks like formatting, "linting" and running tests before pushing a commit to ensure it conforms to the code style and works as expected. Most Git Hooks are not that complex and fullfil a simple purpose while other solutions like Danger [2] can help to manage larger projects and projects that need to scale. This "base" repository template initially uses a Git Hook that automatically runs configured linters on all files that have been staged and that match the configured pattern (file extension, filename etc.). Like documented in GH-15, NodeJS [3] is already a development dependency anyway so the lint-staged [4] NPM package is used for this goal. I've used this package in almost any project and it's again the most stable, production-proven and advanced tool that is currently out there with no comparable alternatives in other languages. >>> Configuration The configuration file `lint-staged.config.js` is placed in the project root and includes the command that should be run for matching file extensions (globs). Initialliy it includes the following three entries with the same order as listed here: 1. `prettier --check` - Runs Prettier [5] (GH-13) to ensure all files are formatted correctly. The `--list-different` prints files that are not conform with the Prettier configuration. 2. `remark --no-stdout` - Runs remark-lint [6] (GH-15) against `*.md` to ensure all Markdown files are compliant to the style guide. The `--no-stdout` flag suppresses the output of the parsed file content. [1]: https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks [2]: https://danger.systems [3]: https://nodejs.org [4]: https://github.com/okonet/lint-staged [5]: https://prettier.io [6]: https://github.com/remarkjs/remark-lint Closes GH-17
svengreb
added a commit
that referenced
this issue
Aug 22, 2020
In GH-17 lint-staged [1] was added, a Git Hook [2] run linters against staged files before each commit. To automatically run this and other hooks that might be added later on, the hook manager and runner husky [3] is used. Like the already added tools Prettier [4], remark-lint [5] and lint-staged [6] it is (unfortunately) also written in JavaScript again Since NodeJS [7] is therefore already a development dependency it doesn't really matter that husky is another NPM package too. Unlike these previous tools there are indeed alternatives written in Go [8] like lefthook [9] or quickhook [10], but it requires time to test and evaluate them before actually replacing husky. Also a long as there are no comparable alternatives to the already used tools listed above, this template would be more complex by requiring both Node and Go as development dependency. Therefore husky takes over the part as hook manager & runner since it is a stable, production-proven and advanced project that I already use in almost any other project setup. >>> Configuration The `.huskyrc.js` configuration file is placed in the project root and includes the command to run for any supported Git hook [11]. Initially it contains entries for the following hooks: - `pre-commit` - Runs lint-staged (GH-17) before each commit to ensure all staged files are compliant to all style guides. [1]: https://github.com/okonet/lint-staged [2]: https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks [3]: https://github.com/typicode/husky [4]: #13 [5]: #15 [6]: #17 [7]: https://nodejs.org [8]: https://go.dev [9]: https://github.com/Arkweid/lefthook [10]: https://github.com/dirk/quickhook [11]: https://github.com/typicode/husky/blob/master/DOCS.md#supported-hooks Resolves GH-19
svengreb
added a commit
that referenced
this issue
Aug 22, 2020
Git Hooks [1] are a fantastic way to customize the development workflow of a project to simplify and automate specific tasks that are required when working on the code base. For example, this includes tasks like formatting, "linting" and running tests before pushing a commit to ensure it conforms to the code style and works as expected. Most Git Hooks are not that complex and fullfil a simple purpose while other solutions like Danger [2] can help to manage larger projects and projects that need to scale. This "base" repository template initially uses a Git Hook that automatically runs configured linters on all files that have been staged and that match the configured pattern (file extension, filename etc.). Like documented in GH-15, NodeJS [3] is already a development dependency anyway so the lint-staged [4] NPM package is used for this goal. I've used this package in almost any project and it's again the most stable, production-proven and advanced tool that is currently out there with no comparable alternatives in other languages. >>> Configuration The configuration file `lint-staged.config.js` is placed in the project root and includes the command that should be run for matching file extensions (globs). Initialliy it includes the following three entries with the same order as listed here: 1. `prettier --check` - Runs Prettier [5] (GH-13) to ensure all files are formatted correctly. The `--list-different` prints files that are not conform with the Prettier configuration. 2. `remark --no-stdout` - Runs remark-lint [6] (GH-15) against `*.md` to ensure all Markdown files are compliant to the style guide. The `--no-stdout` flag suppresses the output of the parsed file content. [1]: https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks [2]: https://danger.systems [3]: https://nodejs.org [4]: https://github.com/okonet/lint-staged [5]: https://prettier.io [6]: https://github.com/remarkjs/remark-lint Closes GH-17
svengreb
added a commit
that referenced
this issue
Aug 22, 2020
In GH-17 lint-staged [1] was added, a Git Hook [2] run linters against staged files before each commit. To automatically run this and other hooks that might be added later on, the hook manager and runner husky [3] is used. Like the already added tools Prettier [4], remark-lint [5] and lint-staged [6] it is (unfortunately) also written in JavaScript again Since NodeJS [7] is therefore already a development dependency it doesn't really matter that husky is another NPM package too. Unlike these previous tools there are indeed alternatives written in Go [8] like lefthook [9] or quickhook [10], but it requires time to test and evaluate them before actually replacing husky. Also a long as there are no comparable alternatives to the already used tools listed above, this template would be more complex by requiring both Node and Go as development dependency. Therefore husky takes over the part as hook manager & runner since it is a stable, production-proven and advanced project that I already use in almost any other project setup. >>> Configuration The `.huskyrc.js` configuration file is placed in the project root and includes the command to run for any supported Git hook [11]. Initially it contains entries for the following hooks: - `pre-commit` - Runs lint-staged (GH-17) before each commit to ensure all staged files are compliant to all style guides. [1]: https://github.com/okonet/lint-staged [2]: https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks [3]: https://github.com/typicode/husky [4]: #13 [5]: #15 [6]: #17 [7]: https://nodejs.org [8]: https://go.dev [9]: https://github.com/Arkweid/lefthook [10]: https://github.com/dirk/quickhook [11]: https://github.com/typicode/husky/blob/master/DOCS.md#supported-hooks Resolves GH-19
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Labels
Git Hooks are a fantastic way to customize the development workflow of a project to simplify and automate specific tasks that are required when working on the code base. For example, this includes tasks like formatting, linting and running tests before pushing a commit to ensure it conforms to the code style and works as expected.
Most Git Hooks are not that complex and fullfil a simple purpose while other solutions like Danger can help to manage larger projects and projects that need to scale.
This base repository template will initially use a Git Hook that automatically runs configured linters on all files that have been staged and that match the configured pattern (file extension, filename etc.).
Like documented in #15, NodeJS is already a development dependency anyway so the lint-staged NPM package will be used for this goal. I‘ve used this package in almost any project and it‘s again the most stable, production-proven and advanced tool that is currently out there with no comparable alternatives in other languages.
Configuration
The configuration file
lint-staged.config.js
will be placed in the project root and includes the command that should be run for matching file extensions (globs). It will include at least the three following entries with the same order as listed here:prettier --list-different
- Runs Prettier (Code Formatter: Prettier #13) to ensure all files are formatted correctly. The--check
prints files that are not conform with the Prettier configuration.remark --no-stdout
- Runs remark-lint (Markdown Linting: remark-lint #15) against*.md
to ensure all Markdown files are compliant to the style guide. The--no-stdout
flag suppresses the output of the parsed file content.The text was updated successfully, but these errors were encountered: