From 340bcf1d1b4062455ffd48dda14ea908ced574d7 Mon Sep 17 00:00:00 2001 From: Tymoteusz Czech <2625371+Tymek@users.noreply.github.com> Date: Mon, 2 Jan 2023 10:46:32 +0100 Subject: [PATCH] fix: add frontend eslint check (#2562) Add eslint to CI pipeline --- .github/workflows/build_frontend_prs.yml | 1 + frontend/package.json | 3 ++- .../component/changeRequest/ChangeRequestPermissions.test.tsx | 3 ++- frontend/src/component/common/MessageBanner/MessageBanner.tsx | 4 ++-- scripts/check-release.sh | 4 +++- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build_frontend_prs.yml b/.github/workflows/build_frontend_prs.yml index f0948a8154..acbd498707 100644 --- a/.github/workflows/build_frontend_prs.yml +++ b/.github/workflows/build_frontend_prs.yml @@ -23,4 +23,5 @@ jobs: - run: yarn --frozen-lockfile - run: yarn run test - run: yarn run fmt:check + - run: yarn run lint:check - run: yarn run ts:check # TODO: optimize diff --git a/frontend/package.json b/frontend/package.json index 8c791ac226..31383dc88e 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -11,7 +11,6 @@ }, "scripts": { "build": "vite build", - "lint": "yarn fmt:check", "start": "vite", "start:prod": "vite build && vite preview", "start:sandbox": "UNLEASH_API=https://sandbox.getunleash.io/ospro yarn run start", @@ -20,6 +19,8 @@ "test": "tsc && vitest run", "test:snapshot": "yarn test -u", "test:watch": "vitest watch", + "lint": "eslint --fix ./src", + "lint:check": "eslint ./src", "fmt": "prettier src --write --loglevel warn", "fmt:check": "prettier src --check", "ts:check": "tsc", diff --git a/frontend/src/component/changeRequest/ChangeRequestPermissions.test.tsx b/frontend/src/component/changeRequest/ChangeRequestPermissions.test.tsx index 50f57ab0b8..002d4784a9 100644 --- a/frontend/src/component/changeRequest/ChangeRequestPermissions.test.tsx +++ b/frontend/src/component/changeRequest/ChangeRequestPermissions.test.tsx @@ -188,7 +188,8 @@ const deleteButtonsActiveInChangeRequestEnv = async () => { // production const productionStrategyDeleteButton = deleteButtons[0]; expect(productionStrategyDeleteButton).not.toBeDisabled(); - + }); + await waitFor(() => { // custom env const customEnvStrategyDeleteButton = deleteButtons[1]; expect(customEnvStrategyDeleteButton).toBeDisabled(); diff --git a/frontend/src/component/common/MessageBanner/MessageBanner.tsx b/frontend/src/component/common/MessageBanner/MessageBanner.tsx index d4763dc9a7..97070a58d4 100644 --- a/frontend/src/component/common/MessageBanner/MessageBanner.tsx +++ b/frontend/src/component/common/MessageBanner/MessageBanner.tsx @@ -161,11 +161,11 @@ const BannerButton = ({ openDialog, children, }: IBannerButtonProps) => { - if (!link) return null; - const navigate = useNavigate(); const tracker = usePlausibleTracker(); + if (!link) return null; + const dialog = link === 'dialog'; const internal = !link.startsWith('http'); diff --git a/scripts/check-release.sh b/scripts/check-release.sh index 87915c012a..e2bd75c3e7 100755 --- a/scripts/check-release.sh +++ b/scripts/check-release.sh @@ -7,5 +7,7 @@ yarn run lint yarn run test cd frontend -yarn run lint +yarn run ts:check +yarn run lint:check +yarn run fmt:check yarn run test