intlify / eslint-plugin-vue-i18n

:globe_with_meridians: ESLint plugin for Vue I18n
https://eslint-plugin-vue-i18n.intlify.dev/
MIT License
135 stars 40 forks source link

Unexpected token export #6

Open marcoEgger opened 5 years ago

marcoEgger commented 5 years ago

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 commented 5 years ago

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

marcoEgger commented 5 years ago

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

panknows commented 1 month ago

have any updates?