Skip to content

Commit 098ca1f

Browse files
authored
Merge pull request #27 from terrestris/update-readme
Update readme with eslint v9 hints
2 parents 2dfd278 + 5777158 commit 098ca1f

File tree

1 file changed

+32
-2
lines changed

1 file changed

+32
-2
lines changed

README.md

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ npm i -D @terrestris/eslint-config-typescript
1010

1111
2. Install peerDependencies
1212

13-
Can be omitted for already existing dependencies.
13+
Can be omitted for already existing dependencies, also usually the latest version will be installed when omitting the version when running `bun/npm i -D <package>`.
14+
1415
```bash
1516
npm i -D eslint@^9
1617
npm i -D @typescript-eslint/eslint-plugin@^8
17-
npm i -D @stylistic/eslint-plugin@^2
18+
npm i -D @stylistic/eslint-plugin@^4
1819
npm i -D typescript@^5
1920
```
2021

@@ -26,6 +27,35 @@ module.exports = {
2627
};
2728
```
2829

30+
4. Using eslint v9
31+
32+
First of all, make sure you use a recent node version!
33+
34+
After that, you can use a simple config like this to use this with eslint v9:
35+
36+
```js
37+
import tsParser from '@typescript-eslint/parser';
38+
import path from 'node:path';
39+
import { fileURLToPath } from 'node:url';
40+
import js from '@eslint/js';
41+
import { FlatCompat } from '@eslint/eslintrc';
42+
43+
const filename = fileURLToPath(import.meta.url);
44+
const dirname = path.dirname(filename);
45+
const compat = new FlatCompat({
46+
baseDirectory: dirname,
47+
recommendedConfig: js.configs.recommended,
48+
allConfig: js.configs.all
49+
});
50+
51+
export default [...compat.extends('@terrestris/eslint-config-typescript-react'), {
52+
files: ['**/*.ts', '**/*.tsx'],
53+
languageOptions: {
54+
parser: tsParser,
55+
},
56+
}];
57+
```
58+
2959
## Release
3060
3161
```bash

0 commit comments

Comments
 (0)