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: README.md
+14-2
Original file line number
Diff line number
Diff line change
@@ -120,11 +120,13 @@ Note that you should manually run `npx simple-git-hooks` **every time you change
120
120
121
121
### Additional configuration options
122
122
123
-
You can also add a `.simple-git-hooks.cjs`, `.simple-git-hooks.js`, `simple-git-hooks.cjs`, `simple-git-hooks.js`, `.simple-git-hooks.json` or `simple-git-hooks.json` file to the project and write the configuration inside it.
123
+
You can also add a `.simple-git-hooks.cjs`, `.simple-git-hooks.js`, `.simple-git-hooks.mjs`, `simple-git-hooks.cjs`, `simple-git-hooks.js`, `simple-git-hooks.mjs`, `.simple-git-hooks.json` or `simple-git-hooks.json` file to the project and write the configuration inside it.
124
124
125
125
This way `simple-git-hooks` configuration in `package.json` will not take effect any more.
126
126
127
-
`.simple-git-hooks.cjs`, `.simple-git-hooks.js` or `simple-git-hooks.cjs`, `simple-git-hooks.js` should look like the following.
127
+
`.simple-git-hooks.cjs`, `.simple-git-hooks.js`, `.simple-git-hooks.mjs` or `simple-git-hooks.cjs`, `simple-git-hooks.js`, `simple-git-hooks.mjs` should look like the following.
128
+
129
+
#### CommonJS
128
130
129
131
```js
130
132
module.exports= {
@@ -133,6 +135,16 @@ module.exports = {
133
135
};
134
136
```
135
137
138
+
139
+
#### ES Modules
140
+
141
+
```js
142
+
exportdefault {
143
+
"pre-commit":"npx lint-staged",
144
+
"pre-push":"npm run format",
145
+
};
146
+
```
147
+
136
148
`.simple-git-hooks.json` or `simple-git-hooks.json` should look like the following.
throw('[ERROR] Config was not found! Please add `.simple-git-hooks.js` or `simple-git-hooks.js` or `.simple-git-hooks.json` or `simple-git-hooks.json` or `simple-git-hooks` entry in package.json.\r\nCheck README for details')
167
+
throw('[ERROR] Config was not found! Please add `.simple-git-hooks.cjs` or `.simple-git-hooks.js` or `.simple-git-hooks.mjs` or `simple-git-hooks.cjs` or `simple-git-hooks.js` or `simple-git-hooks.mjs` or `.simple-git-hooks.json` or `simple-git-hooks.json` or `simple-git-hooks` entry in package.json.\r\nCheck README for details')
0 commit comments