diff --git a/docs/user-guide/index.md b/docs/user-guide/index.md index df713852c..56195056d 100644 --- a/docs/user-guide/index.md +++ b/docs/user-guide/index.md @@ -146,6 +146,48 @@ If you want to use custom parsers such as [@babel/eslint-parser](https://www.npm } ``` +Full example: + +::: code-group + +```json [.eslintrc] +{ + "root": true, + "plugins": ["@typescript-eslint"], + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/recommended", + "plugin:vue/vue3-recommended" + ], + "parser": "vue-eslint-parser", + "parserOptions": { + "parser": "@typescript-eslint/parser" + } +} +``` + +```js [eslint.config.js] +import js from '@eslint/js' +import eslintPluginVue from 'eslint-plugin-vue' +import ts from 'typescript-eslint' + +export default ts.config( + js.configs.recommended, + ...ts.configs.recommended, + ...eslintPluginVue.configs['flat/recommended'], + { + files: ['*.vue', '**/*.vue'], + languageOptions: { + parserOptions: { + parser: '@typescript-eslint/parser' + } + } + } +) +``` + +::: + The `parserOptions.parser` option can also specify an object to specify multiple parsers. See [vue-eslint-parser README](https://github.com/vuejs/vue-eslint-parser#readme) for more details. ### How does ESLint detect components? @@ -441,8 +483,7 @@ In [Nuxt 3](https://nuxt.com/) or with [`unplugin-auto-import`](https://github.c ::: code-group -```json [Legacy Config] -// .eslintrc +```json [.eslintrc] { "globals": { "ref": "readonly", @@ -454,8 +495,7 @@ In [Nuxt 3](https://nuxt.com/) or with [`unplugin-auto-import`](https://github.c } ``` -```js [Flat Config] -// eslint.config.js +```js [eslint.config.js] export default [ { languageOptions: {