chore: add lint and format all files

This commit is contained in:
Markus
2026-08-06 16:08:35 +03:00
parent 9e7caa88e3
commit 738389cead
5 changed files with 87 additions and 93 deletions
+22 -22
View File
@@ -8,22 +8,22 @@ Registration, administration and review tool for University of Helsinki's softwa
## Table of Contents
* [Development](#development)
* [Local development](#local-development)
* [Test users](#test-users)
* [Accessing the database](#accessing-the-database)
* [Directly with psql](#directly-with-psql)
* [With the dbscript](#with-the-dbscript)
* [Writing and running tests locally](#writing-and-running-tests-locally)
* [Writing tests](#writing-tests)
* [If you're writing a frontend-only feature which works with the Docker image in DockerHub](#if-youre-writing-a-frontend-only-feature-which-works-with-the-docker-image-in-dockerhub)
* [If you're writing a feature that touches both the frontend and backend](#if-youre-writing-a-feature-that-touches-both-the-frontend-and-backend)
* [Running end-to-end tests](#running-end-to-end-tests)
* [CI, Docker](#ci-docker)
* [Available tags](#available-tags)
* [Deployment: staging and production](#deployment-staging-and-production)
* [Design compromises and things we didn't have time to fix](#design-compromises-and-things-we-didnt-have-time-to-fix)
* [Docker cheatsheet](#docker-cheatsheet)
- [Development](#development)
- [Local development](#local-development)
- [Test users](#test-users)
- [Accessing the database](#accessing-the-database)
- [Directly with psql](#directly-with-psql)
- [With the dbscript](#with-the-dbscript)
- [Writing and running tests locally](#writing-and-running-tests-locally)
- [Writing tests](#writing-tests)
- [If you're writing a frontend-only feature which works with the Docker image in DockerHub](#if-youre-writing-a-frontend-only-feature-which-works-with-the-docker-image-in-dockerhub)
- [If you're writing a feature that touches both the frontend and backend](#if-youre-writing-a-feature-that-touches-both-the-frontend-and-backend)
- [Running end-to-end tests](#running-end-to-end-tests)
- [CI, Docker](#ci-docker)
- [Available tags](#available-tags)
- [Deployment: staging and production](#deployment-staging-and-production)
- [Design compromises and things we didn't have time to fix](#design-compromises-and-things-we-didnt-have-time-to-fix)
- [Docker cheatsheet](#docker-cheatsheet)
## Development
@@ -67,7 +67,7 @@ Registration, administration and review tool for University of Helsinki's softwa
### Test users
| Username | Password |
|---------------|-----------------|
| ------------- | --------------- |
| testertester | testertester123 |
| testertester2 | testertester123 |
| testertester3 | testertester123 |
@@ -77,6 +77,7 @@ Registration, administration and review tool for University of Helsinki's softwa
#### Directly with psql
By default, the `docker-compose.sample.yml` file exposes the PostgreSQL 10.6 server on your localhost port 5432. You can directly connect to the database with the PostgreSQL client `psql`.
- MacOS: `brew install postgres`
- Linux: `sudo apt-get install postgresql-client`
- Windows: good luck
@@ -91,7 +92,7 @@ $ psql postgres://postgres@localhost:5432/dev_postgres
The name of the database (here `dev_postgres`) depends on backend's `NODE_ENV`. As to why it's `postgres`, see [_Design compromises and things we didn't have time to fix_](#design-compromises-and-things-we-didnt-have-time-to-fix).
| NODE_ENV | db created by `npm run db:recreate` |
|-------------|-------------------------------------|
| ----------- | ----------------------------------- |
| production | postgres |
| development | dev_postgres |
@@ -100,6 +101,7 @@ The name of the database (here `dev_postgres`) depends on backend's `NODE_ENV`.
The dbscript was originally written to compare the schema created by Sequelize to that created by the migrations. (diff files created by `drop-init-sequelize` and `drop-init-migrations`). However, it's also a handy tool to run SQL commands in the container. Note: the current version expects the db to be exposed on host port 5432.
Copy the `dbscript.sh` to the project root directory (same directory as `docker-compose.yml`), chmod +x it if not already, and run it. Make sure your current working directory is the same directory.
- ```
ohtuprojekti-ilmo/
├── ohtuilmo-backend/
@@ -187,6 +189,7 @@ Same instructions as above but you only start `db` with docker-compose.
The full E2E test suite can be run locally, but notice that it builds the frontend image from the frontend directory, meaning that you can't interactively edit your code and the tests.
Run:
- `npm run e2e:install`
- `npm run e2e:setup`
- `npm run e2e:run or npm run e2e:open`
@@ -226,6 +229,7 @@ Both services are behind a reverse proxy (nginx). It proxies `/projekti` to the
Assuming you've been given proper ssh access, you can deploy new images from DockerHub with the `deploy.sh` script found in the correct user's home directory.
`deploy.sh`:
```sh
#!/bin/bash
set -e
@@ -246,14 +250,10 @@ docker-compose run --entrypoint 'npm run db:migrate' backend
docker-compose up -d backend frontend
```
## Design compromises and things we didn't have time to fix
See [issues marked with tag `design-compromise`](https://github.com/ohtuprojekti-ilmo/ohtuilmo-frontend/issues?q=is%3Aissue+is%3Aopen+label%3Adesign-compromise).
## Docker cheatsheet
[Docker cheatsheet](https://github.com/jexniemi/Docker-cheat-page/wiki)
+3 -9
View File
@@ -1,17 +1,11 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="theme-color" content="#000000" />
<link rel="shortcut icon" href="/favicon.png" />
<link
href="https://fonts.googleapis.com/css?family=Roboto:300"
rel="stylesheet"
/>
<link href="https://fonts.googleapis.com/css?family=Roboto:300" rel="stylesheet" />
<title>Software engineering project</title>
<link rel="shortcut icon" type="image/png" href="/favicon.png" />
</head>
+15 -15
View File
@@ -3,6 +3,21 @@
"version": "0.1.0",
"private": true,
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"test-setup": "npm run test-setup:down && docker compose -f ../compose.local-test.yaml --profile local-e2e up -d",
"test-setup:down": "docker compose -f ../compose.local-test.yaml --profile local-e2e down",
"test:docker": "docker compose -f ../compose.local-test.yaml --profile e2e up --force-recreate --exit-code-from cypress",
"test:docker:down": "docker compose -f ../compose.local-test.yaml --profile e2e down",
"test": "CYPRESS_baseUrl=http://localhost:5000 npx cypress open",
"test:headless": "CYPRESS_VIDEO=false CYPRESS_baseUrl=http://localhost:5000 npx cypress run",
"lint": "oxlint",
"lint:fix": "oxlint --fix",
"format": "oxfmt",
"format:check": "oxfmt --check"
},
"dependencies": {
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.1",
@@ -23,21 +38,6 @@
"redux": "^5.0.1",
"redux-thunk": "^3.1.0"
},
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"test-setup": "npm run test-setup:down && docker compose -f ../compose.local-test.yaml --profile local-e2e up -d",
"test-setup:down": "docker compose -f ../compose.local-test.yaml --profile local-e2e down",
"test:docker": "docker compose -f ../compose.local-test.yaml --profile e2e up --force-recreate --exit-code-from cypress",
"test:docker:down": "docker compose -f ../compose.local-test.yaml --profile e2e down",
"test": "CYPRESS_baseUrl=http://localhost:5000 npx cypress open",
"test:headless": "CYPRESS_VIDEO=false CYPRESS_baseUrl=http://localhost:5000 npx cypress run",
"lint": "oxlint src/",
"lint:fix": "oxlint --fix src/",
"format": "oxfmt src/ e2e/",
"format:check": "oxfmt --check src/ e2e/"
},
"devDependencies": {
"@vitejs/plugin-react": "^4.7.0",
"@vitejs/plugin-react-refresh": "^1.3.6",
+1 -1
View File
@@ -9,7 +9,7 @@
"lint": "npm --prefix frontend run lint && npm --prefix backend run lint"
},
"lint-staged": {
"frontend/{src,e2e}/**/*.{js,jsx}": [
"frontend/**/*.{js,jsx}": [
"npm --prefix frontend run format:check",
"npm --prefix frontend run lint"
],