You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/en/guide/other/faq.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ If you encounter a problem, you can start looking from the following aspects:
18
18
19
19
## Dependency Issues
20
20
21
-
In a `Monorepo` project, it is necessary to develop the habit of executing`pnpm install` every time you `git pull`the code, as new dependency packages are often added. The project has already configured automatic execution of `pnpm install` in `.husky/git-merge`, but sometimes there might be issues. If it does not execute automatically, it is recommended to execute it manually once.
21
+
In a `Monorepo` project, it's important to get into the habit of running`pnpm install`after every `git pull`because new dependencies are often added. The project has configured automatic execution of `pnpm install` in `lefthook.yml`, but sometimes there might be issues. If it does not execute automatically, it is recommended to execute it manually once.
Copy file name to clipboardExpand all lines: docs/src/en/guide/project/standard.md
+57-9Lines changed: 57 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,8 +33,8 @@ The project integrates the following code verification tools:
33
33
-[Prettier](https://prettier.io/) for code formatting
34
34
-[Commitlint](https://commitlint.js.org/) for checking the standard of git commit messages
35
35
-[Publint](https://publint.dev/) for checking the standard of npm packages
36
-
-[Lint Staged](https://github.com/lint-staged/lint-staged) for running code verification before git commits
37
36
-[Cspell](https://cspell.org/) for checking spelling errors
37
+
-[lefthook](https://github.com/evilmartians/lefthook) for managing Git hooks, automatically running code checks and formatting before commits
38
38
39
39
## ESLint
40
40
@@ -148,18 +148,66 @@ The cspell configuration file is `cspell.json`, which can be modified according
148
148
149
149
Git hooks are generally combined with various lints to check code style during git commits. If the check fails, the commit will not proceed. Developers need to modify and resubmit.
150
150
151
-
### husky
151
+
### lefthook
152
152
153
-
One issue is that the check will verify all code, but we only want to check the code we are committing. This is where husky comes in.
153
+
One issue is that the check will verify all code, but we only want to check the code we are committing. This is where lefthook comes in.
154
154
155
-
The most effective solution is to perform Lint checks locally before committing. A common practice is to use husky or pre-commit to perform a Lint check before local submission.
155
+
The most effective solution is to perform Lint checks locally before committing. A common practice is to use lefthook to perform a Lint check before local submission.
156
156
157
-
The project defines corresponding hooks inside `.husky`.
157
+
The project defines corresponding hooks inside `lefthook.yml`:
158
158
159
-
#### How to Disable Husky
159
+
-`pre-commit`: Runs before commit, used for code formatting and checking
160
160
161
-
If you want to disable Husky, simply delete the .husky directory.
-`lint-js`: Formats and checks JavaScript/TypeScript files
165
+
-`lint-style`: Formats and checks style files
166
+
-`lint-package`: Formats package.json
167
+
-`lint-json`: Formats other JSON files
162
168
163
-
### lint-staged
169
+
-`post-merge`: Runs after merge, used for automatic dependency installation
164
170
165
-
Used for automatically fixing style issues of committed files. Its configuration file is `.lintstagedrc.mjs`, which can be modified according to project needs.
171
+
-`install`: Runs `pnpm install` to install new dependencies
172
+
173
+
-`commit-msg`: Runs during commit, used for checking commit message format
174
+
-`commitlint`: Uses commitlint to check commit messages
175
+
176
+
#### How to Disable lefthook
177
+
178
+
If you want to disable lefthook, there are two ways:
179
+
180
+
::: code-group
181
+
182
+
```bash [Temporary disable]
183
+
git commit -m 'feat: add home page' --no-verify
184
+
```
185
+
186
+
```bash [Permanent disable]
187
+
# Simply delete the lefthook.yml file
188
+
rm lefthook.yml
189
+
```
190
+
191
+
:::
192
+
193
+
#### How to Modify lefthook Configuration
194
+
195
+
If you want to modify lefthook's configuration, you can edit the `lefthook.yml` file. For example:
0 commit comments