Skip to content

Commit

Permalink
Bump prettier from 1.19.1 to 2.1.2 (#182)
Browse files Browse the repository at this point in the history
* Bump prettier from 1.19.1 to 2.1.2

Bumps [prettier](https://github.com/prettier/prettier) from 1.19.1 to 2.1.2.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/master/CHANGELOG.md)
- [Commits](prettier/prettier@1.19.1...2.1.2)

Signed-off-by: dependabot-preview[bot] <[email protected]>

* Fix all linter checks introduced in prettier 2.1.2

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Robert Clark <[email protected]>
  • Loading branch information
dependabot-preview[bot] and Robert Clark authored Oct 14, 2020
1 parent 1bfac3f commit 1b94f5a
Show file tree
Hide file tree
Showing 75 changed files with 311 additions and 331 deletions.
14 changes: 7 additions & 7 deletions apps/backend/src/database/database.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class DatabaseService {
}

async cleanAll() {
Object.values(this.sequelize.models).forEach(model => {
Object.values(this.sequelize.models).forEach((model) => {
model.destroy({where: {}});
});
}
Expand All @@ -26,18 +26,18 @@ export class DatabaseService {
}

const added = updated.filter(
updatedItem =>
source.find(sourceItem => sourceItem.id === updatedItem.id) ===
(updatedItem) =>
source.find((sourceItem) => sourceItem.id === updatedItem.id) ===
undefined
);
const changed = updated.filter(
updatedItem =>
source.find(sourceItem => sourceItem.id === updatedItem.id) !==
(updatedItem) =>
source.find((sourceItem) => sourceItem.id === updatedItem.id) !==
undefined
);
const deleted = source.filter(
sourceItem =>
updated.find(updatedItem => updatedItem.id === sourceItem.id) ===
(sourceItem) =>
updated.find((updatedItem) => updatedItem.id === sourceItem.id) ===
undefined
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class EvaluationTagsService {
EvaluationTag
>();
return evaluationTags.map(
evaluationTag => new EvaluationTagDto(evaluationTag)
(evaluationTag) => new EvaluationTagDto(evaluationTag)
);
}

Expand Down
2 changes: 1 addition & 1 deletion apps/backend/src/evaluations/dto/evaluation.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class EvaluationDto implements IEvaluation {
this.filename = evaluation.filename;
this.data = evaluation.data;
this.evaluationTags = evaluation.evaluationTags.map(
tag => new EvaluationTagDto(tag)
(tag) => new EvaluationTagDto(tag)
);
this.createdAt = evaluation.createdAt;
this.updatedAt = evaluation.updatedAt;
Expand Down
2 changes: 1 addition & 1 deletion apps/backend/src/evaluations/evaluations.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ describe('EvaluationsService', () => {
expect(updatedEvaluation.evaluationTags.length).toBeGreaterThan(
evaluation.evaluationTags.length
);
updatedEvaluation.evaluationTags.forEach(tag => {
updatedEvaluation.evaluationTags.forEach((tag) => {
expect(tag.id).toBeDefined();
expect(tag.createdAt).toBeDefined();
expect(tag.updatedAt).toBeDefined();
Expand Down
14 changes: 7 additions & 7 deletions apps/backend/src/evaluations/evaluations.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class EvaluationsService {
const evaluations = await this.evaluationModel.findAll<Evaluation>({
include: [EvaluationTag]
});
return evaluations.map(evaluation => new EvaluationDto(evaluation));
return evaluations.map((evaluation) => new EvaluationDto(evaluation));
}

async create(
Expand All @@ -35,7 +35,7 @@ export class EvaluationsService {
// Save the evaluation with no tags to get an ID.
const evaluationData = await evaluation.save();
const evaluationTagsPromises = createEvaluationDto?.evaluationTags?.map(
async createEvaluationTagDto => {
async (createEvaluationTagDto) => {
return this.evaluationTagsService.create(
evaluationData.id,
this.evaluationTagsService.objectFromDto(createEvaluationTagDto)
Expand Down Expand Up @@ -76,7 +76,7 @@ export class EvaluationsService {
);

const createTagPromises = evaluationTagsDelta.added.map(
async evaluationTag => {
async (evaluationTag) => {
return this.evaluationTagsService.create(
evaluation.id,
new CreateEvaluationTagDto(evaluationTag)
Expand All @@ -85,7 +85,7 @@ export class EvaluationsService {
);

const updateTagPromises = evaluationTagsDelta.changed.map(
async evaluationTag => {
async (evaluationTag) => {
return this.evaluationTagsService.update(
evaluationTag.id,
new UpdateEvaluationTagDto(evaluationTag)
Expand All @@ -94,7 +94,7 @@ export class EvaluationsService {
);

const deleteTagPromises = evaluationTagsDelta.deleted.map(
async evaluationTag => {
async (evaluationTag) => {
return this.evaluationTagsService.remove(evaluationTag.id);
}
);
Expand All @@ -114,9 +114,9 @@ export class EvaluationsService {
include: [EvaluationTag]
});
this.exists(evaluation);
await this.databaseService.sequelize.transaction(async transaction => {
await this.databaseService.sequelize.transaction(async (transaction) => {
await Promise.all([
evaluation.evaluationTags.map(async evaluationTag => {
evaluation.evaluationTags.map(async (evaluationTag) => {
await evaluationTag.destroy({transaction});
})
]);
Expand Down
2 changes: 1 addition & 1 deletion apps/backend/src/filters/unique-constraint-error.filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class UniqueConstraintErrorFilter implements ExceptionFilter {

buildMessage(errors: ValidationErrorItem[]): {}[] {
const builtErrors: {}[] = [];
errors.forEach(error => {
errors.forEach((error) => {
const message: {[id: string]: string} = {};
message[error.path] = error.message;
builtErrors.push(message);
Expand Down
5 changes: 3 additions & 2 deletions apps/backend/src/pipes/password-complexity.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ export class PasswordComplexityPipe implements PipeTransform {
RegExp('.{15,}')
];
return (
validators.filter(expr => expr.test(password)).length == validators.length
validators.filter((expr) => expr.test(password)).length ==
validators.length
);
}

Expand All @@ -49,6 +50,6 @@ export class PasswordComplexityPipe implements PipeTransform {
RegExp('[0-9]{4,}'),
RegExp(/[^\w\s]{4,}/)
];
return validators.filter(expr => expr.test(password)).length == 0;
return validators.filter((expr) => expr.test(password)).length === 0;
}
}
2 changes: 1 addition & 1 deletion apps/backend/src/users/users.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class UsersService {

async findAll(): Promise<UserDto[]> {
const users = await this.userModel.findAll<User>();
return users.map(user => new UserDto(user));
return users.map((user) => new UserDto(user));
}

async findById(id: number): Promise<UserDto> {
Expand Down
2 changes: 1 addition & 1 deletion apps/backend/test/authn.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe('/authn', () => {
.set('Content-Type', 'application/json')
.send(LOGIN_AUTHENTICATION)
.expect(HttpStatus.CREATED)
.then(response => {
.then((response) => {
expect(response.body.accessToken).toBeDefined();
});
});
Expand Down
18 changes: 9 additions & 9 deletions apps/backend/test/evaluations.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ describe('/evaluations', () => {
.post('/authn/login')
.set('Content-Type', 'application/json')
.send(LOGIN_AUTHENTICATION)
.then(response => {
.then((response) => {
jwtToken = response.body.accessToken;
});
});
Expand All @@ -103,7 +103,7 @@ describe('/evaluations', () => {
.set('Authorization', 'bearer ' + jwtToken)
.send(EVALUATION_1)
.expect(HttpStatus.CREATED)
.then(response => {
.then((response) => {
const createdAt = response.body.createdAt.valueOf();
const updatedAt = response.body.updatedAt.valueOf();

Expand Down Expand Up @@ -131,7 +131,7 @@ describe('/evaluations', () => {
.set('Authorization', 'bearer ' + jwtToken)
.send(EVALUATION_WITH_TAGS_1)
.expect(HttpStatus.CREATED)
.then(response => {
.then((response) => {
const createdAt = response.body.evaluationTags[0].createdAt.valueOf();
const updatedAt = response.body.evaluationTags[0].updatedAt.valueOf();

Expand Down Expand Up @@ -166,7 +166,7 @@ describe('/evaluations', () => {
.set('Content-Type', 'application/json')
.set('Authorization', 'bearer ' + jwtToken)
.send(EVALUATION_WITH_TAGS_1)
.then(response => {
.then((response) => {
evaluation = response.body;
});
});
Expand All @@ -177,7 +177,7 @@ describe('/evaluations', () => {
.get('/evaluations/' + evaluation.id)
.set('Authorization', 'bearer ' + jwtToken)
.expect(HttpStatus.OK)
.then(response => {
.then((response) => {
expect(response.body).toEqual(evaluation);
});
});
Expand All @@ -187,7 +187,7 @@ describe('/evaluations', () => {
.get('/evaluations')
.set('Authorization', 'bearer ' + jwtToken)
.expect(HttpStatus.OK)
.then(response => {
.then((response) => {
expect(response.body[0]).toEqual(evaluation);
});
});
Expand All @@ -200,7 +200,7 @@ describe('/evaluations', () => {
.set('Authorization', 'bearer ' + jwtToken)
.set(UPDATE_EVALUATION)
.expect(HttpStatus.OK)
.then(response => {
.then((response) => {
const updatedAt = response.body.updatedAt.valueOf();
const updatedDelta =
new Date().getTime() - new Date(updatedAt).getTime();
Expand All @@ -218,14 +218,14 @@ describe('/evaluations', () => {
.delete('/evaluations/' + evaluation.id)
.set('Authorization', 'bearer ' + jwtToken)
.expect(HttpStatus.OK)
.then(response => {
.then((response) => {
expect(response.body).toEqual(evaluation);
});

await request(app.getHttpServer())
.get('/evaluation-tags')
.set('Authorization', 'bearer ' + jwtToken)
.then(response => {
.then((response) => {
// There should be no tags in the database at this point because the evaluation
// containing them was deleted
expect(response.body).toEqual([]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ export class IntegrationSpecHelper {
.then(({data}) => {
return data;
})
.catch(error => {
.catch((error) => {
console.log(error);
});
}

// Useful for debugging
static async sleep(ms: number) {
return new Promise(resolve => setTimeout(resolve, ms));
return new Promise((resolve) => setTimeout(resolve, ms));
}
}
2 changes: 1 addition & 1 deletion apps/backend/test/integration/verifiers/form.verifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export class FormVerifier {
async verifyVMessageErrorPresent(page: Page, error: string): Promise<void> {
const toastText = await page.$eval(
'.v-messages__message',
el => el.innerHTML
(el) => el.innerHTML
);
expect(toastText).toContain(error);
}
Expand Down
10 changes: 5 additions & 5 deletions apps/backend/test/integration/verifiers/log-in.verifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@ export class LogInVerifier {
async verifyLoginFormPresent(page: Page): Promise<void> {
const loginFormHeader = await page.$eval(
'#login_form_title',
el => el.innerHTML
(el) => el.innerHTML
);
const emailLabel = await page.$eval(
'label[for="email_field"]',
el => el.innerHTML
(el) => el.innerHTML
);
const passwordLabel = await page.$eval(
'label[for="password_field"]',
el => el.innerHTML
(el) => el.innerHTML
);
const loginButton = await page.$eval(
'#login_button > span',
el => el.innerHTML
(el) => el.innerHTML
);
const signUpButton = await page.$eval(
'#sign_up_button > span',
el => el.innerHTML
(el) => el.innerHTML
);

expect(loginFormHeader).toContain('Login to Heimdall Server');
Expand Down
9 changes: 6 additions & 3 deletions apps/backend/test/integration/verifiers/navbar.verifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,25 @@ import {Page} from 'puppeteer';

export class NavbarVerifier {
async verifyLogout(page: Page): Promise<void> {
const logoutButton = await page.$eval('#logout > span', el => el.innerHTML);
const logoutButton = await page.$eval(
'#logout > span',
(el) => el.innerHTML
);
expect(logoutButton).toContain('Logout');
}

async verifyTitle(page: Page, title: string): Promise<void> {
const navbarTitle = await page.$eval(
'#toolbar_title > span',
el => el.innerHTML
(el) => el.innerHTML
);
expect(navbarTitle).toEqual(title);
}

async verifyUpload(page: Page): Promise<void> {
const uploadButton = await page.$eval(
'#upload-btn > span',
el => el.innerHTML
(el) => el.innerHTML
);
expect(uploadButton).toContain('Load');
}
Expand Down
12 changes: 6 additions & 6 deletions apps/backend/test/integration/verifiers/registration.verifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,27 @@ export class RegistrationVerifier {
async verifyRegistrationFormPresent(page: Page): Promise<void> {
const registrationFormHeader = await page.$eval(
'#registration_form_title',
el => el.innerHTML
(el) => el.innerHTML
);
const emailLabel = await page.$eval(
'label[for="email_field"]',
el => el.innerHTML
(el) => el.innerHTML
);
const passwordLabel = await page.$eval(
'label[for="password"]',
el => el.innerHTML
(el) => el.innerHTML
);
const passwordConfirmationLabel = await page.$eval(
'label[for="passwordConfirmation"]',
el => el.innerHTML
(el) => el.innerHTML
);
const registerButton = await page.$eval(
'#register > span',
el => el.innerHTML
(el) => el.innerHTML
);
const logInButton = await page.$eval(
'#login_button > span',
el => el.innerHTML
(el) => el.innerHTML
);

expect(registrationFormHeader).toContain('Register to Heimdall Server');
Expand Down
10 changes: 8 additions & 2 deletions apps/backend/test/integration/verifiers/toast.verifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,18 @@ import {Page} from 'puppeteer';
export class ToastVerifier {
// Get the error from the page and then check its contents with error.
async verifyErrorPresent(page: Page, error: string): Promise<void> {
const toastText = await page.$eval('.v-snack__content', el => el.innerHTML);
const toastText = await page.$eval(
'.v-snack__content',
(el) => el.innerHTML
);
expect(toastText).toContain(error);
}

async verifySuccessPresent(page: Page, text: string): Promise<void> {
const toastText = await page.$eval('.v-snack__content', el => el.innerHTML);
const toastText = await page.$eval(
'.v-snack__content',
(el) => el.innerHTML
);
expect(toastText).toContain(text);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export class UploadNexusVerifier {
async verifyNexusLoaded(page: Page): Promise<void> {
const navbarTitle = await page.$eval(
'.d-flex > .display-4',
el => el.innerHTML
(el) => el.innerHTML
);
expect(navbarTitle).toEqual('Heimdall');
}
Expand Down
Loading

0 comments on commit 1b94f5a

Please sign in to comment.