diff --git a/docs/linting/TROUBLESHOOTING.md b/docs/linting/TROUBLESHOOTING.md index e477267c476..8c8319a1aaf 100644 --- a/docs/linting/TROUBLESHOOTING.md +++ b/docs/linting/TROUBLESHOOTING.md @@ -86,6 +86,21 @@ module.exports = { }; ``` +## I am running into errors when parsing TypeScript in my .vue files + +If you are running into issues parsing .vue files, it might be because parsers like [`vue-eslint-parser`](https://www.npmjs.com/package/vue-eslint-parser) are required to parse `.vue` files. In this case you can move `@typescript-eslint/parser` inside `parserOptions` and use `vue-eslint-parser` as the top level parser. + +```diff +- "parser": "@typescript-eslint/parser", ++ "parser": "vue-eslint-parser", + "parserOptions": { ++ "parser": "@typescript-eslint/parser", + "sourceType": "module" + } +``` + +The `parserOptions.parser` option can also specify an object to specify multiple parsers. See the [`vue-eslint-parser` usage guide](https://eslint.vuejs.org/user-guide/#usage) for more details. + ## One of my lint rules isn't working correctly on a pure JavaScript file This is to be expected - ESLint rules do not check file extensions on purpose, as it causes issues in environments that use non-standard extensions (for example, a `.vue` and a `.md` file can both contain TypeScript code to be linted).