@@ -12,23 +12,31 @@ Currently, two official plugins are available:
1212If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
1313
1414``` js
15- export default tseslint .config ({
16- extends: [
17- // Remove ...tseslint.configs.recommended and replace with this
18- ... tseslint .configs .recommendedTypeChecked ,
19- // Alternatively, use this for stricter rules
20- ... tseslint .configs .strictTypeChecked ,
21- // Optionally, add this for stylistic rules
22- ... tseslint .configs .stylisticTypeChecked ,
23- ],
24- languageOptions: {
25- // other options...
26- parserOptions: {
27- project: [' ./tsconfig.node.json' , ' ./tsconfig.app.json' ],
28- tsconfigRootDir: import .meta.dirname,
15+ export default tseslint .config ([
16+ globalIgnores ([' dist' ]),
17+ {
18+ files: [' **/*.{ts,tsx}' ],
19+ extends: [
20+ // Other configs...
21+
22+ // Remove tseslint.configs.recommended and replace with this
23+ ... tseslint .configs .recommendedTypeChecked ,
24+ // Alternatively, use this for stricter rules
25+ ... tseslint .configs .strictTypeChecked ,
26+ // Optionally, add this for stylistic rules
27+ ... tseslint .configs .stylisticTypeChecked ,
28+
29+ // Other configs...
30+ ],
31+ languageOptions: {
32+ parserOptions: {
33+ project: [' ./tsconfig.node.json' , ' ./tsconfig.app.json' ],
34+ tsconfigRootDir: import .meta.dirname,
35+ },
36+ // other options...
2937 },
3038 },
31- } )
39+ ] )
3240```
3341
3442You can also install [ eslint-plugin-react-x] ( https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x ) and [ eslint-plugin-react-dom] ( https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom ) for React-specific lint rules:
@@ -38,20 +46,24 @@ You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-re
3846import reactX from ' eslint-plugin-react-x'
3947import reactDom from ' eslint-plugin-react-dom'
4048
41- export default tseslint .config ({
42- extends: [
43- // other configs...
44- // Enable lint rules for React
45- reactX .configs [' recommended-typescript' ],
46- // Enable lint rules for React DOM
47- reactDom .configs .recommended ,
48- ],
49- languageOptions: {
50- // other options...
51- parserOptions: {
52- project: [' ./tsconfig.node.json' , ' ./tsconfig.app.json' ],
53- tsconfigRootDir: import .meta.dirname,
49+ export default tseslint .config ([
50+ globalIgnores ([' dist' ]),
51+ {
52+ files: [' **/*.{ts,tsx}' ],
53+ extends: [
54+ // Other configs...
55+ // Enable lint rules for React
56+ reactX .configs [' recommended-typescript' ],
57+ // Enable lint rules for React DOM
58+ reactDom .configs .recommended ,
59+ ],
60+ languageOptions: {
61+ parserOptions: {
62+ project: [' ./tsconfig.node.json' , ' ./tsconfig.app.json' ],
63+ tsconfigRootDir: import .meta.dirname,
64+ },
65+ // other options...
5466 },
5567 },
56- } )
68+ ] )
5769```
0 commit comments