Skip to content

Commit d6446f5

Browse files
authored
Merge pull request #1861 from flevi29/lint-staged-husky
Add `husky` and configure `lint-staged`
2 parents 9e43b62 + 0522724 commit d6446f5

11 files changed

+48
-25
lines changed

.github/workflows/docs.yml

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: Build documentation
22

3+
env:
4+
HUSKY: 0
5+
36
on:
47
push:
58
branches:

.github/workflows/meilisearch-prototype-tests.yml

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Testing the code base against a specific Meilisearch feature
22
name: Meilisearch prototype tests
33

4+
env:
5+
HUSKY: 0
6+
47
# Will only run for PRs and pushes to *-beta
58
on:
69
pull_request:

.github/workflows/pre-release-tests.yml

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Testing the code base against the Meilisearch pre-releases
22
name: Pre-Release Tests
33

4+
env:
5+
HUSKY: 0
6+
47
# Will only run for PRs and pushes to bump-meilisearch-v*
58
on:
69
pull_request:

.github/workflows/publish.yml

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ on:
33
release:
44
types: [published]
55

6+
env:
7+
HUSKY: 0
8+
69
jobs:
710
publish-npm:
811
runs-on: ubuntu-latest

.github/workflows/tests.yml

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: Tests
22

3+
env:
4+
HUSKY: 0
5+
36
on:
47
pull_request:
58
push:

.husky/pre-commit

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
yarn lint-staged

.prettierrc.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
// https://prettier.io/docs/en/options.html
2-
1+
/** @see {@link https://prettier.io/docs/en/options.html} */
32
export default {
43
plugins: ["./node_modules/prettier-plugin-jsdoc/dist/index.js"],
5-
// https://github.com/hosseinmd/prettier-plugin-jsdoc#tsdoc
4+
/** {@link https://github.com/hosseinmd/prettier-plugin-jsdoc#tsdoc} */
65
tsdoc: true,
76
};

CONTRIBUTING.md

