我有一个叫做Profile.js的vuex-orm模型
import { Model } from '@vuex-orm/core'
export default class Profile extends Model {
static entity = 'profile'
static fields () {
return {
id: this.uid(),
// etc...
}
}
}当我运行ionic serve时,我得到以下输出:
Build finished at 14:20:05 by 0.000s
[INFO] Browser window opened to http://localhost:4200!
ERROR in
[vue-cli-service] /home/user/IonicProjects/ionic/iloveu/src/store/models/Profile.js
[vue-cli-service] 4:19 error Parsing error: Unexpected token =
[vue-cli-service]
[vue-cli-service] ✖ 1 problem (1 error, 0 warnings)
[vue-cli-service]
[vue-cli-service] webpack compiled with 1 error所以它抱怨这条线
static entity = 'profile'它是完全有效的javascript或ecmascript。
我能做什么使这个有效的代码不被标记为错误?
我的.eslintrc
module.exports = {
root: true,
env: {
node: true
},
'extends': [
'plugin:vue/vue3-essential',
'prettier'
],
parserOptions: {
ecmaVersion: 2020
},
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'vue/no-deprecated-slot-attribute': 'off'
},
overrides: [
{
files: [
'**/__tests__/*.{j,t}s?(x)',
'**/tests/unit/**/*.spec.{j,t}s?(x)'
],
env: {
jest: true
}
}
]
}发布于 2022-01-07 13:50:40
看来这就是凶手的指纹
parserOptions: {
ecmaVersion: 2020
},改到
parserOptions: {
ecmaVersion: 2022
},不再返回此错误,这很奇怪,因为类星体框架使用ecmaVersion: 2018并且没有此错误。
https://stackoverflow.com/questions/70621949
复制相似问题