diff --git a/.github/workflows/check_js.yml b/.github/workflows/check_js.yml new file mode 100644 index 00000000..91f110cf --- /dev/null +++ b/.github/workflows/check_js.yml @@ -0,0 +1,46 @@ +name: Check JS Code + +on: + push: + branches: [ main ] + paths: + - 'ui/**' + pull_request: + branches: [ main ] + paths: + - 'ui/**' + workflow_dispatch: {} + +jobs: + build: + name: Check JS Code + timeout-minutes: 30 + + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v4 + + - name: Set Up Node 20 + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install Dependencies + working-directory: ui + run: npm install + + - name: Check Formatting (prettier) + working-directory: ui + run: npm run fcheck + if: success() || failure() + + - name: Lint (eslint) + working-directory: ui + run: npm run lint + if: success() || failure() + + - name: Run Build (vite) + working-directory: ui + run: npm run build + if: success() || failure() diff --git a/ui/.eslintignore b/ui/.eslintignore new file mode 100644 index 00000000..06c5e168 --- /dev/null +++ b/ui/.eslintignore @@ -0,0 +1 @@ +dist/** diff --git a/ui/.eslintrc.cjs b/ui/.eslintrc.cjs new file mode 100644 index 00000000..af8287b9 --- /dev/null +++ b/ui/.eslintrc.cjs @@ -0,0 +1,29 @@ +module.exports = { + env: { + browser: true, + es2021: true, + }, + extends: ["eslint:recommended", "plugin:react/recommended"], + overrides: [ + { + env: { + node: true, + }, + files: [".eslintrc.{js,cjs}"], + parserOptions: { + sourceType: "script", + }, + }, + ], + parserOptions: { + ecmaVersion: "latest", + sourceType: "module", + }, + plugins: ["react"], + rules: {}, + settings: { + react: { + version: "detect", + }, + }, +}; diff --git a/ui/.prettierignore b/ui/.prettierignore new file mode 100644 index 00000000..4976eee1 --- /dev/null +++ b/ui/.prettierignore @@ -0,0 +1,3 @@ +dist +node_modules +__pycache__ diff --git a/ui/package-lock.json b/ui/package-lock.json index 3598911e..55ff66bf 100644 --- a/ui/package-lock.json +++ b/ui/package-lock.json @@ -19,7 +19,7 @@ "@types/react-dom": "^18.2.19", "@vitejs/plugin-react": "^4.2.1", "eslint": "^8.56.0", - "eslint-plugin-react": "^7.33.2", + "eslint-plugin-react": "^7.34.0", "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-refresh": "^0.4.5", "prettier": "3.2.5", diff --git a/ui/package.json b/ui/package.json index 7190c9aa..0b8f710e 100644 --- a/ui/package.json +++ b/ui/package.json @@ -6,9 +6,12 @@ "scripts": { "dev": "vite", "build": "vite build", - "lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0", + "lint": "eslint .", "preview": "vite preview", - "watch": "vite build --watch" + "watch": "vite build --watch", + "format": "prettier --write .", + "check": "prettier --check . ; eslint .", + "fcheck": "prettier --check ." }, "dependencies": { "axios": "^1.6.7", @@ -22,7 +25,7 @@ "@types/react-dom": "^18.2.19", "@vitejs/plugin-react": "^4.2.1", "eslint": "^8.56.0", - "eslint-plugin-react": "^7.33.2", + "eslint-plugin-react": "^7.34.0", "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-refresh": "^0.4.5", "prettier": "3.2.5", diff --git a/ui/src/components/PerfView.jsx b/ui/src/components/PerfView.jsx index 7d0c102a..2cc7ac3f 100644 --- a/ui/src/components/PerfView.jsx +++ b/ui/src/components/PerfView.jsx @@ -36,7 +36,7 @@ function PerfView({ metricsData }) { yLabel="p90 Latency (s)" /> -
+

Transaction Latency

W
; }