【发布时间】:2021-06-05 15:30:39
【问题描述】:
我正在用Vue3和Typescript写代码,这是App.vue的代码,是根组件:
<template>
<router-view v-if="inited" />
<div v-else>
Initing...
</div>
</template>
<script lang="ts">
import router from './router';
import { defineComponent } from 'vue';
import { useStore } from 'vuex';
import { key } from './store';
const store = useStore(key);
export default defineComponent({
data() {
return { inited: store.state.inited };
},
});
</script>
但是eslint 告诉我:
/home/peter/proj/skogkatt-next/src/App.vue
17:9 error Parsing error: '}' expected
我在 Google 等上使用了很多时间,但仍然找不到有用的解决方案。这是package.json中eslint的配置:
{
// ...
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint"
],
"extends": [
"plugin:vue/vue3-essential",
"eslint:recommended",
"@vue/typescript",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
"parserOptions": {
"parser": "@typescript-eslint/parser"
},
"rules": {
"@typescript-eslint/camelcase": "off"
}
},
// ...
}
我不确定哪个配置有用或没有用,所以我将它们发布出来。谢谢。
【问题讨论】: