From 8ef29aa34ed17cf6fde745078caf88e738ea0f02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lehoczky=20Zolt=C3=A1n?= Date: Sat, 29 Jun 2024 13:05:27 +0200 Subject: [PATCH 1/4] docs: add an example on how to use custom parser with flat config --- docs/user-guide/index.md | 42 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/docs/user-guide/index.md b/docs/user-guide/index.md index df713852c..db4a2be5c 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 [Legacy Config] +// .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 [Flat Config] +// 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? From 34f37e1d5158d90dcb3189f2102a1007acb57209 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lehoczky=20Zolt=C3=A1n?= Date: Sun, 30 Jun 2024 15:23:52 +0200 Subject: [PATCH 2/4] docs: do not use the term "Legacy config" --- docs/user-guide/index.md | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/docs/user-guide/index.md b/docs/user-guide/index.md index db4a2be5c..fd2b5d326 100644 --- a/docs/user-guide/index.md +++ b/docs/user-guide/index.md @@ -150,8 +150,7 @@ Full example: ::: code-group -```json [Legacy Config] -// .eslintrc +```json [.eslintrc] { "root": true, "plugins": ["@typescript-eslint"], @@ -167,8 +166,7 @@ Full example: } ``` -```js [Flat Config] -// eslint.config.js +```js [eslint.config.js] import js from '@eslint/js' import eslintPluginVue from 'eslint-plugin-vue' import ts from 'typescript-eslint' @@ -483,8 +481,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", @@ -496,8 +493,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: { From 8ab1a7ca4daf6fc2e7589a7c5ec5ee4743edd2d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lehoczky=20Zolt=C3=A1n?= Date: Sun, 30 Jun 2024 16:05:06 +0200 Subject: [PATCH 3/4] fix: add component ending tag --- docs/user-guide/index.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/user-guide/index.md b/docs/user-guide/index.md index fd2b5d326..e6b8f3afe 100644 --- a/docs/user-guide/index.md +++ b/docs/user-guide/index.md @@ -186,6 +186,8 @@ export default ts.config( ) ``` +::: + 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? From 8f853a35e43ec2d3b2a341e9a2208f9bfec49c77 Mon Sep 17 00:00:00 2001 From: Yosuke Ota Date: Mon, 1 Jul 2024 08:48:48 +0900 Subject: [PATCH 4/4] Update index.md --- docs/user-guide/index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/user-guide/index.md b/docs/user-guide/index.md index e6b8f3afe..56195056d 100644 --- a/docs/user-guide/index.md +++ b/docs/user-guide/index.md @@ -483,7 +483,7 @@ In [Nuxt 3](https://nuxt.com/) or with [`unplugin-auto-import`](https://github.c ::: code-group -```json [.eslintrc] +```json [.eslintrc] { "globals": { "ref": "readonly", @@ -495,7 +495,7 @@ In [Nuxt 3](https://nuxt.com/) or with [`unplugin-auto-import`](https://github.c } ``` -```js [eslint.config.js] +```js [eslint.config.js] export default [ { languageOptions: {