Skip to content

Commit 1085132

Browse files
authored
chore(ci): frontend eslint and prettier (#2293)
1 parent 37322f1 commit 1085132

File tree

13 files changed

+86
-69
lines changed

13 files changed

+86
-69
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,4 +364,7 @@ pyrightconfig.json
364364
.idea
365365
*.key
366366
*.pem
367-
*.pub
367+
*.pub
368+
369+
# IDE
370+
.codebuddy

frontend/.eslintrc.yml

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ parserOptions:
1717
jsx: true
1818
ecmaVersion: 12
1919
sourceType: module
20-
project: './frontend/tsconfig.json'
2120

2221
plugins:
2322
- 'react'
@@ -38,18 +37,20 @@ rules:
3837
'no-empty': ['error', { allowEmptyCatch: true }]
3938
'no-undef': 'off'
4039
'no-use-before-define': 'off'
41-
'no-restricted-imports': [
42-
'error',
43-
{
44-
paths: [
45-
{
46-
name: 'react',
47-
importNames: ['default'],
48-
message: "Please import from 'react/jsx-runtime' instead.",
49-
},
50-
],
51-
},
52-
]
40+
'no-restricted-imports':
41+
[
42+
'error',
43+
{
44+
paths:
45+
[
46+
{
47+
name: 'react',
48+
importNames: ['default'],
49+
message: "Please import from 'react/jsx-runtime' instead.",
50+
},
51+
],
52+
},
53+
]
5354

5455
# React rules
5556
'react/jsx-uses-react': 'off'
@@ -69,7 +70,5 @@ rules:
6970
'@typescript-eslint/no-use-before-define': ['error', { functions: false }]
7071
'@typescript-eslint/no-var-requires': 'off'
7172
'@typescript-eslint/explicit-function-return-type': 'off'
72-
'@typescript-eslint/consistent-type-imports': [
73-
'error',
74-
{ prefer: 'type-imports' },
75-
]
73+
'@typescript-eslint/consistent-type-imports':
74+
['error', { prefer: 'type-imports' }]

frontend/.prettierrc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ semi: false
1919
proseWrap: 'always'
2020

2121
# Format files with Unix-style line endings
22-
endOfLine: 'lf'
22+
endOfLine: 'lf'

frontend/e2e/pages/dashboard.ts

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
1-
import { expect } from '@playwright/test';
2-
import { baseURL } from '../utils';
3-
import { Page } from 'playwright';
1+
import { expect } from '@playwright/test'
2+
import { baseURL } from '../utils'
3+
import type { Page } from 'playwright'
44

55
export const dashboard_page = async (page: Page) => {
6-
await page.goto(baseURL);
7-
await expect(page.getByRole('link', { name: 'Government of British Columbia' })).toBeVisible();
6+
await page.goto(baseURL)
7+
await expect(
8+
page.getByRole('link', { name: 'Government of British Columbia' }),
9+
).toBeVisible()
810
await expect(page.getByText('QuickStart OpenShift')).toBeVisible()
9-
await expect(page.getByText('Employee ID')).toBeVisible();
10-
await expect(page.getByText('Employee Name')).toBeVisible();
11-
await expect(page.getByText('Employee Email')).toBeVisible();
12-
await expect(page.getByRole('link', { name: 'Home' })).toBeVisible();
13-
await expect(page.getByRole('link', { name: 'About gov.bc.ca' })).toBeVisible();
14-
await expect(page.getByRole('link', { name: 'Disclaimer' })).toBeVisible();
15-
await expect(page.getByRole('link', { name: 'Privacy' })).toBeVisible();
16-
await expect(page.getByRole('link', { name: 'Accessibility' })).toBeVisible();
17-
await expect(page.getByRole('link', { name: 'Copyright' })).toBeVisible();
18-
await expect(page.getByRole('link', { name: 'Contact us' })).toBeVisible();
19-
await page.getByPlaceholder('Search…').click();
20-
await page.getByPlaceholder('Search…').fill('john');
21-
await expect(page.locator('#root')).toContainText('1–1 of 1');
22-
};
11+
await expect(page.getByText('Employee ID')).toBeVisible()
12+
await expect(page.getByText('Employee Name')).toBeVisible()
13+
await expect(page.getByText('Employee Email')).toBeVisible()
14+
await expect(page.getByRole('link', { name: 'Home' })).toBeVisible()
15+
await expect(
16+
page.getByRole('link', { name: 'About gov.bc.ca' }),
17+
).toBeVisible()
18+
await expect(page.getByRole('link', { name: 'Disclaimer' })).toBeVisible()
19+
await expect(page.getByRole('link', { name: 'Privacy' })).toBeVisible()
20+
await expect(page.getByRole('link', { name: 'Accessibility' })).toBeVisible()
21+
await expect(page.getByRole('link', { name: 'Copyright' })).toBeVisible()
22+
await expect(page.getByRole('link', { name: 'Contact us' })).toBeVisible()
23+
await page.getByPlaceholder('Search…').click()
24+
await page.getByPlaceholder('Search…').fill('john')
25+
await expect(page.locator('#root')).toContainText('1–1 of 1')
26+
}

