0

I have a vuex-orm model called Profile.js

import { Model } from '@vuex-orm/core'

export default class Profile extends Model {
    static entity = 'profile'

    static fields () {
        return {
            id: this.uid(),
            // etc...
        }
    }
}

When I run ionic serve I get the following output:

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

So it complains about this line

static entity = 'profile'

which is perfectly valid javascript or ecmascript.

What can I do so this valid code is not being tagged as erroneous?

my .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
      }
    }
  ]
}

reference to the vuex-orm documentation

1 Answer 1

1

Seems like this is the culprint

  parserOptions: {
    ecmaVersion: 2020
  },

changing it to

  parserOptions: {
    ecmaVersion: 2022
  },

does not return this error anymore, which is weird because the Quasar framework uses ecmaVersion: 2018 and does not have this error.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.