diff --git a/.github/workflows/ci-frontend.yml b/.github/workflows/ci-frontend.yml new file mode 100644 index 0000000..b92f98a --- /dev/null +++ b/.github/workflows/ci-frontend.yml @@ -0,0 +1,28 @@ +name: CI - Frontend + +on: + push: + branches: + - master + pull_request: + + concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + + jobs: + check: + name: Format, Lint, Types + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./frontend + steps: + - name: Check Format + run: pnpm format:check + + - name: Check Lint + run: pnpm lint + + - name: Check Types + run: pnpm types diff --git a/backend/package.json b/backend/package.json index d63b4e1..cca2c88 100644 --- a/backend/package.json +++ b/backend/package.json @@ -10,12 +10,13 @@ }, "scripts": { "build": "nest build", - "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"", + "format": "prettier -w \"src/**/*.ts\"", + "format:check": "prettier -c \"src/**/*.ts\"", "start": "nest start", "dev": "nest start --watch", "start:debug": "nest start --debug --watch", "start:prod": "pm2 restart dist/src/main.js", - "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix", + "lint": "eslint \"{src,apps,libs,test}/**/*.ts\"", "types": "tsc --noEmit", "test": "jest", "test:watch": "jest --watch", diff --git a/frontend/.eslintrc.js b/frontend/.eslintrc.js new file mode 100644 index 0000000..259de13 --- /dev/null +++ b/frontend/.eslintrc.js @@ -0,0 +1,25 @@ +module.exports = { + parser: '@typescript-eslint/parser', + parserOptions: { + project: 'tsconfig.json', + tsconfigRootDir: __dirname, + sourceType: 'module', + }, + plugins: ['@typescript-eslint/eslint-plugin'], + extends: [ + 'plugin:@typescript-eslint/recommended', + 'plugin:prettier/recommended', + ], + root: true, + env: { + node: true, + jest: true, + }, + ignorePatterns: ['.eslintrc.js'], + rules: { + '@typescript-eslint/interface-name-prefix': 'off', + '@typescript-eslint/explicit-function-return-type': 'off', + '@typescript-eslint/explicit-module-boundary-types': 'off', + '@typescript-eslint/no-explicit-any': 'off', + }, +}; diff --git a/frontend/.prettierrc b/frontend/.prettierrc new file mode 100644 index 0000000..dcb7279 --- /dev/null +++ b/frontend/.prettierrc @@ -0,0 +1,4 @@ +{ + "singleQuote": true, + "trailingComma": "all" +} \ No newline at end of file diff --git a/frontend/package.json b/frontend/package.json index f221b36..fa2d1a6 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -10,7 +10,10 @@ "android": "expo run:android", "ios": "expo run:ios", "web": "expo start --web", - "types": "pnpm tsc" + "types": "pnpm tsc", + "format": "prettier -w \"src/**/*.ts\"", + "format:check": "prettier -c \"src/**/*.ts\"", + "lint": "eslint \"{src,apps,libs,test}/**/*.ts\"" }, "dependencies": { "@expo/metro-runtime": "~3.2.1", @@ -51,6 +54,8 @@ "@types/jest": "^29.5.12", "@types/react": "18.2.79", "@types/react-test-renderer": "^18.3.0", + "eslint": "^9.5.0", + "prettier": "^3.3.2", "tailwindcss": "3.3.2", "typescript": "5.3.3" }, diff --git a/frontend/pnpm-lock.yaml b/frontend/pnpm-lock.yaml index c3fabaf..7d7f1d8 100644 --- a/frontend/pnpm-lock.yaml +++ b/frontend/pnpm-lock.yaml @@ -115,6 +115,12 @@ devDependencies: '@types/react-test-renderer': specifier: ^18.3.0 version: 18.3.0 + eslint: + specifier: ^9.5.0 + version: 9.5.0 + prettier: + specifier: ^3.3.2 + version: 3.3.2 tailwindcss: specifier: 3.3.2 version: 3.3.2 @@ -6862,6 +6868,12 @@ packages: engines: {node: '>= 0.8.0'} dev: true + /prettier@3.3.2: + resolution: {integrity: sha512-rAVeHYMcv8ATV5d508CFdn+8/pHPpXeIid1DdrPwXnaAdH7cqjVbpJaT5eq4yRAFU/lsbwYwSF/n5iNrdJHPQA==} + engines: {node: '>=14'} + hasBin: true + dev: true + /pretty-bytes@5.6.0: resolution: {integrity: sha512-FFw039TmrBqFK8ma/7OL3sDz/VytdtJr044/QUJtH0wK9lb9jLq9tJyIxUwtQJHwar2BqtiA4iCWSwo9JLkzFg==} engines: {node: '>=6'}