Fail PR if Warnings are present in React Code (#1348)

This commit is contained in:
Daniel Valdivia
2022-01-07 10:29:44 -08:00
committed by GitHub
parent 8c63d6dd4a
commit eadc449bb0
4 changed files with 26 additions and 1 deletions

17
.github/workflows/react-no-warnings.yml vendored Normal file
View File

@@ -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

View File

@@ -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

6
portal-ui/check-warnings.sh Executable file
View File

@@ -0,0 +1,6 @@
#!/bin/bash
if yarn build | grep "Compiled with warnings"; then
echo "There are warnings in the code"
exit 1
fi

View File

@@ -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] === "" &&