Skip to content

Commit cb30487

Browse files
committed
add format check, update prettier rules, apply rules consistently
1 parent b116727 commit cb30487

File tree

323 files changed

+3729
-5580
lines changed

Some content is hidden

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

323 files changed

+3729
-5580
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: NPM Format Check
2+
3+
on: [push]
4+
5+
jobs:
6+
format-check:
7+
runs-on: ubuntu-latest
8+
timeout-minutes: 10
9+
10+
steps:
11+
- name: "Checkout code"
12+
uses: actions/checkout@v4
13+
14+
- name: "Use Node.js"
15+
uses: actions/setup-node@v4
16+
with:
17+
node-version: '20.x'
18+
19+
- name: "Install npm dependencies"
20+
run: npm ci
21+
22+
- name: "Check code formatting"
23+
run: npm run format:check

.prettierignore

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Ignore build outputs
2+
node_modules/
3+
vendor/
4+
storage/
5+
bootstrap/cache/
6+
public/build/
7+
public/hot/
8+
9+
# Ignore lock files
10+
package-lock.json
11+
composer.lock
12+
13+
# Ignore generated files
14+
*.min.js
15+
*.min.css
16+
17+
# Ignore test results
18+
test-results/
19+
playwright-report/
20+
21+
# Ignore IDE files
22+
.idea/
23+
.vscode/
24+
25+
# Ignore OS files
26+
.DS_Store
27+
Thumbs.db

.prettierrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
"tabWidth": 4,
44
"singleQuote": true,
55
"bracketSameLine": true,
6-
"quoteProps": "preserve"
6+
"quoteProps": "preserve",
7+
"printWidth": 100
78
}

e2e/clients.spec.ts

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,8 @@ async function goToProjectsOverview(page: Page) {
77
}
88

