diff --git a/.eslintrc.js b/.eslintrc.js index dfe205ac..b1f64e48 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -2,8 +2,12 @@ module.exports = { root: true, extends: 'standard', 'rules': { - 'arrow-parens': 0, + 'arrow-parens': [2, 'as-needed'], 'no-new-func': 0, - 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0 + 'no-new': 0, + 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0, + 'standard/object-curly-even-spacing': [2, 'always', { + objectsInObjects: false + }] } } diff --git a/build/webpack.ssr.dev.config.js b/build/webpack.ssr.dev.config.js index 239b8144..a8de2550 100644 --- a/build/webpack.ssr.dev.config.js +++ b/build/webpack.ssr.dev.config.js @@ -1,6 +1,5 @@ var path = require('path') var alias = require('./alias') -var webpack = require('webpack') module.exports = { entry: path.resolve(__dirname, 'ssr.dev.entry.js'), diff --git a/package.json b/package.json index ffbdc193..de8d5bb1 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "dev-ssr": "webpack --watch --config build/webpack.ssr.dev.config.js", "test": "npm run unit && npm run e2e", "build": "NODE_ENV=production node build/build.js", - "lint": "eslint src build", + "lint": "eslint src build test", "unit": "karma start build/karma.unit.config.js", "cover": "karma start build/karma.cover.config.js", "e2e": "npm run build && node test/e2e/runner.js" diff --git a/test/e2e/.eslintrc b/test/e2e/.eslintrc new file mode 100644 index 00000000..e866525f --- /dev/null +++ b/test/e2e/.eslintrc @@ -0,0 +1,5 @@ +{ + "rules": { + "indent": 0 + } +} diff --git a/test/e2e/custom-commands/waitFor.js b/test/e2e/custom-commands/waitFor.js index b8e26255..42eea0b6 100644 --- a/test/e2e/custom-commands/waitFor.js +++ b/test/e2e/custom-commands/waitFor.js @@ -1,18 +1,18 @@ var util = require('util') var events = require('events') -var waitFor = function() { +var waitFor = function () { events.EventEmitter.call(this) } util.inherits(waitFor, events.EventEmitter) -waitFor.prototype.command = function(ms, cb) { +waitFor.prototype.command = function (ms, cb) { var self = this ms = ms || 1000 - setTimeout(function() { + setTimeout(function () { // if we have a callback, call it right before the complete event if (cb) { cb.call(self.client.api) diff --git a/test/e2e/specs/select2.js b/test/e2e/specs/select2.js index 87cb1770..506d5377 100644 --- a/test/e2e/specs/select2.js +++ b/test/e2e/specs/select2.js @@ -1,3 +1,4 @@ +/* globals vm */ module.exports = { 'select2': function (browser) { browser diff --git a/test/e2e/specs/svg.js b/test/e2e/specs/svg.js index 7aff08af..7726bff5 100644 --- a/test/e2e/specs/svg.js +++ b/test/e2e/specs/svg.js @@ -1,3 +1,4 @@ +/* globals stats, valueToPoint */ module.exports = { 'svg': function (browser) { browser diff --git a/test/unit/.eslintrc b/test/unit/.eslintrc new file mode 100644 index 00000000..52939e2a --- /dev/null +++ b/test/unit/.eslintrc @@ -0,0 +1,5 @@ +{ + "env": { + "jasmine": true + } +} diff --git a/test/unit/features/global-api/global-api.spec.js b/test/unit/features/global-api/global-api.spec.js index ab7cbdec..282e4af7 100644 --- a/test/unit/features/global-api/global-api.spec.js +++ b/test/unit/features/global-api/global-api.spec.js @@ -49,7 +49,7 @@ describe('Global API', () => { const vm = new Vue({ el: document.createElement('div'), template: '
', - components: {foo, bar} + components: { foo, bar } }) expect(vm.$el.innerHTML).toBe('foobar') }) diff --git a/test/unit/features/global-api/global-observer-api.spec.js b/test/unit/features/global-api/global-observer-api.spec.js index b74ee87e..2e682618 100644 --- a/test/unit/features/global-api/global-observer-api.spec.js +++ b/test/unit/features/global-api/global-observer-api.spec.js @@ -2,11 +2,11 @@ import Vue from 'vue' describe('Global Data Observer API', () => { describe('Vue.set', () => { - it('should update a vue object', (done) => { + it('should update a vue object', done => { const vm = new Vue({ el: document.createElement('div'), template: '
{{x}}
', - data: {x: 1} + data: { x: 1 } }) expect(vm.$el.innerHTML).toBe('1') Vue.set(vm, 'x', 2) @@ -16,11 +16,11 @@ describe('Global Data Observer API', () => { }) }) - it('should update a observing object', (done) => { + it('should update a observing object', done => { const vm = new Vue({ el: document.createElement('div'), template: '
{{foo.x}}
', - data: {foo: {x: 1}} + data: { foo: { x: 1 }} }) expect(vm.$el.innerHTML).toBe('1') Vue.set(vm.foo, 'x', 2) @@ -30,11 +30,11 @@ describe('Global Data Observer API', () => { }) }) - it('should update a observing array', (done) => { + it('should update a observing array', done => { const vm = new Vue({ el: document.createElement('div'), template: '
{{k}}-{{v}}
', - data: {list: ['a', 'b', 'c']} + data: { list: ['a', 'b', 'c'] } }) expect(vm.$el.innerHTML).toBe('
0-a
1-b
2-c
') Vue.set(vm.list, 1, 'd') @@ -44,11 +44,11 @@ describe('Global Data Observer API', () => { }) }) - it('should update a vue object with nothing', (done) => { + it('should update a vue object with nothing', done => { const vm = new Vue({ el: document.createElement('div'), template: '
{{x}}
', - data: {x: 1} + data: { x: 1 } }) expect(vm.$el.innerHTML).toBe('1') Vue.set(vm, 'x', null) @@ -64,11 +64,11 @@ describe('Global Data Observer API', () => { }) describe('Vue.delete', () => { - it('should delete a key', (done) => { + it('should delete a key', done => { const vm = new Vue({ el: document.createElement('div'), template: '
{{x}}
', - data: {x: 1} + data: { x: 1 } }) expect(vm.$el.innerHTML).toBe('1') vm.x = 2