Skip to content

Commit

Permalink
lint: Lint test/
Browse files Browse the repository at this point in the history
  • Loading branch information
Atinux committed Oct 31, 2017
1 parent b214972 commit b132dec
Show file tree
Hide file tree
Showing 39 changed files with 72 additions and 71 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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/*.js --ignore-pattern app",
"lint": "eslint --ext .js,.vue bin/** lib/** test/** --ignore-pattern app --ignore-pattern node_modules --ignore-pattern dist/",
"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",
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/basic/pages/async-data.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<script>
export default {
asyncData () {
asyncData() {
return new Promise((resolve) => {
setTimeout(() => resolve({ name: 'Nuxt.js' }), 10)
})
Expand Down
5 changes: 3 additions & 2 deletions test/fixtures/basic/pages/await-async-data.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ const fetchData = () => {
}
export default {
async asyncData () {
return await fetchData()
async asyncData() {
const data = await fetchData()
return data
}
}
</script>
2 changes: 1 addition & 1 deletion test/fixtures/basic/pages/callback-async-data.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<script>
export default {
async asyncData (context, callback) {
async asyncData(context, callback) {
setTimeout(function () {
callback(null, { name: 'Callback Nuxt.js' })
}, 10)
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/basic/pages/error.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<script>
export default {
asyncData ({ req }) {
asyncData({ req }) {
// Not for nuxt generate
if (req) {
throw new Error('Error mouahahah')
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/basic/pages/error2.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<script>
export default {
asyncData ({ error }) {
asyncData({ error }) {
error({ message: 'Custom error' })
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/basic/pages/redirect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<script>
export default {
fetch ({ redirect }) {
fetch({ redirect }) {
return redirect('/')
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/basic/pages/redirect2.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<script>
export default {
middleware: 'redirect',
created () {
created() {
throw new Error('NOPE!')
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/basic/pages/special-state.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<script>
export default {
fetch ({ beforeNuxtRender }) {
fetch({ beforeNuxtRender }) {
if (process.server) {
beforeNuxtRender(({ nuxtState }) => {
nuxtState.test = true
Expand Down
4 changes: 2 additions & 2 deletions test/fixtures/basic/pages/stateful.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

<script>
export default {
data () {
data() {
return { answer: null }
},
created () {
created() {
this.answer = 42
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/basic/pages/users/_id.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<script>
export default {
asyncData ({ params, payload }) {
asyncData({ params, payload }) {
if (payload) return payload
return { id: params.id }
}
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/basic/pages/validate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<script>
export default {
validate ({ query }) {
validate({ query }) {
return Boolean(query.valid)
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/basic/store/foo/bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export const state = () => ({
})

export const getters = {
baz (state) {
baz(state) {
return state.baz
}
}
2 changes: 1 addition & 1 deletion test/fixtures/basic/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export const state = () => ({
})

export const mutations = {
increment (state) {
increment(state) {
state.counter++
}
}
8 changes: 4 additions & 4 deletions test/fixtures/children/pages/parent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
<script>
export default {
async asyncData({ route }) {
const asyncData = {};
const asyncData = {}
await new Promise((resolve, reject) => {
setTimeout(() => {
asyncData.name = 'parent'
resolve();
resolve()
}, 100)
});
})
return asyncData;
return asyncData
}
}
</script>
10 changes: 5 additions & 5 deletions test/fixtures/children/pages/parent/_id.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
<script>
export default {
async asyncData({ route }) {
const asyncData = {};
const asyncData = {}
await new Promise((resolve, reject) => {
setTimeout(() => {
asyncData.id = route.params.id;
resolve();
asyncData.id = route.params.id
resolve()
}, 50)
});
})
return asyncData;
return asyncData
}
}
</script>
2 changes: 1 addition & 1 deletion test/fixtures/children/pages/parent/validate-child.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<script>
export default {
validate ({ query }) {
validate({ query }) {
return query.key === '12345'
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/debug/pages/error.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<script>
/* eslint no-undef: 0 */
export default {
data () {
data() {
throw new Error('test youch !')
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/module/modules/basic/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const path = require('path')

module.exports = function basicModule (options, resolve) {
module.exports = function basicModule(options, resolve) {
// Add vendor
this.addVendor('lodash')

Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/module/modules/basic/reverse.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import Vue from 'vue'

function $reverseStr (str) {
function $reverseStr(str) {
return str.split('').reverse().join('')
}

Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/module/modules/empty/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = function middlewareModule (options) {
module.exports = function middlewareModule(options) {
// Empty module
}

Expand Down
4 changes: 2 additions & 2 deletions test/fixtures/module/modules/middleware/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module.exports = function middlewareModule (options) {
module.exports = function middlewareModule(options) {
return new Promise((resolve, reject) => {
// Add /api endpoint
this.addServerMiddleware({
path: '/api',
handler (req, res, next) {
handler(req, res, next) {
res.end('It works!')
}
})
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/module/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Vue.use(Router)
const indexPage = () => import('~/views/index.vue').then(m => m.default || m)
const aboutPage = () => import('~/views/about.vue').then(m => m.default || m)

export function createRouter () {
export function createRouter() {
return new Router({
mode: 'history',
routes: [
Expand Down
6 changes: 3 additions & 3 deletions test/fixtures/spa/pages/custom.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<script>
export default {
layout: 'custom',
mounted () {
mounted() {
window.customMounted = (+window.customMounted) + 1
console.log('mounted')
console.log('mounted') // eslint-disable-line no-console
}
}
</script>
</script>
6 changes: 3 additions & 3 deletions test/fixtures/spa/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

<script>
export default {
mounted () {
mounted() {
window.indexMounted = (+window.indexMounted) + 1
console.log('mounted')
console.log('mounted') // eslint-disable-line no-console
}
}
</script>
</script>
8 changes: 4 additions & 4 deletions test/fixtures/ssr/components/test.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
import { nextId } from '@/lib/db'
export default {
data() {
return {
id: nextId()
}
data() {
return {
id: nextId()
}
}
}
</script>
2 changes: 1 addition & 1 deletion test/fixtures/ssr/pages/asyncComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
const AsyncTest = () => import('@/components/test.vue').then((m) => m.default || m)
export default {
components:{
components: {
AsyncTest
}
}
Expand Down
8 changes: 4 additions & 4 deletions test/fixtures/ssr/pages/asyncData.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
import { nextId } from '@/lib/db'
export default {
async asyncData() {
return {
id: nextId()
}
async asyncData() {
return {
id: nextId()
}
}
}
</script>
6 changes: 3 additions & 3 deletions test/fixtures/ssr/pages/component.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import test from '@/components/test'
export default {
components : {
test
}
components: {
test
}
}
</script>
8 changes: 4 additions & 4 deletions test/fixtures/ssr/pages/data.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
import { nextId } from '@/lib/db'
export default {
data() {
return {
id: nextId()
}
data() {
return {
id: nextId()
}
}
}
</script>
8 changes: 4 additions & 4 deletions test/fixtures/ssr/pages/fetch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import { nextId } from '@/lib/db'
export default {
async fetch({store}) {
// We use store just as a shared reference
store.__id = nextId()
},
async fetch({store}) {
// We use store just as a shared reference
store.__id = nextId()
}
}
</script>
4 changes: 2 additions & 2 deletions test/fixtures/ssr/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ export const state = () => {
}

export const mutations = {
setId2 (state, id) {
setId2(state, id) {
state.id2 = id
}
}

export const actions = {
nuxtServerInit ({ commit, state }, { route }) {
nuxtServerInit({ commit, state }, { route }) {
if (route.query.onServerInit === '1') {
commit('setId2', nextId())
}
Expand Down
4 changes: 2 additions & 2 deletions test/fixtures/with-config/components/loading.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ export default {
loading: false
}),
methods: {
start () {
start() {
this.loading = true
},
finish () {
finish() {
this.loading = false
}
}
Expand Down
4 changes: 2 additions & 2 deletions test/fixtures/with-config/middleware/noop.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export default function () {
// NOOP!
}
// NOOP!
}

0 comments on commit b132dec

Please sign in to comment.