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: .changeset/brown-pumpkins-matter.md
+7-1Lines changed: 7 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -14,4 +14,10 @@ export default {
14
14
}
15
15
```
16
16
17
-
It's also possible to use the `.ts` file extension for the configuration if your Node.js version supports it. The `--experimental-strip-type` flag was introduced in [Node.js v22.6.0](https://github.com/nodejs/node/releases/tag/v22.6.0) and unflagged in [v23.6.0](https://github.com/nodejs/node/releases/tag/v23.6.0), enabling Node.js to execute TypeScript files without additional configuration.
17
+
It's also possible to use the `.ts` file extension for the configuration if your Node.js version supports it. The `--experimental-strip-types` flag was introduced in [Node.js v22.6.0](https://github.com/nodejs/node/releases/tag/v22.6.0) and unflagged in [v23.6.0](https://github.com/nodejs/node/releases/tag/v23.6.0), enabling Node.js to execute TypeScript files without additional configuration.
Copy file name to clipboardExpand all lines: README.md
+22-14Lines changed: 22 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -184,20 +184,6 @@ Configuration should be an object where each value is a command to run and its k
184
184
185
185
You can also place multiple configuration files in different directories inside a project. For a given staged file, the closest configuration file will always be used. See ["How to use `lint-staged` in a multi-package monorepo?"](#how-to-use-lint-staged-in-a-multi-package-monorepo) for more info and an example.
186
186
187
-
### TypeScript
188
-
189
-
_Lint-staged_ provides TypeScript types for the main configuration format, usable in JS-based config files. Lint-staged doesn't currently support loading configuration from actual TS files, but it's possible to [use the JSDoc syntax together with TypeScript](https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html#import-types):
190
-
191
-
```js
192
-
/**
193
-
* @filename: lint-staged.config.js
194
-
* @type{import('lint-staged').Configuration}
195
-
*/
196
-
exportdefault {
197
-
'*':'prettier --write',
198
-
}
199
-
```
200
-
201
187
#### `package.json` example:
202
188
203
189
```json
@@ -222,6 +208,28 @@ So, considering you did `git add file1.ext file2.ext`, lint-staged will run the
222
208
223
209
`your-cmd file1.ext file2.ext`
224
210
211
+
### TypeScript
212
+
213
+
_Lint-staged_ provides TypeScript types for the main configuration format, usable in JS-based config files. Lint-staged doesn't currently support loading configuration from actual TS files, but it's possible to [use the JSDoc syntax together with TypeScript](https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html#import-types):
214
+
215
+
```js
216
+
/**
217
+
* @filename: lint-staged.config.js
218
+
* @type{import('lint-staged').Configuration}
219
+
*/
220
+
exportdefault {
221
+
'*':'prettier --write',
222
+
}
223
+
```
224
+
225
+
It's also possible to use the `.ts` file extension for the configuration if your Node.js version supports it. The `--experimental-strip-types` flag was introduced in [Node.js v22.6.0](https://github.com/nodejs/node/releases/tag/v22.6.0) and unflagged in [v23.6.0](https://github.com/nodejs/node/releases/tag/v23.6.0), enabling Node.js to execute TypeScript files without additional configuration.
226
+
227
+
```shell
228
+
export NODE_OPTIONS="--experimental-strip-types"
229
+
230
+
npx lint-staged --config lint-staged.config.ts
231
+
```
232
+
225
233
### Task concurrency
226
234
227
235
By default _lint-staged_ will run configured tasks concurrently. This means that for every glob, all the commands will be started at the same time. With the following config, both `eslint` and `prettier` will run at the same time:
0 commit comments