在这里插入图片描述

前要:今天项目开发用到vue3技术框架+TypeScript语法+vite打包技术…,但是配置vue-router是报错Parsing error: Unexpected token.!顺便记录一下解决不同语法下的交接方法!!!
前提条件: 安装eslint-plugin-vue依赖
vue-cli(推荐):

vue add @vue/cli-plugin-eslint

npm:

npm install --save-dev eslint eslint-plugin-vue

yarn:

yarn add -D eslint eslint-plugin-vue

版本要求:
在这里插入图片描述
vue3+js : .eslint.js
在这里插入图片描述
vue3+ts : .eslint.js
在这里插入图片描述
如果你想使用自定义解析器,比如@babel/eslint-parser或者@typescript-eslint/parser时,就必须使用parserOptions.parser选项,而不是parser选项,因为这个插件需要vue-eslint-parser解析​.vue文件,如果覆盖parser选项,此插件不起作用​!!!
在这里插入图片描述

Logo

基于 Vue 的企业级 UI 组件库和中后台系统解决方案,为数万开发者服务。

更多推荐