Skip to content

Commit

Permalink
Feature/1135 formatter enable rules rebased (#1260)
Browse files Browse the repository at this point in the history
* apply eslint

squash branch

update eslint config

run formatter

fix tests

revert to single quotes

regen package-lock

move eslint dependendencies to devDependencies and update comment in eslint-config

remove not needed parent clings

fix typo in comment in scoring component tests

put both statements inside if statement

change asignment of args in global ts

add curly to eslint config

put curly into quotes

update comments to clarify that they are for lint

replace multiple ifs with one switch

replace multiple ifs with one switch

replace multiple ifs with one switch

turn no-non-null-assertion off and bring back all usages of

add strict equality

fix eslint errors

remove not needed comment

add todo for error handling oauth interceptor

update comments so its clear that linter needs them

revert change made accidentally

fix frontend unit tests

revert changes made accidentally

bring back all not null assertions and create some switch statements in scoring component for readability

* fix formatting errors

* regen package-lock

---------

Co-authored-by: Nevio Di Gennaro <[email protected]>
  • Loading branch information
kcinay055679 and nevio18324 authored Dec 24, 2024
1 parent 385a02b commit 1a1aed6
Show file tree
Hide file tree
Showing 79 changed files with 1,053 additions and 607 deletions.
18 changes: 11 additions & 7 deletions frontend/cypress/e2e/check-in.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('okr check-in', () => {
cy.loginAsUser(users.gl);
});

it(`should create check-in metric`, () => {
it('should create check-in metric', () => {
overviewPage
.addKeyResult()
.fillKeyResultTitle('Very important keyresult')
Expand All @@ -39,7 +39,7 @@ describe('okr check-in', () => {
cy.contains('We bought a new house');
});

it(`should create check-in metric with confidence 0`, () => {
it('should create check-in metric with confidence 0', () => {
overviewPage
.addKeyResult()
.fillKeyResultTitle('Very important keyresult')
Expand All @@ -61,7 +61,7 @@ describe('okr check-in', () => {
cy.contains('We bought a new house');
});

it(`should create check-in metric with value below baseline`, () => {
it('should create check-in metric with value below baseline', () => {
overviewPage
.addKeyResult()
.fillKeyResultTitle('This will not be good')
Expand Down Expand Up @@ -249,7 +249,7 @@ describe('okr check-in', () => {
cy.contains('STRETCH');
});

it(`should display confirm dialog when creating check-in on draft objective`, () => {
it('should display confirm dialog when creating check-in on draft objective', () => {
overviewPage.addObjective()
.fillObjectiveTitle('draft objective title')
.selectQuarter('3')
Expand All @@ -270,7 +270,7 @@ describe('okr check-in', () => {
.checkDescription('Dein Objective befindet sich noch im DRAFT Status. Möchtest du das Check-in trotzdem erfassen?');
});

it(`should only display last value div if last check-in is present`, () => {
it('should only display last value div if last check-in is present', () => {
const objectiveName = uniqueSuffix('new objective');

overviewPage.addObjective()
Expand Down Expand Up @@ -310,8 +310,12 @@ function getCurrentDate() {

let dd_str = '' + dd;
let mm_str = '' + mm;
if (dd < 10) dd_str = '0' + dd_str;
if (mm < 10) mm_str = '0' + mm_str;
if (dd < 10) {
dd_str = '0' + dd_str;
}
if (mm < 10) {
mm_str = '0' + mm_str;
}

return dd_str + '.' + mm_str + '.' + yyyy;
}
16 changes: 8 additions & 8 deletions frontend/cypress/e2e/objective-backlog.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('okr objective backlog', () => {
cy.loginAsUser(users.gl);
});

it(`should not have save button when creating objective in backlog quarter`, () => {
it('should not have save button when creating objective in backlog quarter', () => {
overviewPage
.addObjective()
.fillObjectiveTitle('Objective in quarter backlog')
Expand All @@ -27,7 +27,7 @@ describe('okr objective backlog', () => {
cy.contains('Objective in quarter backlog');
});

it(`should edit objective and move it to backlog`, () => {
it('should edit objective and move it to backlog', () => {
overviewPage.addObjective()
.fillObjectiveTitle('Move to another quarter on edit')
.submitDraftObjective();
Expand All @@ -50,7 +50,7 @@ describe('okr objective backlog', () => {
cy.contains('This goes now to backlog');
});

it(`should not be able to select backlog quarter when editing ongoing objective`, () => {
it('should not be able to select backlog quarter when editing ongoing objective', () => {
overviewPage.addObjective()
.fillObjectiveTitle('We can not move this to backlog')
.submit();
Expand All @@ -67,7 +67,7 @@ describe('okr objective backlog', () => {
.should('not.contain', 'Backlog');
});

it(`should release objective to another quarter from backlog`, () => {
it('should release objective to another quarter from backlog', () => {
overviewPage.visitBacklogQuarter();
overviewPage.addObjective()
.fillObjectiveTitle('We can not release this')
Expand Down Expand Up @@ -105,7 +105,7 @@ describe('okr objective backlog', () => {
cy.contains('This is our first released objective');
});

it(`should edit objective title in backlog`, () => {
it('should edit objective title in backlog', () => {
overviewPage.visitBacklogQuarter();
overviewPage.addObjective()
.fillObjectiveTitle('This is possible for edit')
Expand All @@ -124,7 +124,7 @@ describe('okr objective backlog', () => {
overviewPage.getObjectiveByNameAndState('My new title', 'draft');
});

it(`should edit objective in backlog and change quarter`, () => {
it('should edit objective in backlog and change quarter', () => {
overviewPage.visitBacklogQuarter();
overviewPage.addObjective()
.fillObjectiveTitle('This goes to other quarter later')
Expand All @@ -144,7 +144,7 @@ describe('okr objective backlog', () => {
overviewPage.getObjectiveByNameAndState('This goes to other quarter later', 'draft');
});

it(`should duplicate objective in backlog`, () => {
it('should duplicate objective in backlog', () => {
overviewPage.visitBacklogQuarter();
overviewPage.addObjective()
.fillObjectiveTitle('Ready for duplicate in backlog')
Expand Down Expand Up @@ -189,7 +189,7 @@ describe('okr objective backlog', () => {
.should('exist');
});

it(`should duplicate ongoing objective to backlog`, () => {
it('should duplicate ongoing objective to backlog', () => {
overviewPage.addObjective()
.fillObjectiveTitle('Possible to duplicate into backlog')
.submit();
Expand Down
14 changes: 7 additions & 7 deletions frontend/cypress/e2e/objective-crud.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('crud operations', () => {
'draft-icon.svg']].forEach(([objectiveTitle,
buttonTestId,
icon]) => {
it(`should create objective without key-results`, () => {
it('should create objective without key-results', () => {
overviewPage.addObjective()
.fillObjectiveTitle(objectiveTitle)
.selectQuarter('3');
Expand All @@ -32,7 +32,7 @@ describe('crud operations', () => {
});
});

it(`should display error message when title not set`, () => {
it('should display error message when title not set', () => {
overviewPage.addObjective();
cy.getByTestId('title')
.first()
Expand All @@ -47,7 +47,7 @@ describe('crud operations', () => {
.should('not.be.disabled');
});

it(`should cancel creating an objective`, () => {
it('should cancel creating an objective', () => {
const objectiveTitle = 'this is a canceled objective';
overviewPage.addObjective()
.selectQuarter('3')
Expand All @@ -57,7 +57,7 @@ describe('crud operations', () => {
.should('not.exist');
});

it(`should delete existing objective`, () => {
it('should delete existing objective', () => {
overviewPage.getFirstObjective()
.findByTestId('three-dot-menu')
.click();
Expand All @@ -69,15 +69,15 @@ describe('crud operations', () => {
.submit();
});

it(`should open objective detail view via click`, () => {
it('should open objective detail view via click', () => {
overviewPage.getFirstObjective()
.find('.title')
.click();
cy.url()
.should('include', 'objective');
});

it(`should edit objective`, () => {
it('should edit objective', () => {
const updatedTitle = 'This is an updated title';
overviewPage.getFirstObjective()
.findByTestId('three-dot-menu')
Expand All @@ -90,7 +90,7 @@ describe('crud operations', () => {
.should('exist');
});

it(`should duplicate objective`, () => {
it('should duplicate objective', () => {
const duplicatedTitle = 'This is a duplicated objective';
overviewPage.getFirstObjective()
.findByTestId('three-dot-menu')
Expand Down
18 changes: 9 additions & 9 deletions frontend/cypress/e2e/objective.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('okr objective', () => {
});

describe('tests via click', () => {
it(`should release objective from draft to ongoing`, () => {
it('should release objective from draft to ongoing', () => {
overviewPage.addObjective()
.fillObjectiveTitle('A objective in state draft')
.submitDraftObjective();
Expand All @@ -31,7 +31,7 @@ describe('okr objective', () => {
.should('exist');
});

it(`should complete objective with successful`, () => {
it('should complete objective with successful', () => {
overviewPage.addObjective()
.fillObjectiveTitle('We want to complete this successful')
.submit();
Expand All @@ -58,7 +58,7 @@ describe('okr objective', () => {
overviewPage.getObjectiveByNameAndState('We want to complete this successful', 'successful');
});

it(`should complete objective with not-successful`, () => {
it('should complete objective with not-successful', () => {
overviewPage.addObjective()
.fillObjectiveTitle('A not successful objective')
.submit();
Expand All @@ -84,7 +84,7 @@ describe('okr objective', () => {
overviewPage.getObjectiveByNameAndState('A not successful objective', 'not-successful');
});

it(`should reopen successful objective`, () => {
it('should reopen successful objective', () => {
overviewPage.addObjective()
.fillObjectiveTitle('This objective will be reopened after')
.submit();
Expand Down Expand Up @@ -119,7 +119,7 @@ describe('okr objective', () => {
.should('exist');
});

it(`should cancel reopening successful objective`, () => {
it('should cancel reopening successful objective', () => {
overviewPage.addObjective()
.fillObjectiveTitle('The reopening of this objective will be canceled')
.submit();
Expand Down Expand Up @@ -198,7 +198,7 @@ describe('okr objective', () => {
.should('exist');
});

it(`should search and find objectives`, () => {
it('should search and find objectives', () => {
overviewPage.addObjective()
.fillObjectiveTitle('Search after this objective')
.submit();
Expand Down Expand Up @@ -258,7 +258,7 @@ describe('okr objective', () => {
.should('not.exist');
});

it(`should create objective in other quarter`, () => {
it('should create objective in other quarter', () => {
overviewPage.addObjective()
.fillObjectiveTitle('Objective in quarter 3')
.selectQuarter('3')
Expand All @@ -272,7 +272,7 @@ describe('okr objective', () => {
cy.contains('Objective in quarter 3');
});

it(`should edit objective and move it to another quarter`, () => {
it('should edit objective and move it to another quarter', () => {
overviewPage.addObjective()
.fillObjectiveTitle('Move to another quarter on edit')
.submit();
Expand All @@ -296,7 +296,7 @@ describe('okr objective', () => {
});

describe('tests via keyboard', () => {
it(`should open objective aside via enter`, () => {
it('should open objective aside via enter', () => {
cy.getByTestId('objective')
.first()
.find('[tabindex]')
Expand Down
6 changes: 3 additions & 3 deletions frontend/cypress/e2e/team-management.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ describe('okr team-management', () => {
return true;
})
.then(() => {
expect(foundEsha).to.be.true;
expect(foundEsha).to.equal(true);
});
});

Expand Down Expand Up @@ -461,7 +461,7 @@ describe('okr team-management', () => {
.trim() !== 'Findus Peterson') {
return;
}
$row.find(`[data-testId='edit-role']`)
$row.find('[data-testId=\'edit-role\']')
.click();
cy.wait(500); // wait for dialog to open
})
Expand Down Expand Up @@ -495,7 +495,7 @@ describe('okr team-management', () => {

ConfirmDialog.do()
.checkTitle('Mitglied entfernen')
.checkDescription(`Möchtest du Findus Peterson wirklich aus dem Team '/BBT' entfernen?`)
.checkDescription('Möchtest du Findus Peterson wirklich aus dem Team \'/BBT\' entfernen?')
.submit();

cy.get('app-member-detail')
Expand Down
24 changes: 11 additions & 13 deletions frontend/cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,17 @@ Cypress.Commands.add('getByTestId', (testId: string, text?: string): Chainable =
}
});

Cypress.Commands.add('findByTestId',
{ prevSubject: true },
(subject: JQuery<HTMLElement>, testId: string, text?: string): Chainable => {
const selector = `[data-testId=${testId}]`;
if (text) {
return cy.wrap(subject)
.find(selector)
.contains(text);
} else {
return cy.wrap(subject)
.find(selector);
}
});
Cypress.Commands.add('findByTestId', { prevSubject: true }, (subject: JQuery<HTMLElement>, testId: string, text?: string): Chainable => {
const selector = `[data-testId=${testId}]`;
if (text) {
return cy.wrap(subject)
.find(selector)
.contains(text);
} else {
return cy.wrap(subject)
.find(selector);
}
});

Cypress.Commands.add('pressUntilContains', (text: string, key: keyof typeof keyCodeDefinitions) => {
pressUntilContains(text, key);
Expand Down
2 changes: 1 addition & 1 deletion frontend/cypress/support/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import './commands';
import { keyCodeDefinitions } from 'cypress-real-events/keyCodeDefinitions';

declare global {
namespace Cypress {
export namespace Cypress {
interface Chainable {
loginAsUser(user: any): Chainable;
getByTestId(testsId: string, text?: string): Chainable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default class ObjectiveDialog extends Dialog {

toggleCreateKeyResults() {
cy.getByTestId('keyResult-checkbox')
.find("[type='checkbox']")
.find('[type=\'checkbox\']')
.check();
return this;
}
Expand Down
4 changes: 3 additions & 1 deletion frontend/cypress/support/helper/dom-helper/filterHelper.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { PageObjectMapperBase } from './pageObjectMapperBase';

export default class FilterHelper extends PageObjectMapperBase {
validatePage(): void {}
validatePage(): void {
// Does not need to be implemented this comment is for making linter happy
}

optionShouldBeSelected(text: string, isOnOverview = true): this {
if (isOnOverview) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,9 @@ export default class CyOverviewPage extends Page {
return '';
}

validatePage(): void {}
validatePage(): void {
// Does not need to be implemented this comment is for making linter happy
}

protected doVisit(): void {
this.elements.logo()
Expand Down
Loading

0 comments on commit 1a1aed6

Please sign in to comment.