Skip to content

Commit f6d3f28

Browse files
committed
chore: run lint
1 parent feeebbd commit f6d3f28

File tree

12 files changed

+92
-119
lines changed

12 files changed

+92
-119
lines changed

packages/vuefire/jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports = {
22
collectCoverage: true,
33
collectCoverageFrom: ['<rootDir>/src/**/*.js'],
4-
testURL: 'http://localhost/'
4+
testURL: 'http://localhost/',
55
}

packages/vuefire/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"LICENSE"
1616
],
1717
"scripts": {
18-
"lint": "eslint --color --ext=js,html src test examples",
18+
"lint": "eslint --color --ext=js,ts src test",
1919
"pretest": "yarn run lint",
2020
"test": "yarn run build && yarn run types && yarn run test:unit",
2121
"test:unit": "jest",
@@ -56,8 +56,6 @@
5656
"@posva/vuefire-bundler": "^1.1.4",
5757
"@posva/vuefire-test-helpers": "^1.1.0",
5858
"@types/jest": "^24.0.15",
59-
"eslint": "^6.0.1",
60-
"eslint-plugin-vue-libs": "^4.0.0",
6159
"firebase": "^6.3.0",
6260
"jest": "^24.8.0",
6361
"typescript": "^3.5.2"

packages/vuefire/src/index.js

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
1-
import {
2-
bindCollection,
3-
bindDocument,
4-
walkSet,
5-
firestoreOptions
6-
} from '@posva/vuefire-core'
1+
import { bindCollection, bindDocument, walkSet, firestoreOptions } from '@posva/vuefire-core'
72
export * from './rtdb'
83

94
const ops = {
105
set: (target, key, value) => walkSet(target, key, value),
116
add: (array, index, data) => array.splice(index, 0, data),
12-
remove: (array, index) => array.splice(index, 1)
7+
remove: (array, index) => array.splice(index, 1),
138
}
149

15-
function bind ({ vm, key, ref, ops }, options) {
10+
function bind({ vm, key, ref, ops }, options) {
1611
return new Promise((resolve, reject) => {
1712
let unbind
1813
if (ref.where) {
@@ -23,7 +18,7 @@ function bind ({ vm, key, ref, ops }, options) {
2318
ops,
2419
collection: ref,
2520
resolve,
26-
reject
21+
reject,
2722
},
2823
options
2924
)
@@ -35,7 +30,7 @@ function bind ({ vm, key, ref, ops }, options) {
3530
ops,
3631
document: ref,
3732
resolve,
38-
reject
33+
reject,
3934
},
4035
options
4136
)
@@ -44,44 +39,39 @@ function bind ({ vm, key, ref, ops }, options) {
4439
})
4540
}
4641

47-
export function firestorePlugin (
42+
export function firestorePlugin(
4843
Vue,
49-
{
50-
bindName = '$bind',
51-
unbindName = '$unbind',
52-
serialize = firestoreOptions.serialize
53-
} = {}
44+
{ bindName = '$bind', unbindName = '$unbind', serialize = firestoreOptions.serialize } = {}
5445
) {
5546
const strategies = Vue.config.optionMergeStrategies
5647
strategies.firestore = strategies.provide
5748

5849
const globalOptions = Object.assign({}, firestoreOptions, { serialize })
5950

6051
Vue.mixin({
61-
beforeCreate () {
52+
beforeCreate() {
6253
this._firestoreUnbinds = Object.create(null)
6354
this.$firestoreRefs = Object.create(null)
6455
},
65-
created () {
56+
created() {
6657
const { firestore } = this.$options
67-
const refs =
68-
typeof firestore === 'function' ? firestore.call(this) : firestore
58+
const refs = typeof firestore === 'function' ? firestore.call(this) : firestore
6959
if (!refs) return
7060
Object.keys(refs).forEach(key => {
7161
this[bindName](key, refs[key], globalOptions)
7262
})
7363
},
7464

75-
beforeDestroy () {
65+
beforeDestroy() {
7666
for (const subKey in this._firestoreUnbinds) {
7767
this._firestoreUnbinds[subKey]()
7868
}
7969
this._firestoreUnbinds = null
8070
this.$firestoreRefs = null
81-
}
71+
},
8272
})
8373

84-
Vue.prototype[bindName] = function (key, ref, options = globalOptions) {
74+
Vue.prototype[bindName] = function(key, ref, options = globalOptions) {
8575
options = Object.assign({}, globalOptions, options)
8676
if (this._firestoreUnbinds[key]) {
8777
this[unbindName](key)
@@ -91,15 +81,15 @@ export function firestorePlugin (
9181
vm: this,
9282
key,
9383
ref,
94-
ops
84+
ops,
9585
},
9686
options
9787
)
9888
this.$firestoreRefs[key] = ref
9989
return promise
10090
}
10191

102-
Vue.prototype[unbindName] = function (key) {
92+
Vue.prototype[unbindName] = function(key) {
10393
this._firestoreUnbinds[key]()
10494
delete this._firestoreUnbinds[key]
10595
delete this.$firestoreRefs[key]

packages/vuefire/src/rtdb.js

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {
22
rtdbBindAsArray as bindAsArray,
33
rtdbBindAsObject as bindAsObject,
44
rtdbOptions,
5-
walkSet
5+
walkSet,
66
} from '@posva/vuefire-core'
77

88
/**
@@ -11,7 +11,7 @@ import {
1111
* @param {firebase.database.Reference|firebase.database.Query} refOrQuery
1212
* @return {firebase.database.Reference}
1313
*/
14-
export function getRef (refOrQuery) {
14+
export function getRef(refOrQuery) {
1515
// check if it is a query
1616
if (typeof refOrQuery.ref === 'object') {
1717
refOrQuery = refOrQuery.ref
@@ -23,10 +23,10 @@ export function getRef (refOrQuery) {
2323
const ops = {
2424
set: (target, key, value) => walkSet(target, key, value),
2525
add: (array, index, data) => array.splice(index, 0, data),
26-
remove: (array, index) => array.splice(index, 1)
26+
remove: (array, index) => array.splice(index, 1),
2727
}
2828

29-
function bind (vm, key, source, options) {
29+
function bind(vm, key, source, options) {
3030
return new Promise((resolve, reject) => {
3131
let unbind
3232
if (Array.isArray(vm[key])) {
@@ -37,7 +37,7 @@ function bind (vm, key, source, options) {
3737
collection: source,
3838
resolve,
3939
reject,
40-
ops
40+
ops,
4141
},
4242
options
4343
)
@@ -49,7 +49,7 @@ function bind (vm, key, source, options) {
4949
document: source,
5050
resolve,
5151
reject,
52-
ops
52+
ops,
5353
},
5454
options
5555
)
@@ -58,32 +58,28 @@ function bind (vm, key, source, options) {
5858
})
5959
}
6060

61-
function unbind (vm, key) {
61+
function unbind(vm, key) {
6262
vm._firebaseUnbinds[key]()
6363
delete vm._firebaseSources[key]
6464
delete vm._firebaseUnbinds[key]
6565
}
6666

67-
export function rtdbPlugin (
67+
export function rtdbPlugin(
6868
Vue,
69-
{
70-
bindName = '$rtdbBind',
71-
unbindName = '$rtdbUnbind',
72-
serialize = rtdbOptions.serialize
73-
} = {}
69+
{ bindName = '$rtdbBind', unbindName = '$rtdbUnbind', serialize = rtdbOptions.serialize } = {}
7470
) {
7571
const strategies = Vue.config.optionMergeStrategies
7672
strategies.firebase = strategies.provide
7773

7874
const globalOptions = Object.assign({}, rtdbOptions, { serialize })
7975

8076
Vue.mixin({
81-
beforeCreate () {
77+
beforeCreate() {
8278
this.$firebaseRefs = Object.create(null)
8379
this._firebaseSources = Object.create(null)
8480
this._firebaseUnbinds = Object.create(null)
8581
},
86-
created () {
82+
created() {
8783
let bindings = this.$options.firebase
8884
if (typeof bindings === 'function') bindings = bindings.call(this)
8985
if (!bindings) return
@@ -93,21 +89,17 @@ export function rtdbPlugin (
9389
}
9490
},
9591

96-
beforeDestroy () {
92+
beforeDestroy() {
9793
for (const key in this._firebaseUnbinds) {
9894
this._firebaseUnbinds[key]()
9995
}
10096
this._firebaseSources = null
10197
this._firebaseUnbinds = null
10298
this.$firebaseRefs = null
103-
}
99+
},
104100
})
105101

106-
Vue.prototype[bindName] = function rtdbBind (
107-
key,
108-
source,
109-
options = globalOptions
110-
) {
102+
Vue.prototype[bindName] = function rtdbBind(key, source, options = globalOptions) {
111103
options = Object.assign({}, globalOptions, options)
112104
if (this._firebaseUnbinds[key]) {
113105
this[unbindName](key)
@@ -120,7 +112,7 @@ export function rtdbPlugin (
120112
return promise
121113
}
122114

123-
Vue.prototype[unbindName] = function rtdbUnbind (key) {
115+
Vue.prototype[unbindName] = function rtdbUnbind(key) {
124116
unbind(this, key)
125117
}
126118
}

packages/vuefire/test/bind.spec.js

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ describe('Firestore: binding', () => {
1313
// but it's a good practice to set it to an empty array
1414
data: () => ({
1515
items: null,
16-
item: null
17-
})
16+
item: null,
17+
}),
1818
})
1919
await tick()
2020
})
@@ -73,7 +73,7 @@ describe('Firestore: binding', () => {
7373

7474
expect(vm.item).toEqual({
7575
a: null,
76-
b: null
76+
b: null,
7777
})
7878
})
7979

@@ -93,7 +93,7 @@ describe('Firestore: binding', () => {
9393
expect(vm.item).toEqual({
9494
a: null,
9595
b: null,
96-
c: null
96+
c: null,
9797
})
9898
})
9999

@@ -122,7 +122,7 @@ describe('Firestore: binding', () => {
122122

123123
expect(vm.item).toEqual({
124124
a: null,
125-
b: { c: null }
125+
b: { c: null },
126126
})
127127
})
128128

@@ -141,7 +141,7 @@ describe('Firestore: binding', () => {
141141

142142
expect(vm.item).toEqual({
143143
a: { isA: true },
144-
b: { c: { isC: true }}
144+
b: { c: { isC: true } },
145145
})
146146
})
147147

@@ -157,7 +157,7 @@ describe('Firestore: binding', () => {
157157

158158
await vm.$bind('items', collection)
159159

160-
expect(vm.items).toEqual([{ a: null }, { b: { c: null }}])
160+
expect(vm.items).toEqual([{ a: null }, { b: { c: null } }])
161161
})
162162

163163
it('waits for nested refs with data in collections', async () => {
@@ -174,9 +174,6 @@ describe('Firestore: binding', () => {
174174

175175
await vm.$bind('items', collection)
176176

177-
expect(vm.items).toEqual([
178-
{ a: { isA: true }},
179-
{ b: { c: { isC: true }}}
180-
])
177+
expect(vm.items).toEqual([{ a: { isA: true } }, { b: { c: { isC: true } } }])
181178
})
182179
})

packages/vuefire/test/index.spec.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,19 @@ describe('Firestore: firestore option', () => {
1313
// but it's a good practice to set it to an empty array
1414
data: () => ({
1515
items: null,
16-
item: null
16+
item: null,
1717
}),
1818
firestore: {
1919
items: collection,
20-
item: document
21-
}
20+
item: document,
21+
},
2222
})
2323
await tick()
2424
})
2525

2626
it('does nothing with no firestore', () => {
2727
const vm = new Vue({
28-
data: () => ({ items: null })
28+
data: () => ({ items: null }),
2929
})
3030
expect(vm.items).toEqual(null)
3131
})
@@ -37,7 +37,7 @@ describe('Firestore: firestore option', () => {
3737

3838
it('setups _firestoreUnbinds with no firestore options', () => {
3939
const vm = new Vue({
40-
data: () => ({ items: null })
40+
data: () => ({ items: null }),
4141
})
4242
expect(vm._firestoreUnbinds).toBeTruthy()
4343
expect(Object.keys(vm._firestoreUnbinds)).toEqual([])

0 commit comments

Comments
 (0)