Skip to content

Commit fc4eff1

Browse files
committed
add linting.yml, run format all
1 parent bea979f commit fc4eff1

3 files changed

Lines changed: 73 additions & 32 deletions

File tree

.github/workflows/linting.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Lint and Format Check
2+
3+
on: [ push, pull_request ]
4+
5+
jobs:
6+
lint-and-format:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v4
10+
11+
- name: Run ruff check
12+
uses: astral-sh/ruff-action@v3
13+
with:
14+
args: "check"
15+
16+
- name: Run ruff format check
17+
uses: astral-sh/ruff-action@v3
18+
with:
19+
args: "format --check"
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: '20'
25+
cache: 'npm'
26+
cache-dependency-path: 'frontend/package-lock.json'
27+
28+
- name: Install frontend dependencies
29+
run: |
30+
cd frontend
31+
npm ci
32+
33+
- name: Run ESLint
34+
run: |
35+
cd frontend
36+
npm run lint
37+
38+
- name: Run Prettier check
39+
run: |
40+
cd frontend
41+
npm run format:check

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@ repos:
2525
rev: v4.0.0-alpha.8
2626
hooks:
2727
- id: prettier
28-
files: ^frontend/.*\.(js|jsx|ts|tsx|json|css|md)$
28+
files: \"\.(js|jsx|ts|tsx|json|css|md)\"$
2929
args: [ '--write' ]

frontend/eslint.config.js

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,59 @@
1-
import js from "@eslint/js";
2-
import typescript from "@typescript-eslint/eslint-plugin";
3-
import typescriptParser from "@typescript-eslint/parser";
4-
import prettier from "eslint-plugin-prettier";
5-
import prettierConfig from "eslint-config-prettier";
1+
import js from '@eslint/js';
2+
import typescript from '@typescript-eslint/eslint-plugin';
3+
import typescriptParser from '@typescript-eslint/parser';
4+
import prettier from 'eslint-plugin-prettier';
5+
import prettierConfig from 'eslint-config-prettier';
66

77
export default [
88
js.configs.recommended,
99
prettierConfig,
1010
{
11-
files: ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"],
11+
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
1212
languageOptions: {
1313
parser: typescriptParser,
1414
parserOptions: {
15-
ecmaVersion: "latest",
16-
sourceType: "module",
15+
ecmaVersion: 'latest',
16+
sourceType: 'module',
1717
ecmaFeatures: {
1818
jsx: true,
1919
},
2020
},
2121
globals: {
22-
console: "readonly",
23-
document: "readonly",
24-
window: "readonly",
25-
fetch: "readonly",
26-
FormData: "readonly",
27-
File: "readonly",
28-
setTimeout: "readonly",
29-
clearTimeout: "readonly",
30-
localStorage: "readonly",
31-
sessionStorage: "readonly",
32-
URL: "readonly",
33-
Blob: "readonly",
34-
FileReader: "readonly",
22+
console: 'readonly',
23+
document: 'readonly',
24+
window: 'readonly',
25+
fetch: 'readonly',
26+
FormData: 'readonly',
27+
File: 'readonly',
28+
setTimeout: 'readonly',
29+
clearTimeout: 'readonly',
30+
localStorage: 'readonly',
31+
sessionStorage: 'readonly',
32+
URL: 'readonly',
33+
Blob: 'readonly',
34+
FileReader: 'readonly',
3535
},
3636
},
3737
plugins: {
38-
"@typescript-eslint": typescript,
38+
'@typescript-eslint': typescript,
3939
prettier: prettier,
4040
},
4141
rules: {
42-
"prettier/prettier": "error",
43-
"@typescript-eslint/no-explicit-any": "warn",
44-
"@typescript-eslint/no-unused-vars": [
45-
"error",
42+
'prettier/prettier': 'error',
43+
'@typescript-eslint/no-explicit-any': 'warn',
44+
'@typescript-eslint/no-unused-vars': [
45+
'error',
4646
{
47-
argsIgnorePattern: "^_",
48-
varsIgnorePattern: "^_",
47+
argsIgnorePattern: '^_',
48+
varsIgnorePattern: '^_',
4949
},
5050
],
51-
"no-undef": "off",
52-
"no-unused-vars": "off",
51+
'no-undef': 'off',
52+
'no-unused-vars': 'off',
5353
},
5454
settings: {
5555
react: {
56-
version: "detect",
56+
version: 'detect',
5757
},
5858
},
5959
},

0 commit comments

Comments
 (0)