diff --git a/.github/workflows/react-no-warnings.yml b/.github/workflows/react-no-warnings.yml new file mode 100644 index 000000000..55c096563 --- /dev/null +++ b/.github/workflows/react-no-warnings.yml @@ -0,0 +1,17 @@ +name: "React Code Has No Warnings" +on: + push: + pull_request: +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install modules + working-directory: ./portal-ui + run: yarn + - name: Check for Warnings in build output + working-directory: ./portal-ui + continue-on-error: false + run: | + chmod +x check-warnings.sh && ./check-warnings.sh diff --git a/portal-ui/Makefile b/portal-ui/Makefile index d90cf2ff1..25f5685f4 100644 --- a/portal-ui/Makefile +++ b/portal-ui/Makefile @@ -4,3 +4,5 @@ build-static: @echo "Building frontend static assets to 'build'" NODE_OPTIONS=--openssl-legacy-provider yarn build +test-warnings: + ./check-warnings.sh diff --git a/portal-ui/check-warnings.sh b/portal-ui/check-warnings.sh new file mode 100755 index 000000000..376820d42 --- /dev/null +++ b/portal-ui/check-warnings.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +if yarn build | grep "Compiled with warnings"; then + echo "There are warnings in the code" + exit 1 +fi diff --git a/portal-ui/src/screens/Console/Common/FormComponents/QueryMultiSelector/QueryMultiSelector.tsx b/portal-ui/src/screens/Console/Common/FormComponents/QueryMultiSelector/QueryMultiSelector.tsx index 2a44c1472..741c9683f 100644 --- a/portal-ui/src/screens/Console/Common/FormComponents/QueryMultiSelector/QueryMultiSelector.tsx +++ b/portal-ui/src/screens/Console/Common/FormComponents/QueryMultiSelector/QueryMultiSelector.tsx @@ -86,7 +86,7 @@ const QueryMultiSelector = ({ // Use effect to get the initial values from props useEffect(() => { if ( - currentKeys.length === 1 && + currentKeys.length == 1 && currentKeys[0] === "" && currentValues.length === 1 && currentValues[0] === "" &&