Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected token export #6

Open
marcoEgger opened this issue Apr 11, 2019 · 3 comments
Open

Unexpected token export #6

marcoEgger opened this issue Apr 11, 2019 · 3 comments
Labels
Type: Feature Includes new features

Comments

@marcoEgger
Copy link

When running ESLint with vue-cli-service lint I get the following error:

SyntaxError: Error while loading rule 'vue-i18n/no-missing-keys': Unexpected token export
Occurred while linting xxx\src\App.vue
xxx\src\internationalization\languages\de.js:1
(function (exports, require, module, __filename, __dirname) { export default {
                                                              ^^^^^^

SyntaxError: Unexpected token export
    at new Script (vm.js:79:7)
    at createScript (vm.js:251:10)
    at Object.runInThisContext (vm.js:303:10)
    at Module._compile (internal/modules/cjs/loader.js:656:28)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
    at Module.load (internal/modules/cjs/loader.js:598:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
    at Function.Module._load (internal/modules/cjs/loader.js:529:3)
    at Module.require (internal/modules/cjs/loader.js:636:17)
    at require (internal/modules/cjs/helpers.js:20:18)

The message file de.js (and all others) look like this:

// de.js
export default {
  message: {
    navigation: {
      foo: 'bar'
    }
  }
}   

Can you help me with this? Did I configured something wrong?

Other project files

// eslintrc.js
module.exports = {
  root: true,
  env: {
    node: true
  },
  'extends': [
    'plugin:vue/essential',
    'plugin:vue/strongly-recommended',
    'plugin:vue/recommended',
    'plugin:vue-i18n/recommended',
    '@vue/standard'
  ],
  rules: {
    ...
  },
  parserOptions: {
    parser: 'babel-eslint'
  },
  settings: {
    'vue-i18n': {
      localeDir: './src/internationalization/languages/*.js'
    }
  }
}
// package.json
{
  ...
  "devDependencies": {
    "@vue/cli-plugin-babel": "3.5.5",
    "@vue/cli-plugin-eslint": "3.5.1",
    "@vue/cli-service": "3.5.3",
    "@vue/eslint-config-standard": "^4.0.0",
    "babel-eslint": "^10.0.1",
    "cross-env": "^5.2.0",
    "eslint": "5.16.0",
    "eslint-plugin-vue": "5.2.2",
    "eslint-plugin-vue-i18n": "^0.1.0",
    "node-sass": "^4.11.0",
    "sass-loader": "^7.1.0",
    "stylelint": "^9.10.1",
    "stylelint-config-recommended-scss": "^3.2.0",
    "stylelint-scss": "^3.5.4",
    "vue-template-compiler": "2.6.10"
  }
}
@kazupon
Copy link
Member

kazupon commented Apr 11, 2019

Unfotunatly, The locale message linting support json file only. 😞
I'll plan to support js file.

@kazupon kazupon added the Type: Feature Includes new features label Apr 11, 2019
@marcoEgger
Copy link
Author

marcoEgger commented Apr 12, 2019

Ahh ok. I never worked on an ESLint project/plugin, but is there anything on which I can support you?

@panknows
Copy link

panknows commented Oct 3, 2024

have any updates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature Includes new features
Projects
None yet
Development

No branches or pull requests

3 participants