Skip to content

Commit cdb75c5

Browse files
committed
style: Add trailing commas
1 parent 346af06 commit cdb75c5

File tree

6 files changed

+23
-23
lines changed

6 files changed

+23
-23
lines changed

adapter-tests/unit-tests.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ module.exports = function testAdapter(options) {
9292
await adapter.put('/a-key', { views: [{ time: 1490623474639 }] });
9393

9494
expect(await adapter.get('/a-key')).toEqual({
95-
views: [{ time: 1490623474639 }]
95+
views: [{ time: 1490623474639 }],
9696
});
9797
});
9898

@@ -106,7 +106,7 @@ module.exports = function testAdapter(options) {
106106

107107
expect(await adapter.getAll({ pathname: '/' })).toEqual({
108108
'/a-key': { views: [{ time: 1490623474639 }] },
109-
'/another-key': { views: [{ time: 1490623474639 }] }
109+
'/another-key': { views: [{ time: 1490623474639 }] },
110110
});
111111
});
112112

@@ -117,7 +117,7 @@ module.exports = function testAdapter(options) {
117117

118118
expect(await adapter.getAll({ pathname: '/a' })).toEqual({
119119
'/a-key': { views: [{ time: 1490623474639 }] },
120-
'/another-key': { views: [{ time: 1490623474639 }] }
120+
'/another-key': { views: [{ time: 1490623474639 }] },
121121
});
122122
});
123123

@@ -131,7 +131,7 @@ module.exports = function testAdapter(options) {
131131
).toEqual({
132132
'/a-key': { views: [{ time: 1490623474639 }] },
133133
'/another-key': { views: [{ time: 1490623478639 }] },
134-
'/b-key': { views: [] }
134+
'/b-key': { views: [] },
135135
});
136136
});
137137

@@ -145,27 +145,27 @@ module.exports = function testAdapter(options) {
145145
).toEqual({
146146
'/a-key': { views: [] },
147147
'/another-key': { views: [{ time: 1490623478639 }] },
148-
'/b-key': { views: [{ time: 1490623484639 }] }
148+
'/b-key': { views: [{ time: 1490623484639 }] },
149149
});
150150
});
151151

152152
it('should return filtered saves from get based on before', async () => {
153153
await adapter.put('/a-key', {
154-
views: [{ time: 1490623474639 }, { time: 1490623478639 }]
154+
views: [{ time: 1490623474639 }, { time: 1490623478639 }],
155155
});
156156

157157
expect(await adapter.get('/a-key', { before: 1490623475640 })).toEqual({
158-
views: [{ time: 1490623474639 }]
158+
views: [{ time: 1490623474639 }],
159159
});
160160
});
161161

162162
it('should return filtered saves from get based on after', async () => {
163163
await adapter.put('/a-key', {
164-
views: [{ time: 1490623474639 }, { time: 1490623478639 }]
164+
views: [{ time: 1490623474639 }, { time: 1490623478639 }],
165165
});
166166

167167
expect(await adapter.get('/a-key', { after: 1490623475640 })).toEqual({
168-
views: [{ time: 1490623478639 }]
168+
views: [{ time: 1490623478639 }],
169169
});
170170
});
171171

@@ -185,7 +185,7 @@ module.exports = function testAdapter(options) {
185185

186186
expect(listener).toHaveBeenCalledWith({
187187
key: '/a-key',
188-
value: { views: [{ time: 1490623474639 }] }
188+
value: { views: [{ time: 1490623474639 }] },
189189
});
190190
});
191191

@@ -201,19 +201,19 @@ module.exports = function testAdapter(options) {
201201

202202
expect(listener1).toHaveBeenCalledWith({
203203
key: '/a-key',
204-
value: { views: [{ time: 1490623474639 }] }
204+
value: { views: [{ time: 1490623474639 }] },
205205
});
206206
expect(listener1).not.toHaveBeenCalledWith({
207207
key: '/b-key',
208-
value: { views: [{ time: 1490623474639 }] }
208+
value: { views: [{ time: 1490623474639 }] },
209209
});
210210
expect(listener2).toHaveBeenCalledWith({
211211
key: '/a-key',
212-
value: { views: [{ time: 1490623474639 }] }
212+
value: { views: [{ time: 1490623474639 }] },
213213
});
214214
expect(listener2).toHaveBeenCalledWith({
215215
key: '/b-key',
216-
value: { views: [{ time: 1490623474639 }] }
216+
value: { views: [{ time: 1490623474639 }] },
217217
});
218218
});
219219
} else {

adapter-tests/unit-tests.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ test({
99
modulePath: 'micro-analytics-adapter-flat-file-db',
1010
beforeEach: async () => {
1111
mockDb._reset();
12-
}
12+
},
1313
});

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
"dev": "NODE_ENV=development nodemon --config package.json --exec async-node src/index.js",
2525
"test": "jest",
2626
"test-now-deployment": "curl --fail $NOW_URL/test?inc=false",
27-
"format": "prettier --single-quote --write 'src/*.js' 'test/*.js' 'adapter-tests/*.js' '*.js'",
28-
"lint": "prettier-check --single-quote 'src/*.js' 'test/*.js' 'adapter-tests/*.js' '*.js'"
27+
"format": "prettier --single-quote --trailing-comma es5 --write 'src/*.js' 'test/*.js' 'adapter-tests/*.js' '*.js'",
28+
"lint": "prettier-check --single-quote --trailing-comma es5 'src/*.js' 'test/*.js' 'adapter-tests/*.js' '*.js'"
2929
},
3030
"jest": {
3131
"collectCoverageFrom": [

src/db.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ function initDbAdapter(options) {
1919

2020
module.exports = {
2121
initDbAdapter: initDbAdapter,
22-
hasFeature: feature => false
22+
hasFeature: feature => false,
2323
};

src/handler.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module.exports = async function(req, res) {
2121
sse.addClient(req, res);
2222
} else {
2323
send(res, 400, {
24-
error: 'The current database adapter does not support live updates.'
24+
error: 'The current database adapter does not support live updates.',
2525
});
2626
}
2727
}
@@ -34,9 +34,9 @@ module.exports = async function(req, res) {
3434
data: await db.getAll({
3535
pathname: pathname,
3636
before: parseInt(query.before, 10),
37-
after: parseInt(query.after, 10)
37+
after: parseInt(query.after, 10),
3838
}),
39-
time: Date.now()
39+
time: Date.now(),
4040
};
4141
send(res, 200, data);
4242
return;
@@ -63,7 +63,7 @@ module.exports = async function(req, res) {
6363
}
6464
if (req.method === 'GET') {
6565
send(res, 200, {
66-
views: shouldIncrement ? currentViews + 1 : currentViews
66+
views: shouldIncrement ? currentViews + 1 : currentViews,
6767
});
6868
} else {
6969
send(res, 200);

src/sse.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module.exports = function handleSseConnection(connection) {
44
const subscription = db.subscribe(event => {
55
connection.send({
66
event: 'micro-analytics-ping',
7-
data: JSON.stringify(event)
7+
data: JSON.stringify(event),
88
});
99
});
1010

0 commit comments

Comments
 (0)