Merge pull request #34 from overleaf/lint-format

Lint & Format
This commit is contained in:
Alasdair Smith 2020-06-15 11:58:55 +01:00 committed by GitHub
commit 3cc72d349c
9 changed files with 78 additions and 76 deletions

View file

@ -17,13 +17,13 @@ clean:
docker rmi gcr.io/overleaf-ops/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) docker rmi gcr.io/overleaf-ops/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER)
format: format:
$(DOCKER_COMPOSE) run --rm test_unit npm run format || true $(DOCKER_COMPOSE) run --rm test_unit npm run format
format_fix: format_fix:
$(DOCKER_COMPOSE) run --rm test_unit npm run format:fix $(DOCKER_COMPOSE) run --rm test_unit npm run format:fix
lint: lint:
$(DOCKER_COMPOSE) run --rm test_unit npm run lint || true $(DOCKER_COMPOSE) run --rm test_unit npm run lint
test: format lint test_unit test_acceptance test: format lint test_unit test_acceptance

View file

@ -67,7 +67,7 @@ module.exports = ContactManager = {
) )
} }
} }
;['touchContact', 'getContacts'].map(method => ;['touchContact', 'getContacts'].map((method) =>
metrics.timeAsyncMethod( metrics.timeAsyncMethod(
ContactManager, ContactManager,
method, method,

View file

@ -70,7 +70,7 @@ module.exports = HttpController = {
HttpController._sortContacts(contacts) HttpController._sortContacts(contacts)
contacts = contacts.slice(0, limit) contacts = contacts.slice(0, limit)
const contact_ids = contacts.map(contact => contact.user_id) const contact_ids = contacts.map((contact) => contact.user_id)
return res.status(200).send({ return res.status(200).send({
contact_ids contact_ids

View file

@ -29,7 +29,7 @@ module.exports = {
} else { } else {
this.initing = true this.initing = true
this.callbacks.push(callback) this.callbacks.push(callback)
return app.listen(3036, 'localhost', error => { return app.listen(3036, 'localhost', (error) => {
if (error != null) { if (error != null) {
throw error throw error
} }

View file

@ -66,11 +66,11 @@ describe('Getting Contacts', function() {
return async.series( return async.series(
[ [
// 2 is preferred since touched twice, then 3 since most recent, then 1 // 2 is preferred since touched twice, then 3 since most recent, then 1
cb => ContactsApp.ensureRunning(cb), (cb) => ContactsApp.ensureRunning(cb),
cb => touchContact(this.user_id, this.contact_id_1, cb), (cb) => touchContact(this.user_id, this.contact_id_1, cb),
cb => touchContact(this.user_id, this.contact_id_2, cb), (cb) => touchContact(this.user_id, this.contact_id_2, cb),
cb => touchContact(this.user_id, this.contact_id_2, cb), (cb) => touchContact(this.user_id, this.contact_id_2, cb),
cb => touchContact(this.user_id, this.contact_id_3, cb) (cb) => touchContact(this.user_id, this.contact_id_3, cb)
], ],
done done
) )

View file

@ -59,7 +59,7 @@ describe('ContactManager', function() {
.calledWith( .calledWith(
{ {
user_id: sinon.match( user_id: sinon.match(
o => o.toString() === this.user_id.toString() (o) => o.toString() === this.user_id.toString()
) )
}, },
{ {
@ -115,7 +115,9 @@ describe('ContactManager', function() {
it("should find the user's contacts", function () { it("should find the user's contacts", function () {
return this.db.contacts.findOne return this.db.contacts.findOne
.calledWith({ .calledWith({
user_id: sinon.match(o => o.toString() === this.user_id.toString()) user_id: sinon.match(
(o) => o.toString() === this.user_id.toString()
)
}) })
.should.equal(true) .should.equal(true)
}) })