Skip to content

Commit 1dc101b

Browse files
lnuvyljharb
authored andcommitted
[Docs] add flat config guide for using tseslint.config()
1 parent 8b2d570 commit 1dc101b

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
1212

1313
### Changed
1414
- [Docs] [`extensions`], [`order`]: improve documentation ([#3106], thanks [@Xunnamius])
15+
- [Docs] add flat config guide for using `tseslint.config()` ([#3125], thanks [@lnuvy])
1516

1617
## [2.31.0] - 2024-10-03
1718

@@ -1161,6 +1162,7 @@ for info on changes for earlier releases.
11611162

11621163
[`memo-parser`]: ./memo-parser/README.md
11631164

1165+
[#3125]: https://github.com/import-js/eslint-plugin-import/pull/3125
11641166
[#3106]: https://github.com/import-js/eslint-plugin-import/pull/3106
11651167
[#3097]: https://github.com/import-js/eslint-plugin-import/pull/3097
11661168
[#3073]: https://github.com/import-js/eslint-plugin-import/pull/3073
@@ -1913,6 +1915,7 @@ for info on changes for earlier releases.
19131915
[@liuxingbaoyu]: https://github.com/liuxingbaoyu
19141916
[@ljharb]: https://github.com/ljharb
19151917
[@ljqx]: https://github.com/ljqx
1918+
[@lnuvy]: https://github.com/lnuvy
19161919
[@lo1tuma]: https://github.com/lo1tuma
19171920
[@loganfsmyth]: https://github.com/loganfsmyth
19181921
[@luczsoma]: https://github.com/luczsoma

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,26 @@ Make sure you have installed [`@typescript-eslint/parser`] and [`eslint-import-r
191191
[`@typescript-eslint/parser`]: https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser
192192
[`eslint-import-resolver-typescript`]: https://github.com/import-js/eslint-import-resolver-typescript
193193

194+
### Config - Flat with `config()` in `typescript-eslint`
195+
196+
If you are using the `config` method from [`typescript-eslint`](https://github.com/typescript-eslint/typescript-eslint), ensure that the `flatConfig` is included within the `extends` array.
197+
198+
```js
199+
import tseslint from 'typescript-eslint';
200+
import importPlugin from 'eslint-plugin-import';
201+
import js from '@eslint/js';
202+
203+
export default tseslint.config(
204+
js.configs.recommended,
205+
// other configs...
206+
{
207+
files: ['**/*.{ts,tsx}'],
208+
extends: [importPlugin.flatConfigs.recommended],
209+
// other configs...
210+
}
211+
);
212+
```
213+
194214
## Resolvers
195215

196216
With the advent of module bundlers and the current state of modules and module

0 commit comments

Comments
 (0)