frontend/e2e/qsos.spec.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import { test } from '@playwright/test';
2-
import { dashboard_page } from './pages/dashboard';
1+
import { test } from '@playwright/test'
2+
import { dashboard_page } from './pages/dashboard'
33

44
test.describe.parallel('QSOS', () => {
55
test('Dashboard Page', async ({ page }) => {
6-
await dashboard_page(page);
7-
});
8-
9-
});
6+
await dashboard_page(page)
7+
})
8+
})

frontend/e2e/utils/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
export const baseURL = process.env.E2E_BASE_URL || 'https://quickstart-openshift-test-frontend.apps.silver.devops.gov.bc.ca/';
1+
export const baseURL =
2+
process.env.E2E_BASE_URL ||
3+
'https://quickstart-openshift-test-frontend.apps.silver.devops.gov.bc.ca/'

frontend/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
33
<head>
44
<meta charset="utf-8" />

frontend/playwright.config.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { defineConfig, devices } from '@playwright/test';
2-
import { baseURL } from './e2e/utils';
1+
import { defineConfig, devices } from '@playwright/test'
2+
import { baseURL } from './e2e/utils'
33

44
/**
55
* Read environment variables from file.
@@ -23,15 +23,15 @@ export default defineConfig({
2323
reporter: [
2424
['line'],
2525
['list', { printSteps: true }],
26-
['html', { open: 'always' }]
26+
['html', { open: 'always' }],
2727
],
2828
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
2929
use: {
3030
/* Base URL to use in actions like `await page.goto('/')`. */
3131
baseURL: baseURL,
3232

3333
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
34-
trace: 'on-first-retry'
34+
trace: 'on-first-retry',
3535
},
3636

3737
/* Configure projects for major browsers */
@@ -41,39 +41,39 @@ export default defineConfig({
4141
use: {
4242
...devices['Desktop Chrome'],
4343
baseURL: baseURL,
44-
}
44+
},
4545
},
4646
{
4747
name: 'Google Chrome',
4848
use: {
4949
...devices['Desktop Chrome'],
5050
channel: 'chrome',
51-
baseURL: baseURL
52-
}
51+
baseURL: baseURL,
52+
},
5353
},
5454

5555
{
5656
name: 'firefox',
5757
use: {
5858
...devices['Desktop Firefox'],
5959
baseURL: baseURL,
60-
}
60+
},
6161
},
6262

6363
{
6464
name: 'safari',
6565
use: {
6666
...devices['Desktop Safari'],
67-
baseURL: baseURL
68-
}
67+
baseURL: baseURL,
68+
},
6969
},
7070
{
7171
name: 'Microsoft Edge',
7272
use: {
7373
...devices['Desktop Edge'],
7474
channel: 'msedge',
75-
baseURL: baseURL
76-
}
77-
}
78-
]
79-
});
75+
baseURL: baseURL,
76+
},
77+
},
78+
],
79+
})

frontend/src/main.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import '@bcgov/bc-sans/css/BC_Sans.css'
2-
import * as React from 'react'
2+
import { StrictMode } from 'react'
33
import * as ReactDOM from 'react-dom/client'
44
import { ThemeProvider } from '@emotion/react'
55
import CssBaseline from '@mui/material/CssBaseline'
66
import theme from './theme'
77
import App from './App'
88

99
ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
10-
<React.StrictMode>
10+
<StrictMode>
1111
<ThemeProvider theme={theme}>
1212
<CssBaseline />
1313
<App />
1414
</ThemeProvider>
15-
</React.StrictMode>,
15+
</StrictMode>,
1616
)

frontend/src/theme.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { createTheme } from '@mui/material/styles'
2-
import { red } from '@mui/material/colors'
32

43
// A custom theme for this app
54
const theme = createTheme({

0 commit comments

Comments
 (0)