Skip to content

Commit 5c58a1f

Browse files
committed
docs: update documentation on type-aware linting
1 parent 5329549 commit 5c58a1f

File tree

1 file changed

+31
-5
lines changed

1 file changed

+31
-5
lines changed

README.md

+31-5
Original file line numberDiff line numberDiff line change
@@ -101,16 +101,42 @@ export default [
101101
]
102102
```
103103

104+
### Linting with Type Information
105+
106+
Some `typescript-eslint` rules utilizes type information to provide deeper insights into your code.
107+
But type-checking is a much slower process than linting with only syntax information.
108+
It is not always easy to set up the type-checking environment for ESLint without severe performance penalties.
109+
110+
So we don't recommend you to configure individual type-aware rules and the corresponding language options all by yourself.
111+
Instead, you can start by extending from the `recommendedTypeChecked` configuration and then turn on/off the rules you need.
112+
113+
```js
114+
// eslint.config.mjs
115+
import pluginVue from "eslint-plugin-vue";
116+
import vueTsEslintConfig from "@vue/eslint-config-typescript";
117+
118+
export default [
119+
...pluginVue.configs["flat/essential"],
120+
...vueTsEslintConfig({ extends: ['recommendedTypeChecked'] }),
121+
{
122+
files: ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.vue'],
123+
rules: {
124+
// Turn off the recommended rules that you don't need.
125+
'@typescript-eslint/no-redundant-type-constituents': 'off',
126+
127+
// Turn on other rules that you need.
128+
'@typescript-eslint/require-array-sort-compare': 'error'
129+
}
130+
]
131+
```
132+
104133
## Further Reading
105134
106-
TODO
135+
- [All the extendable configurations from `typescript-eslint`](https://typescript-eslint.io/users/configs).
136+
- [All the available rules from `typescript-eslint`](https://typescript-eslint.io/rules/).
107137
108138
### With Other Community Configs
109139
110140
Work-In-Progress.
111141
112142
~~If you are following the [`standard`](https://standardjs.com/) or [`airbnb`](https://github.com/airbnb/javascript/) style guides, don't manually extend from this package. Please use `@vue/eslint-config-standard-with-typescript` or `@vue/eslint-config-airbnb-with-typescript` instead.~~
113-
114-
## Migrating from `.eslintrc.cjs`
115-
116-
TODO

0 commit comments

Comments
 (0)