Skip to content

Commit 21142b1

Browse files
committed
docs: fix type-aware linting example
I know it's not an ideal solution. I may need to add additional options to the factory function later.
1 parent 3bca91e commit 21142b1

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

README.md

+10-3
Original file line numberDiff line numberDiff line change
@@ -111,22 +111,29 @@ It is not always easy to set up the type-checking environment for ESLint without
111111
So we don't recommend you to configure individual type-aware rules and the corresponding language options all by yourself.
112112
Instead, you can start by extending from the `recommendedTypeChecked` configuration and then turn on/off the rules you need.
113113

114+
As of now, all the rules you need to turn on must appear *before* calling `...vueTsEslintConfig({ extends: ['recommendedTypeChecked'] })`, and all the rules you need to turn off must appear *after* calling it.
115+
114116
```js
115117
// eslint.config.mjs
116118
import pluginVue from "eslint-plugin-vue";
117119
import vueTsEslintConfig from "@vue/eslint-config-typescript";
118120

119121
export default [
120122
...pluginVue.configs["flat/essential"],
123+
124+
{
125+
files: ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.vue'],
126+
rules: {
127+
// Turn on other rules that you need.
128+
'@typescript-eslint/require-array-sort-compare': 'error'
129+
}
130+
},
121131
...vueTsEslintConfig({ extends: ['recommendedTypeChecked'] }),
122132
{
123133
files: ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.vue'],
124134
rules: {
125135
// Turn off the recommended rules that you don't need.
126136
'@typescript-eslint/no-redundant-type-constituents': 'off',
127-
128-
// Turn on other rules that you need.
129-
'@typescript-eslint/require-array-sort-compare': 'error'
130137
}
131138
]
132139
```

0 commit comments

Comments
 (0)