Skip to content

Commit 14a566f

Browse files
authored
eslint: add rule: object-shorthand; fix violations (#8794)
1 parent 85ec16c commit 14a566f

File tree

68 files changed

+357
-356
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+357
-356
lines changed

.eslintrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"no-tabs": "error",
4040
"no-trailing-spaces": "error",
4141
"no-undef-init": "error",
42+
"object-shorthand": ["error", "properties"],
4243
"semi": ["error", "always"],
4344
"curly": ["error", "all"],
4445
"space-unary-ops": ["error", {"words": true}],

bin/build-module.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ function buildModule(filepath) {
8383
var file = (isBrowser ? 'lib/index-browser' : 'lib/index') +
8484
(format === 'es' ? '.es.js' : '.js');
8585
return bundle.write({
86-
format: format,
86+
format,
8787
file: path.resolve(filepath, file)
8888
}).then(function () {
8989
console.log(' \u2713' + ' wrote ' +

bin/build-pouchdb.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,15 @@ function doRollup(input, browser, formatsToFiles) {
7474
var start = process.hrtime();
7575
return rollup.rollup({
7676
input: addPath('pouchdb', input),
77-
external: external,
77+
external,
7878
plugins: rollupPlugins({
7979
mainFields: ["module"],
80-
browser: browser
80+
browser
8181
})
8282
}).then(function (bundle) {
8383
return Promise.all(Object.keys(formatsToFiles).map(function (format) {
8484
var fileOut = formatsToFiles[format];
85-
return bundle.generate({format: format}).then(function (bundle) {
85+
return bundle.generate({format}).then(function (bundle) {
8686
if (DEV_MODE) {
8787
var ms = Math.round(process.hrtime(start)[1] / 1000000);
8888
console.log(' took ' + ms + ' ms to rollup ' +

packages/node_modules/pouchdb-abstract-mapreduce/src/createView.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ async function createView(sourceDB, viewName, mapFun, reduceFun, temporary, loca
4040
db.auto_compaction = true;
4141
const view = {
4242
name: depDbName,
43-
db: db,
44-
sourceDB: sourceDB,
43+
db,
44+
sourceDB,
4545
adapter: sourceDB.adapter,
46-
mapFun: mapFun,
47-
reduceFun: reduceFun
46+
mapFun,
47+
reduceFun
4848
};
4949

5050
let lastSeqDoc;

packages/node_modules/pouchdb-abstract-mapreduce/src/index.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ function createAbstractMapReduce(localDocName, mapper, reducer, ddocValidator) {
9595
try {
9696
fun(doc);
9797
} catch (e) {
98-
emitError(db, e, {fun: fun, doc: doc});
98+
emitError(db, e, {fun, doc});
9999
}
100100
}
101101

@@ -107,7 +107,7 @@ function createAbstractMapReduce(localDocName, mapper, reducer, ddocValidator) {
107107
try {
108108
return {output : fun(keys, values, rereduce)};
109109
} catch (e) {
110-
emitError(db, e, {fun: fun, keys: keys, values: values, rereduce: rereduce});
110+
emitError(db, e, {fun, keys, values, rereduce});
111111
return {error: e};
112112
}
113113
}
@@ -285,7 +285,7 @@ function createAbstractMapReduce(localDocName, mapper, reducer, ddocValidator) {
285285

286286
const response = await db.fetch('_design/' + parts[0] + '/_view/' + parts[1] + params, {
287287
headers: new Headers({'Content-Type': 'application/json'}),
288-
method: method,
288+
method,
289289
body: JSON.stringify(body)
290290
});
291291
ok = response.ok;
@@ -555,7 +555,7 @@ function createAbstractMapReduce(localDocName, mapper, reducer, ddocValidator) {
555555
let indexed_docs = 0;
556556
const progress = {
557557
view: view.name,
558-
indexed_docs: indexed_docs
558+
indexed_docs
559559
};
560560
view.sourceDB.emit('indexing', progress);
561561

@@ -651,7 +651,7 @@ function createAbstractMapReduce(localDocName, mapper, reducer, ddocValidator) {
651651
view: view.name,
652652
last_seq: response.last_seq,
653653
results_count: results.length,
654-
indexed_docs: indexed_docs
654+
indexed_docs
655655
};
656656
view.sourceDB.emit('indexing', progress);
657657
view.sourceDB.activeTasks.update(taskId, {completed_items: indexed_docs});
@@ -741,7 +741,7 @@ function createAbstractMapReduce(localDocName, mapper, reducer, ddocValidator) {
741741
groups.push({
742742
keys: [[e.key, e.id]],
743743
values: [e.value],
744-
groupKey: groupKey
744+
groupKey
745745
});
746746
});
747747
results = [];
@@ -816,7 +816,7 @@ function createAbstractMapReduce(localDocName, mapper, reducer, ddocValidator) {
816816
finalResults = {
817817
total_rows: totalRows,
818818
offset: skip,
819-
rows: rows
819+
rows
820820
};
821821
} else {
822822
// support limit, skip for keys query

packages/node_modules/pouchdb-adapter-http/src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,7 @@ function HttpPouch(opts, callback) {
831831

832832
try {
833833
const result = await fetchJSON(genDBUrl(host, '_all_docs' + paramStr), {
834-
method: method,
834+
method,
835835
body: JSON.stringify(body)
836836
});
837837
if (opts.include_docs && opts.attachments && opts.binary) {
@@ -989,7 +989,7 @@ function HttpPouch(opts, callback) {
989989
const url = genDBUrl(host, '_changes' + paramsToStr(params));
990990
const fetchOpts = {
991991
signal: controller.signal,
992-
method: method,
992+
method,
993993
body: JSON.stringify(body)
994994
};
995995
lastFetchedSeq = since;

packages/node_modules/pouchdb-adapter-idb/src/allDocs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function allDocsKeys(keys, docStore, onBatch) {
2626
if (event.target.result) {
2727
valuesBatch[index] = event.target.result;
2828
} else {
29-
valuesBatch[index] = {key: key, error: 'not_found'};
29+
valuesBatch[index] = {key, error: 'not_found'};
3030
}
3131
count++;
3232
if (count === keys.length) {

packages/node_modules/pouchdb-adapter-idb/src/bulkDocs.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ function idbBulkDocs(dbOpts, req, opts, api, idb, callback) {
361361
function add(att) {
362362
var digest = docInfo.data._attachments[att].digest;
363363
var req = attachAndSeqStore.put({
364-
seq: seq,
364+
seq,
365365
digestSeq: digest + '::' + seq
366366
});
367367

@@ -390,7 +390,7 @@ function idbBulkDocs(dbOpts, req, opts, api, idb, callback) {
390390
return callback(); // already exists
391391
}
392392
var newAtt = {
393-
digest: digest,
393+
digest,
394394
body: data
395395
};
396396
var putReq = attachStore.put(newAtt);

packages/node_modules/pouchdb-adapter-idb/src/changes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ function changes(opts, api, dbName, idb) {
174174

175175
function finish() {
176176
opts.complete(null, {
177-
results: results,
177+
results,
178178
last_seq: lastSeq
179179
});
180180
}

packages/node_modules/pouchdb-adapter-idb/src/index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ function init(api, opts, callback) {
219219
for (j = 0; j < digests.length; j++) {
220220
var digest = digests[j];
221221
attAndSeqStore.put({
222-
seq: seq,
222+
seq,
223223
digestSeq: digest + '::' + seq
224224
});
225225
}
@@ -332,7 +332,7 @@ function init(api, opts, callback) {
332332
}
333333

334334
function finish() {
335-
callback(err, {doc: doc, metadata: metadata, ctx: txn});
335+
callback(err, {doc, metadata, ctx: txn});
336336
}
337337

338338
txn.objectStore(DOC_STORE).get(id).onsuccess = function (e) {
@@ -614,7 +614,7 @@ function init(api, opts, callback) {
614614
callback(createError(MISSING_DOC));
615615
} else {
616616
oStore.delete(id);
617-
ret = {ok: true, id: id, rev: '0-0'};
617+
ret = {ok: true, id, rev: '0-0'};
618618
if (opts.ctx) { // return immediately
619619
callback(null, ret);
620620
}
@@ -737,12 +737,12 @@ function init(api, opts, callback) {
737737
}
738738
api._meta = {
739739
name: dbName,
740-
instanceId: instanceId,
741-
blobSupport: blobSupport
740+
instanceId,
741+
blobSupport
742742
};
743743

744744
cachedDBs.set(dbName, {
745-
idb: idb,
745+
idb,
746746
global: api._meta
747747
});
748748
callback(null, api);

0 commit comments

Comments
 (0)