diff --git a/.eslintignore b/.eslintignore index e35801d..1457c9c 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,6 +1,7 @@ /build/ /config/ /dist/ +/lib/ +/coverage/ /*.js -/__test__/ -/test/ +node_modules diff --git a/.eslintrc.js b/.eslintrc.js index ccec4fb..40219ff 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -7,6 +7,7 @@ module.exports = { }, env: { browser: true, + jest: true }, extends: [ // https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention @@ -25,7 +26,7 @@ module.exports = { 'generator-star-spacing': 'off', // allow debugger during development 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off', - 'no-console': process.env.NODE_ENV === 'production' ? ["error", { allow: ["warn", "error"] }] : 'off', + 'no-console': ["error", { allow: ["warn", "error"] }], 'camelcase': ['off', { properties: 'never' }], // "vue/max-attributes-per-line": [2, { // "singleline": 1, diff --git a/package-lock.json b/package-lock.json index 448715e..629a616 100644 --- a/package-lock.json +++ b/package-lock.json @@ -329,9 +329,9 @@ } }, "@vue/test-utils": { - "version": "1.0.0-beta.18", - "resolved": "https://registry.npmjs.org/@vue/test-utils/-/test-utils-1.0.0-beta.18.tgz", - "integrity": "sha1-U8IsS5AhGpjb8nCMC3F8GK2qmTw=", + "version": "1.0.0-beta.20", + "resolved": "https://registry.npmjs.org/@vue/test-utils/-/test-utils-1.0.0-beta.20.tgz", + "integrity": "sha1-70UFNBuALz3hwGs8uGUTeMhzcfo=", "dev": true, "requires": { "lodash": "4.17.4" diff --git a/package.json b/package.json index 53f88aa..dbddfd2 100644 --- a/package.json +++ b/package.json @@ -11,9 +11,10 @@ "dev": "cross-env NODE_ENV=development webpack-dev-server --hot --open --config build/webpack.dev.config.js", "demo": "cross-env NODE_ENV=production webpack --progress --hide-modules --config build/webpack.demo.config.js", "build": "cross-env NODE_ENV=production webpack --progress --hide-modules --config build/webpack.deploy.config.js", + "lint": "eslint src/**/* test/**/*", "test:push": "jest --coverage --coverageReporters=text-lcov | coveralls", "test": "jest", - "deploy": "npm test && npm run build" + "deploy": "npm run lint && npm test && npm run build" }, "jest": { "moduleFileExtensions": [ @@ -46,7 +47,7 @@ "fecha": "^2.3.3" }, "devDependencies": { - "@vue/test-utils": "^1.0.0-beta.18", + "@vue/test-utils": "^1.0.0-beta.20", "autoprefixer": "^7.2.6", "babel-core": "^6.26.3", "babel-eslint": "^8.2.3", diff --git a/src/mixins/locale.js b/src/mixins/locale.js index 56cd614..fd6c7d7 100644 --- a/src/mixins/locale.js +++ b/src/mixins/locale.js @@ -13,7 +13,7 @@ export default { name = component.$options.name } } - const lang = component && component.language || defaultLang + const lang = (component && component.language) || defaultLang const arr = path.split('.') let current = lang let value