Skip to content

Commit 41c9fee

Browse files
committed
docs: sync changelog and README regarding TypeScript
1 parent 6de7529 commit 41c9fee

File tree

2 files changed

+29
-15
lines changed

2 files changed

+29
-15
lines changed

.changeset/brown-pumpkins-matter.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,10 @@ export default {
1414
}
1515
```
1616

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.
18+
19+
```shell
20+
export NODE_OPTIONS="--experimental-strip-types"
21+
22+
npx lint-staged --config lint-staged.config.ts
23+
```

README.md

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -184,20 +184,6 @@ Configuration should be an object where each value is a command to run and its k
184184

185185
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.
186186

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-
export default {
197-
'*': 'prettier --write',
198-
}
199-
```
200-
201187
#### `package.json` example:
202188

203189
```json
@@ -222,6 +208,28 @@ So, considering you did `git add file1.ext file2.ext`, lint-staged will run the
222208

223209
`your-cmd file1.ext file2.ext`
224210

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+
export default {
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+
225233
### Task concurrency
226234

227235
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

Comments
 (0)