From bef8c01c89ec3338827315d15bafc43f5e981fb4 Mon Sep 17 00:00:00 2001 From: elijahbenizzy Date: Tue, 20 Feb 2024 17:28:11 -0800 Subject: [PATCH] Adds github action to build/lint --- .github/workflows/ui.yml | 32 +++++++++++++++++++ telemetry/ui/.eslintrc.js | 2 +- telemetry/ui/package.json | 5 ++- telemetry/ui/scripts/client-gen.sh | 1 + telemetry/ui/src/components/common/chip.tsx | 3 +- telemetry/ui/src/components/common/switch.tsx | 3 +- telemetry/ui/src/components/common/table.tsx | 18 ++++------- telemetry/ui/src/components/common/tabs.tsx | 6 ++-- .../ui/src/components/nav/appcontainer.tsx | 24 +++++--------- .../ui/src/components/nav/breadcrumb.tsx | 6 ++-- .../src/components/routes/app/ActionView.tsx | 3 +- .../src/components/routes/app/GraphView.tsx | 6 ++-- .../ui/src/components/routes/app/StepList.tsx | 3 +- 13 files changed, 60 insertions(+), 52 deletions(-) diff --git a/.github/workflows/ui.yml b/.github/workflows/ui.yml index e69de29b..6e8ed1a4 100644 --- a/.github/workflows/ui.yml +++ b/.github/workflows/ui.yml @@ -0,0 +1,32 @@ +name: Node.js CI + +on: + push: + branches: + - main + paths: + - 'telemetry/ui/**' + pull_request: + types: [opened, synchronize, reopened] + paths: + - 'telemetry/ui/**' + +jobs: + build: + runs-on: ubuntu-latest + defaults: + run: + working-directory: telemetry/ui + strategy: + matrix: + node-version: [16.x] + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: npm install --ignore-scripts + - run: npm run build + - run: npm run lint:fix + - run: npm run format:fix diff --git a/telemetry/ui/.eslintrc.js b/telemetry/ui/.eslintrc.js index 82c1bff0..f567da13 100644 --- a/telemetry/ui/.eslintrc.js +++ b/telemetry/ui/.eslintrc.js @@ -18,7 +18,7 @@ module.exports = { plugins: ['react', '@typescript-eslint', 'react-hooks'], rules: { 'react-hooks/rules-of-hooks': 'error', // Checks rules of Hooks - 'react-hooks/exhaustive-deps': 'warn', // Checks effect dependencies + 'react-hooks/exhaustive-deps': 'off', // Checks effect dependencies 'react/react-in-jsx-scope': 'off', '@typescript-eslint/ban-ts-comment': 'off', 'react/prop-types': 'off' //Appears to be busted: see https://stackoverflow.com/questions/38684925/react-eslint-error-missing-in-props-validation diff --git a/telemetry/ui/package.json b/telemetry/ui/package.json index 58acb849..228dc1b7 100644 --- a/telemetry/ui/package.json +++ b/telemetry/ui/package.json @@ -35,9 +35,8 @@ "test": "react-scripts test", "eject": "react-scripts eject", "lint": "eslint .", - "lint:fix": "eslint . --fix --max-warnings=0 --config ./.eslintrc.js", - "format": "prettier --write ./**/*.{ts,tsx,css,md,json} --config ./.prettierrc.json", - "prepare": "husky install", + "lint:fix": "eslint . --fix --max-warnings=0 --config ./.eslintrc.js --ignore-path ./.eslintignore", + "format:fix": "prettier --write ./**/*.{ts,tsx,css,md,json} --config ./.prettierrc.json --ignore-path ./.prettierignore", "precommit": "npm run lint:fix && npm run format", "prepush": "npm run lint" }, diff --git a/telemetry/ui/scripts/client-gen.sh b/telemetry/ui/scripts/client-gen.sh index ad69c99e..c5252a2b 100755 --- a/telemetry/ui/scripts/client-gen.sh +++ b/telemetry/ui/scripts/client-gen.sh @@ -1,3 +1,4 @@ # run this from the ui/ directory # ensure your server is running on port 7241 (or change the port below) +# TODO -- move to a package.json script npx openapi-typescript-codegen --input http://localhost:7241/openapi.json --output ./src/api diff --git a/telemetry/ui/src/components/common/chip.tsx b/telemetry/ui/src/components/common/chip.tsx index 3c2b85b5..e9672562 100644 --- a/telemetry/ui/src/components/common/chip.tsx +++ b/telemetry/ui/src/components/common/chip.tsx @@ -23,8 +23,7 @@ export const Chip = (props: { label: string; chipType: ChipType; className?: str className={`relative grid select-none items-center whitespace-nowrap rounded-lg p-1 px-3 font-sans text-xs font-semibold text-white ${bgColor} ${ props.className ? props.className : '' - }`} - > + }`}> {props.label} ); diff --git a/telemetry/ui/src/components/common/switch.tsx b/telemetry/ui/src/components/common/switch.tsx index 3d85c8bd..4d90db2a 100644 --- a/telemetry/ui/src/components/common/switch.tsx +++ b/telemetry/ui/src/components/common/switch.tsx @@ -195,8 +195,7 @@ export function Switch({ // Color specific styles colors[color] )} - {...props} - > + {...props}>