99
// Create new project via modal
10-
test('test that creating and deleting a new client via the modal works', async ({
11-
page,
12-
}) => {
13-
const newClientName =
14-
'New Project ' + Math.floor(1 + Math.random() * 10000);
10+
test('test that creating and deleting a new client via the modal works', async ({ page }) => {
11+
const newClientName = 'New Project ' + Math.floor(1 + Math.random() * 10000);
1512
await goToProjectsOverview(page);
1613
await page.getByRole('button', { name: 'Create Client' }).click();
1714
await page.getByPlaceholder('Client Name').fill(newClientName);
@@ -28,13 +25,9 @@ test('test that creating and deleting a new client via the modal works', async (
2825
]);
2926

3027
await expect(page.getByTestId('client_table')).toContainText(newClientName);
31-
const moreButton = page.locator(
32-
"[aria-label='Actions for Client " + newClientName + "']"
33-
);
28+
const moreButton = page.locator("[aria-label='Actions for Client " + newClientName + "']");
3429
moreButton.click();
35-
const deleteButton = page.locator(
36-
"[aria-label='Delete Client " + newClientName + "']"
37-
);
30+
const deleteButton = page.locator("[aria-label='Delete Client " + newClientName + "']");
3831

3932
await Promise.all([
4033
deleteButton.click(),
@@ -45,9 +38,7 @@ test('test that creating and deleting a new client via the modal works', async (
4538
response.status() === 204
4639
),
4740
]);
48-
await expect(page.getByTestId('client_table')).not.toContainText(
49-
newClientName
50-
);
41+
await expect(page.getByTestId('client_table')).not.toContainText(newClientName);
5142
});
5243

5344
test('test that archiving and unarchiving clients works', async ({ page }) => {

e2e/members.spec.ts

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,8 @@ test('test that new manager can be invited', async ({ page }) => {
2222
await page.getByLabel('Email').fill(`new+${editorId}@editor.test`);
2323
await page.getByRole('button', { name: 'Manager' }).click();
2424
await Promise.all([
25-
page
26-
.getByRole('button', { name: 'Invite Member', exact: true })
27-
.click(),
28-
expect(page.getByRole('main')).toContainText(
29-
`new+${editorId}@editor.test`
30-
),
25+
page.getByRole('button', { name: 'Invite Member', exact: true }).click(),
26+
expect(page.getByRole('main')).toContainText(`new+${editorId}@editor.test`),
3127
]);
3228
});
3329

@@ -38,12 +34,8 @@ test('test that new employee can be invited', async ({ page }) => {
3834
await page.getByLabel('Email').fill(`new+${editorId}@editor.test`);
3935
await page.getByRole('button', { name: 'Employee' }).click();
4036
await Promise.all([
41-
page
42-
.getByRole('button', { name: 'Invite Member', exact: true })
43-
.click(),
44-
await expect(page.getByRole('main')).toContainText(
45-
`new+${editorId}@editor.test`
46-
),
37+
page.getByRole('button', { name: 'Invite Member', exact: true }).click(),
38+
await expect(page.getByRole('main')).toContainText(`new+${editorId}@editor.test`),
4739
]);
4840
});
4941

@@ -54,12 +46,8 @@ test('test that new admin can be invited', async ({ page }) => {
5446
await page.getByLabel('Email').fill(`new+${adminId}@admin.test`);
5547
await page.getByRole('button', { name: 'Administrator' }).click();
5648
await Promise.all([
57-
page
58-
.getByRole('button', { name: 'Invite Member', exact: true })
59-
.click(),
60-
expect(page.getByRole('main')).toContainText(
61-
`new+${adminId}@admin.test`
62-
),
49+
page.getByRole('button', { name: 'Invite Member', exact: true }).click(),
50+
expect(page.getByRole('main')).toContainText(`new+${adminId}@admin.test`),
6351
]);
6452
});
6553
test('test that error shows if no role is selected', async ({ page }) => {
@@ -69,9 +57,7 @@ test('test that error shows if no role is selected', async ({ page }) => {
6957

7058
await page.getByLabel('Email').fill(`new+${noRoleId}@norole.test`);
7159
await Promise.all([
72-
page
73-
.getByRole('button', { name: 'Invite Member', exact: true })
74-
.click(),
60+
page.getByRole('button', { name: 'Invite Member', exact: true }).click(),
7561
expect(page.getByText('Please select a role')).toBeVisible(),
7662
]);
7763
});
@@ -85,9 +71,7 @@ test('test that organization billable rate can be updated with all existing time
8571
await page.getByRole('menuitem').getByText('Edit').click();
8672
await page.getByText('Organization Default Rate').click();
8773
await page.getByText('Custom Rate').click();
88-
await page
89-
.getByPlaceholder('Billable Rate')
90-
.fill(newBillableRate.toString());
74+
await page.getByPlaceholder('Billable Rate').fill(newBillableRate.toString());
9175
await page.getByRole('button', { name: 'Update Member' }).click();
9276

9377
await Promise.all([
@@ -103,8 +87,7 @@ test('test that organization billable rate can be updated with all existing time
10387
response.url().includes('/organizations/') &&
10488
response.request().method() === 'PUT' &&
10589
response.status() === 200 &&
106-
(await response.json()).data.billable_rate ===
107-
newBillableRate * 100
90+
(await response.json()).data.billable_rate === newBillableRate * 100
10891
),
10992
]);
11093
});

e2e/organization.spec.ts

Lines changed: 16 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ test('test that organization name can be updated', async ({ page }) => {
3535
await page.getByLabel('Organization Name').fill('NEW ORG NAME');
3636
await page.getByLabel('Organization Name').press('Enter');
3737
await page.getByLabel('Organization Name').press('Meta+r');
38-
await expect(
39-
page.locator('[data-testid="organization_switcher"]:visible')
40-
).toContainText('NEW ORG NAME');
38+
await expect(page.locator('[data-testid="organization_switcher"]:visible')).toContainText(
39+
'NEW ORG NAME'
40+
);
4141
});
4242

4343
test('test that organization billable rate can be updated with all existing time entries', async ({
@@ -46,19 +46,15 @@ test('test that organization billable rate can be updated with all existing time
4646
await goToOrganizationSettings(page);
4747
const newBillableRate = Math.round(Math.random() * 10000);
4848
await page.getByLabel('Organization Billable Rate').click();
49-
await page
50-
.getByLabel('Organization Billable Rate')
51-
.fill(newBillableRate.toString());
49+
await page.getByLabel('Organization Billable Rate').fill(newBillableRate.toString());
5250
await page
5351
.locator('form')
5452
.filter({ hasText: 'Organization Billable' })
5553
.getByRole('button', { name: 'Save' })
5654
.click();
5755

5856
await Promise.all([
59-
page
60-
.getByRole('button', { name: 'Yes, update existing time entries' })
61-
.click(),
57+
page.getByRole('button', { name: 'Yes, update existing time entries' }).click(),
6258
page.waitForRequest(
6359
async (request) =>
6460
request.url().includes('/organizations/') &&
@@ -70,15 +66,12 @@ test('test that organization billable rate can be updated with all existing time
7066
response.url().includes('/organizations/') &&
7167
response.request().method() === 'PUT' &&
7268
response.status() === 200 &&
73-
(await response.json()).data.billable_rate ===
74-
newBillableRate * 100
69+
(await response.json()).data.billable_rate === newBillableRate * 100
7570
),
7671
]);
7772
});
7873

79-
test('test that organization format settings can be updated', async ({
80-
page,
81-
}) => {
74+
test('test that organization format settings can be updated', async ({ page }) => {
8275
await goToOrganizationSettings(page);
8376

8477
// Test number format
@@ -113,8 +106,7 @@ test('test that organization format settings can be updated', async ({
113106
response.url().includes('/organizations/') &&
114107
response.request().method() === 'PUT' &&
115108
response.status() === 200 &&
116-
(await response.json()).data.currency_format ===
117-
'iso-code-after-with-space'
109+
(await response.json()).data.currency_format === 'iso-code-after-with-space'
118110
),
119111
]);
120112

@@ -132,8 +124,7 @@ test('test that organization format settings can be updated', async ({
132124
response.url().includes('/organizations/') &&
133125
response.request().method() === 'PUT' &&
134126
response.status() === 200 &&
135-
(await response.json()).data.date_format ===
136-
'slash-separated-dd-mm-yyyy'
127+
(await response.json()).data.date_format === 'slash-separated-dd-mm-yyyy'
137128
),
138129
]);
139130

@@ -169,19 +160,14 @@ test('test that organization format settings can be updated', async ({
169160
response.url().includes('/organizations/') &&
170161
response.request().method() === 'PUT' &&
171162
response.status() === 200 &&
172-
(await response.json()).data.interval_format ===
173-
'hours-minutes-colon-separated'
163+
(await response.json()).data.interval_format === 'hours-minutes-colon-separated'
174164
),
175165
]);
176166
});
177167

178-
test('test that format settings are reflected in the dashboard', async ({
179-
page,
180-
}) => {
168+
test('test that format settings are reflected in the dashboard', async ({ page }) => {
181169
// check that 0h 00min is displayed
182-
await expect(
183-
page.getByText('0h 00min', { exact: true }).nth(0)
184-
).toBeVisible();
170+
await expect(page.getByText('0h 00min', { exact: true }).nth(0)).toBeVisible();
185171

186172
// First set the format settings
187173
await goToOrganizationSettings(page);
@@ -213,10 +199,8 @@ test('test that format settings are reflected in the dashboard', async ({
213199
response.url().includes('/organizations/') &&
214200
response.request().method() === 'PUT' &&
215201
response.status() === 200 &&
216-
(await response.json()).data.interval_format ===
217-
'hours-minutes-colon-separated' &&
218-
(await response.json()).data.currency_format ===
219-
'symbol-after' &&
202+
(await response.json()).data.interval_format === 'hours-minutes-colon-separated' &&
203+
(await response.json()).data.currency_format === 'symbol-after' &&
220204
(await response.json()).data.number_format === 'comma-point'
221205
),
222206
]);
@@ -232,16 +216,12 @@ test('test that format settings are reflected in the dashboard', async ({
232216
// check that 00:00 is displayed
233217
await expect(page.getByText('0:00', { exact: true }).nth(0)).toBeVisible();
234218
// check that 0h 00min is not displayed
235-
await expect(
236-
page.getByText('0h 00min', { exact: true }).nth(0)
237-
).not.toBeVisible();
219+
await expect(page.getByText('0h 00min', { exact: true }).nth(0)).not.toBeVisible();
238220

239221
// check that the current date is displayed in the dd/mm/yyyy format on the time page
240222
await page.goto(PLAYWRIGHT_BASE_URL + '/time');
241223
await expect(
242-
page
243-
.getByText(new Date().toLocaleDateString('en-GB'), { exact: true })
244-
.nth(0)
224+
page.getByText(new Date().toLocaleDateString('en-GB'), { exact: true }).nth(0)
245225
).toBeVisible();
246226
});
247227

0 commit comments

Comments
 (0)