diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000000..801d56deaa --- /dev/null +++ b/.eslintignore @@ -0,0 +1,4 @@ +app +node_modules +dist +.nuxt diff --git a/examples/async-component-injection/pages/_slug.vue b/examples/async-component-injection/pages/_slug.vue index 10b87643d3..32359858fb 100644 --- a/examples/async-component-injection/pages/_slug.vue +++ b/examples/async-component-injection/pages/_slug.vue @@ -12,7 +12,7 @@ const getPost = (slug) => ({ }) export default { - beforeCreate () { + beforeCreate() { this.component = () => getPost(this.$route.params.slug) } } diff --git a/examples/async-data/nuxt.config.js b/examples/async-data/nuxt.config.js index 9bd912b375..14c94a633e 100644 --- a/examples/async-data/nuxt.config.js +++ b/examples/async-data/nuxt.config.js @@ -12,7 +12,7 @@ module.exports = { }, generate: { routes: [ - '/posts/1', + '/posts/1' ] } } diff --git a/examples/async-data/pages/posts/_id.vue b/examples/async-data/pages/posts/_id.vue index d33d5c46bb..d7f33bb081 100644 --- a/examples/async-data/pages/posts/_id.vue +++ b/examples/async-data/pages/posts/_id.vue @@ -11,12 +11,12 @@ import axios from 'axios' export default { - async asyncData ({ params }) { + async asyncData({ params }) { // We can use async/await ES6 feature let { data } = await axios.get(`https://jsonplaceholder.typicode.com/posts/${params.id}`) return { post: data } }, - head () { + head() { return { title: this.post.title } diff --git a/examples/async-data/pages/posts/index.vue b/examples/async-data/pages/posts/index.vue index 404c127478..6a7014d4ed 100644 --- a/examples/async-data/pages/posts/index.vue +++ b/examples/async-data/pages/posts/index.vue @@ -15,12 +15,12 @@ import axios from 'axios' export default { - asyncData ({ req, params }) { + asyncData({ req, params }) { // We can return a Promise instead of calling the callback return axios.get('https://jsonplaceholder.typicode.com/posts') - .then((res) => { - return { posts: res.data.slice(0, 5) } - }) + .then((res) => { + return { posts: res.data.slice(0, 5) } + }) }, head: { title: 'List of posts' diff --git a/examples/auth-routes/api/index.js b/examples/auth-routes/api/index.js index c1943b789e..04d6febace 100644 --- a/examples/auth-routes/api/index.js +++ b/examples/auth-routes/api/index.js @@ -33,4 +33,4 @@ router.post('/logout', (req, res) => { module.exports = { path: '/api', handler: router -} \ No newline at end of file +} diff --git a/examples/auth-routes/pages/index.vue b/examples/auth-routes/pages/index.vue index ebfd771e60..1fe25b8373 100644 --- a/examples/auth-routes/pages/index.vue +++ b/examples/auth-routes/pages/index.vue @@ -20,7 +20,7 @@ diff --git a/examples/hello-world-jsx/pages/about.vue b/examples/hello-world-jsx/pages/about.vue index 7f7b2af070..26ed2649b8 100644 --- a/examples/hello-world-jsx/pages/about.vue +++ b/examples/hello-world-jsx/pages/about.vue @@ -1,11 +1,11 @@ diff --git a/examples/vue-class-component/components/Child.vue b/examples/vue-class-component/components/Child.vue index b3c5155dc0..8063fc7bc4 100644 --- a/examples/vue-class-component/components/Child.vue +++ b/examples/vue-class-component/components/Child.vue @@ -16,8 +16,8 @@ import Base from '@/components/Base' @Component export default class Child extends Base { // override parent method - greet () { - console.log('child greeting: ' + this.msg) + greet() { + console.log('child greeting: ' + this.msg) // eslint-disable-line no-console } } diff --git a/examples/vue-class-component/pages/index.vue b/examples/vue-class-component/pages/index.vue index ff468d2ed9..35e0116da2 100644 --- a/examples/vue-class-component/pages/index.vue +++ b/examples/vue-class-component/pages/index.vue @@ -11,7 +11,7 @@ import Child from '@/components/Child' components: { Child } }) export default class App extends Vue { - asyncData ({ req }) { + asyncData({ req }) { return { env: req ? 'server' : 'client' } } } diff --git a/examples/vuex-store-modules/pages/index.vue b/examples/vuex-store-modules/pages/index.vue index da3c9a4cac..33035823fc 100644 --- a/examples/vuex-store-modules/pages/index.vue +++ b/examples/vuex-store-modules/pages/index.vue @@ -23,14 +23,14 @@ import { mapState } from 'vuex' export default { // fetch(context) is called by the server-side // and before instantiating the component - fetch ({ store }) { + fetch({ store }) { store.commit('increment') }, computed: mapState([ 'counter' ]), methods: { - increment () { + increment() { this.$store.commit('increment') } } diff --git a/examples/vuex-store-modules/pages/todos.vue b/examples/vuex-store-modules/pages/todos.vue index a3aef45096..3c21b92a22 100644 --- a/examples/vuex-store-modules/pages/todos.vue +++ b/examples/vuex-store-modules/pages/todos.vue @@ -20,7 +20,7 @@ export default { todos: 'todos/todos' }), methods: { - addTodo (e) { + addTodo(e) { var text = e.target.value if (text.trim()) { this.$store.commit('todos/add', { text }) diff --git a/examples/vuex-store-modules/store/articles.js b/examples/vuex-store-modules/store/articles.js index e2fb76f674..a19b962c88 100644 --- a/examples/vuex-store-modules/store/articles.js +++ b/examples/vuex-store-modules/store/articles.js @@ -7,13 +7,13 @@ export const state = () => ({ }) export const mutations = { - add (state, title) { + add(state, title) { state.list.push(title) } } export const getters = { - get (state) { + get(state) { return state.list } } diff --git a/examples/vuex-store-modules/store/articles/comments.js b/examples/vuex-store-modules/store/articles/comments.js index dd7f3c47c0..4092086eee 100644 --- a/examples/vuex-store-modules/store/articles/comments.js +++ b/examples/vuex-store-modules/store/articles/comments.js @@ -7,13 +7,13 @@ export const state = () => ({ }) export const mutations = { - add (state, title) { + add(state, title) { state.list.push(title) } } export const getters = { - get (state) { + get(state) { return state.list } } diff --git a/examples/vuex-store-modules/store/index.js b/examples/vuex-store-modules/store/index.js index 63f1975bf2..b22221c9c7 100644 --- a/examples/vuex-store-modules/store/index.js +++ b/examples/vuex-store-modules/store/index.js @@ -3,7 +3,7 @@ export const state = () => ({ }) export const mutations = { - increment (state) { + increment(state) { state.counter++ } } diff --git a/examples/vuex-store-modules/store/todos.js b/examples/vuex-store-modules/store/todos.js index 5063cbd1b8..f482ec1242 100644 --- a/examples/vuex-store-modules/store/todos.js +++ b/examples/vuex-store-modules/store/todos.js @@ -3,20 +3,20 @@ export const state = () => ({ }) export const mutations = { - add (state, { text }) { + add(state, { text }) { state.list.push({ text, done: false }) }, - toggle (state, todo) { + toggle(state, todo) { todo.done = !todo.done } } export const getters = { - todos (state) { + todos(state) { return state.list } } diff --git a/examples/vuex-store/pages/index.vue b/examples/vuex-store/pages/index.vue index 0e9a15da3c..7406a84dd8 100644 --- a/examples/vuex-store/pages/index.vue +++ b/examples/vuex-store/pages/index.vue @@ -13,14 +13,14 @@ import { mapState } from 'vuex' export default { // fetch(context) is called by the server-side // and nuxt before instantiating the component - fetch ({ store }) { + fetch({ store }) { store.commit('increment') }, computed: mapState([ 'counter' ]), methods: { - increment () { + increment() { this.$store.commit('increment') } } diff --git a/examples/vuex-store/store/mutations.js b/examples/vuex-store/store/mutations.js index e85cce517e..81783007a1 100644 --- a/examples/vuex-store/store/mutations.js +++ b/examples/vuex-store/store/mutations.js @@ -1,7 +1,7 @@ const mutations = { - increment (state) { - state.counter++ - } + increment(state) { + state.counter++ + } } -export default mutations \ No newline at end of file +export default mutations diff --git a/examples/with-ava/pages/index.vue b/examples/with-ava/pages/index.vue index a3d80ae170..b411fa4762 100755 --- a/examples/with-ava/pages/index.vue +++ b/examples/with-ava/pages/index.vue @@ -4,7 +4,7 @@ diff --git a/examples/with-museui/plugins/museui.js b/examples/with-museui/plugins/museui.js index ae071085bb..623286c123 100644 --- a/examples/with-museui/plugins/museui.js +++ b/examples/with-museui/plugins/museui.js @@ -1,4 +1,4 @@ -import Vue from 'vue'; -import MuseUI from 'muse-ui'; +import Vue from 'vue' +import MuseUI from 'muse-ui' -Vue.use(MuseUI); +Vue.use(MuseUI) diff --git a/examples/with-sockets/pages/index.vue b/examples/with-sockets/pages/index.vue index 1e2fb24700..7184116d06 100644 --- a/examples/with-sockets/pages/index.vue +++ b/examples/with-sockets/pages/index.vue @@ -17,7 +17,7 @@ import socket from '~/plugins/socket.io.js' export default { - asyncData (context, callback) { + asyncData(context, callback) { socket.emit('last-messages', function (messages) { callback(null, { messages, @@ -28,16 +28,16 @@ export default { watch: { 'messages': 'scrollToBottom' }, - beforeMount () { + beforeMount() { socket.on('new-message', (message) => { this.messages.push(message) }) }, - mounted () { + mounted() { this.scrollToBottom() }, methods: { - sendMessage () { + sendMessage() { if (!this.message.trim()) return let message = { date: new Date().toJSON(), @@ -47,7 +47,7 @@ export default { this.message = '' socket.emit('send-message', message) }, - scrollToBottom () { + scrollToBottom() { this.$nextTick(() => { this.$refs.messages.scrollTop = this.$refs.messages.scrollHeight }) diff --git a/examples/with-tape/pages/index.vue b/examples/with-tape/pages/index.vue index 1ceb0086e2..b66e85f73e 100755 --- a/examples/with-tape/pages/index.vue +++ b/examples/with-tape/pages/index.vue @@ -7,14 +7,14 @@ diff --git a/examples/with-tape/test/index.test.js b/examples/with-tape/test/index.test.js index f586b68538..7d46c3d11e 100755 --- a/examples/with-tape/test/index.test.js +++ b/examples/with-tape/test/index.test.js @@ -3,41 +3,41 @@ import { shallow } from 'vue-test-utils' import Index from '../pages/index.vue' test('renders Index.vue correctly', t => { - t.plan(4) + t.plan(4) - const wrapper = shallow(Index, { - data: { - name: 'nuxt' - } - }) + const wrapper = shallow(Index, { + data: { + name: 'nuxt' + } + }) - const button = wrapper.find('button') + const button = wrapper.find('button') - t.equal( - wrapper.find('h1').text(), - 'Hello nuxt!', - 'renders "Hello nuxt!" text' - ) + t.equal( + wrapper.find('h1').text(), + 'Hello nuxt!', + 'renders "Hello nuxt!" text' + ) - t.equal( - wrapper.find('h1').hasClass('red'), - true, - 'h1 has a red class [default]' - ) + t.equal( + wrapper.find('h1').hasClass('red'), + true, + 'h1 has a red class [default]' + ) - button.trigger('click') + button.trigger('click') - t.equal( - wrapper.find('h1').hasClass('blue'), - true, - 'h1 class changes to blue [after 1st click]' - ) + t.equal( + wrapper.find('h1').hasClass('blue'), + true, + 'h1 class changes to blue [after 1st click]' + ) - button.trigger('click') + button.trigger('click') - t.equal( - wrapper.find('h1').hasClass('green'), - true, - 'h1 class changes to green [after 2nd click]' - ) + t.equal( + wrapper.find('h1').hasClass('green'), + true, + 'h1 class changes to green [after 2nd click]' + ) }) diff --git a/examples/with-tape/test/setup.js b/examples/with-tape/test/setup.js index 2e41fab524..69cf3aa353 100644 --- a/examples/with-tape/test/setup.js +++ b/examples/with-tape/test/setup.js @@ -5,10 +5,10 @@ require('browser-env')() // Setup vue files to be processed by `require-extension-hooks-vue` hooks('vue') - .plugin('vue') - .push() + .plugin('vue') + .push() // Setup vue and js files to be processed by `require-extension-hooks-babel` hooks(['vue', 'js']) - .plugin('babel') - .push() + .plugin('babel') + .push() diff --git a/examples/with-vuetify/nuxt.config.js b/examples/with-vuetify/nuxt.config.js index c1fc371f7a..df74955493 100644 --- a/examples/with-vuetify/nuxt.config.js +++ b/examples/with-vuetify/nuxt.config.js @@ -1,6 +1,3 @@ - -const { join } = require('path') - module.exports = { /* ** Head elements diff --git a/package.json b/package.json index 058e583002..8135fa0469 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "scripts": { "test": "npm run lint && cross-env NODE_ENV=test npm run build:nuxt && nyc ava --verbose --serial test/ -- && nyc report --reporter=html", "coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov", - "lint": "eslint --ext .js,.vue bin/** lib/** test/** --ignore-pattern app --ignore-pattern node_modules --ignore-pattern dist/", + "lint": "eslint --ext .js,.vue bin/** lib/** test/*.js examples/**", "build": "rimraf dist/ && npm run build:nuxt && npm run build:core", "build:nuxt": "rollup -c build/rollup.config.js --environment TARGET:nuxt", "build:core": "rollup -c build/rollup.config.js --environment TARGET:core",