+13-8
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ First of all, thank you for contributing to Meilisearch! The goal of this docume
88
- [How to Contribute](#how-to-contribute)
99
- [Development Workflow](#development-workflow)
1010
- [Git Guidelines](#git-guidelines)
11-
- [Release Process (for internal team only)](#release-process-for-internal-team-only)
11+
- [Release Process (for internal team only)](#release-process-for-the-internal-team-only)
1212

1313
<!-- /MarkdownTOC -->
1414

@@ -42,6 +42,7 @@ To run this project, you will need:
4242
You can set up your local environment natively or using `docker`, check out the [`docker-compose.yml`](/docker-compose.yml).
4343

4444
Example of running all the checks with docker:
45+
4546
```bash
4647
docker-compose run --rm package bash -c "yarn install && yarn test && yarn lint"
4748
```
@@ -79,6 +80,7 @@ We do not enforce any branch naming style, but please use something descriptive
7980
### Git Commits
8081

8182
As minimal requirements, your commit message should:
83+
8284
- be capitalized
8385
- not finish by a dot or any other punctuation character (!,?)
8486
- start with a verb so that we can read your commit message this way: "This commit will ...", where "..." is the commit message.
@@ -119,11 +121,13 @@ _[Read more about this](https://github.com/meilisearch/integration-guides/blob/m
119121
Make a PR modifying the following files with the right version:
120122

121123
[`package.json`](/package.json):
124+
122125
```javascript
123126
"version": "X.X.X",
124127
```
125128

126129
[`src/package-version`](/src/package-version.ts)
130+
127131
```javascript
128132
export const PACKAGE_VERSION = 'X.X.X'
129133
```
@@ -137,6 +141,7 @@ GitHub Actions will be triggered and push the package to [npm](https://www.npmjs
137141
#### Release a `beta` Version
138142

139143
This package is able to create multiple types of betas:
144+
140145
- A standard package beta, working on the latest version of Meilisearch.
141146
- A beta implementing the changes of a rc version of Meilisearch.
142147
- A beta implementing a specific feature `prototype` of Meilisearch.
@@ -159,16 +164,16 @@ Here are the steps to release a beta version of this package depending on its ty
159164

160165
3. Commit and push your code to the newly created branch (step 1).
161166

162-
163167
4. Go to the [GitHub interface for releasing](https://github.com/meilisearch/meilisearch-js/releases): on this page, click on `Draft a new release`.
164168

165169
5. Create a GitHub pre-release:
166-
- Fill the description with the detailed changelogs
167-
- Fill the title with `vX.X.X-beta.0`
168-
- Fill the tag with `vX.X.X-beta.0`
169-
- ⚠️ Select the `vX.X.X-beta.0` branch and NOT `main`
170-
- ⚠️ Click on the "This is a pre-release" checkbox
171-
- Click on "Publish release"
170+
171+
- Fill the description with the detailed changelogs
172+
- Fill the title with `vX.X.X-beta.0`
173+
- Fill the tag with `vX.X.X-beta.0`
174+
- ⚠️ Select the `vX.X.X-beta.0` branch and NOT `main`
175+
- ⚠️ Click on the "This is a pre-release" checkbox
176+
- Click on "Publish release"
172177

173178
<hr>
174179

lint-staged.config.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/**
2+
* @type {import("lint-staged").Configuration}
3+
* @see {@link https://github.com/lint-staged/lint-staged?tab=readme-ov-file#configuration}
4+
* @see {@link https://github.com/lint-staged/lint-staged?tab=readme-ov-file#using-js-configuration-files}
5+
*/
6+
export default { "*.{js,ts}": ["prettier -w", "eslint"] };

package.json

+6-14
Original file line numberDiff line numberDiff line change
@@ -60,36 +60,28 @@
6060
"lint": "eslint",
6161
"lint:fix": "eslint --fix",
6262
"style": "yarn fmt && yarn lint",
63-
"style:fix": "yarn fmt:fix && yarn lint:fix"
63+
"style:fix": "yarn fmt:fix && yarn lint:fix",
64+
"prepare": "husky"
6465
},
6566
"files": [
6667
"src",
6768
"dist",
6869
"CONTRIBUTING.md"
6970
],
70-
"lint-staged": {
71-
"**/*.{ts,tsx,js,jsx,css,scss,sass,less,md}": [
72-
"prettier --write",
73-
"git add"
74-
],
75-
"src/**/*.{ts,tsx}": [
76-
"yarn lint:fix",
77-
"git add"
78-
]
79-
},
8071
"devDependencies": {
8172
"@eslint/js": "^9.19.0",
8273
"@types/eslint__js": "^8.42.3",
8374
"@vitest/coverage-v8": "^3.0.7",
8475
"@types/node": "^22.13.8",
85-
"eslint": "^9.21.0",
86-
"eslint-plugin-tsdoc": "^0.4.0",
76+
"@typescript-eslint/utils": "^8.22.0",
8777
"@vitest/eslint-plugin": "^1.1.25",
78+
"eslint": "^9.21.0",
8879
"eslint-config-prettier": "^10.0.2",
80+
"eslint-plugin-tsdoc": "^0.4.0",
8981
"typescript": "^5.8.2",
9082
"vite": "^6.2.0",
91-
"@typescript-eslint/utils": "^8.22.0",
9283
"globals": "^16.0.0",
84+
"husky": "^9.1.7",
9385
"lint-staged": "15.4.3",
9486
"prettier": "^3.5.2",
9587
"prettier-plugin-jsdoc": "^1.3.2",

yarn.lock

+5
Original file line numberDiff line numberDiff line change
@@ -1599,6 +1599,11 @@ human-signals@^5.0.0:
15991599
resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-5.0.0.tgz#42665a284f9ae0dade3ba41ebc37eb4b852f3a28"
16001600
integrity sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==
16011601

1602+
husky@^9.1.7:
1603+
version "9.1.7"
1604+
resolved "https://registry.yarnpkg.com/husky/-/husky-9.1.7.tgz#d46a38035d101b46a70456a850ff4201344c0b2d"
1605+
integrity sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA==
1606+
16021607
ignore@^5.2.0, ignore@^5.3.1:
16031608
version "5.3.2"
16041609
resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.2.tgz#3cd40e729f3643fd87cb04e50bf0eb722bc596f5"

0 commit comments

Comments
 (0)