Skip to content

Commit 2e71e52

Browse files
committed
Add linter and formatter
1 parent 013140b commit 2e71e52

23 files changed

+1145
-629
lines changed

.github/workflows/backend-format.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Backend Format
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
9+
10+
jobs:
11+
format:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v3
17+
18+
- name: Setup Python
19+
uses: actions/setup-python
20+
with:
21+
python-version: '3.12'
22+
23+
- name: Install pipenv
24+
run: |
25+
pip install --upgrade pip
26+
pip install pipenv
27+
28+
- name: Install dependencies
29+
run: pipenv sync --dev
30+
31+
- name: Format
32+
run: pipenv run format-ci

.github/workflows/backend-lint.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Backend Lint
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
9+
10+
jobs:
11+
lint:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v3
17+
18+
- name: Setup Python
19+
uses: actions/setup-python
20+
with:
21+
python-version: '3.12'
22+
23+
- name: Install pipenv
24+
run: |
25+
pip install --upgrade pip
26+
pip install pipenv
27+
28+
- name: Install dependencies
29+
run: pipenv sync --dev
30+
31+
- name: Lint
32+
run: pipenv run lint-ci

.github/workflows/docker-publish.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
name: Docker
22

3-
# This workflow uses actions that are not certified by GitHub.
4-
# They are provided by a third-party and are governed by
5-
# separate terms of service, privacy policy, and support
6-
# documentation.
7-
83
on:
94
schedule:
105
- cron: '44 0 * * *'

.github/workflows/frontend-format.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Frontend Format
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
9+
10+
jobs:
11+
format:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v3
17+
18+
- name: Setup Node.js
19+
uses: actions/setup-node
20+
with:
21+
node-version: '20'
22+
23+
- name: Install dependencies
24+
run: npm ci --include=dev
25+
26+
- name: Format
27+
run: npm run format-ci

.github/workflows/frontend-lint.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Frontend Lint
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
9+
10+
jobs:
11+
lint:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v3
17+
18+
- name: Setup Node.js
19+
uses: actions/setup-node
20+
with:
21+
node-version: '20'
22+
23+
- name: Install dependencies
24+
run: npm ci --include=dev
25+
26+
- name: Lint
27+
run: npm run lint-ci

Pipfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,7 @@ python_version = "3.12"
1919

2020
[scripts]
2121
lint = "ruff check . --fix"
22+
lint-ci = "ruff check ."
2223
format = "ruff format ."
24+
format-ci = "ruff format . --check"
2325
sort = "ssort ."

frontend/.eslintrc.cjs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@ module.exports = {
22
root: true,
33
env: { browser: true, es2020: true },
44
extends: [
5-
'eslint:recommended',
6-
'plugin:@typescript-eslint/recommended',
7-
'plugin:react-hooks/recommended',
5+
"eslint:recommended",
6+
"plugin:@typescript-eslint/recommended",
7+
"plugin:react-hooks/recommended",
88
],
9-
ignorePatterns: ['dist', '.eslintrc.cjs'],
10-
parser: '@typescript-eslint/parser',
11-
plugins: ['react-refresh'],
9+
ignorePatterns: ["dist", ".eslintrc.cjs"],
10+
parser: "@typescript-eslint/parser",
11+
plugins: ["react-refresh"],
1212
rules: {
13-
'react-refresh/only-export-components': [
14-
'warn',
13+
"react-refresh/only-export-components": [
14+
"warn",
1515
{ allowConstantExport: true },
1616
],
1717
},
18-
}
18+
};

frontend/.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/dist

frontend/.prettierrc.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"tabWidth": 2,
3+
"importOrder": ["<THIRD_PARTY_MODULES>", "^[./]"],
4+
"importOrderSeparation": true,
5+
"importOrderSortSpecifiers": true,
6+
"plugins": ["@trivago/prettier-plugin-sort-imports"]
7+
}

frontend/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ If you are developing a production application, we recommend updating the config
1717
export default {
1818
// other rules...
1919
parserOptions: {
20-
ecmaVersion: 'latest',
21-
sourceType: 'module',
22-
project: ['./tsconfig.json', './tsconfig.node.json'],
20+
ecmaVersion: "latest",
21+
sourceType: "module",
22+
project: ["./tsconfig.json", "./tsconfig.node.json"],
2323
tsconfigRootDir: __dirname,
2424
},
25-
}
25+
};
2626
```
2727

2828
- Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked`

0 commit comments

Comments
 (0)