mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
chore: enable strictNullCheck but ignore problems at compile time (#3273)
## About the changes
This enables strictNullChecks which will give us nice hints in our IDEs
to avoid introducing more and hopefully will encourage us to fix some of
the existing problems.
Also:
1. The compiler explicitly ignores these errors
2. The "null checks action" still verifies we're not introducing new
ones.
The combination of these two things should help us to reduce the number
of nulls
For testing that the action still works (cause it was modified), [a
commit](5c4b818d1a
)
was added introducing a bunch of null check errors:
https://github.com/Unleash/unleash/actions/runs/4364648191/jobs/7632224720
This commit is contained in:
parent
85b63bd8f7
commit
8109c13e66
11
.github/workflows/gradual-strict-null-checks.yml
vendored
11
.github/workflows/gradual-strict-null-checks.yml
vendored
@ -47,13 +47,12 @@ jobs:
|
||||
--data "{ \"body\": \"${1}\" }"
|
||||
}
|
||||
|
||||
sed -i 's/\/\/\s*"strictNullChecks":\s*true,/"strictNullChecks": true,/' "current/tsconfig.json"
|
||||
sed -i 's/\/\/\s*"strictNullChecks":\s*true,/"strictNullChecks": true,/' "main/tsconfig.json"
|
||||
YARN_1="yarn --mutex network --cwd ./current"
|
||||
YARN_2="yarn --mutex network --cwd ./main"
|
||||
|
||||
yarn --mutex network --cwd ./current 2> .stderr-current > .out-current &
|
||||
$YARN_1 install --ignore-scripts &> /dev/null && $YARN_1 build --strictNullChecks true 2> .stderr-current > .out-current &
|
||||
pid1=$!
|
||||
|
||||
yarn --mutex network --cwd ./main 2> .stderr-main > .out-main &
|
||||
$YARN_2 install --ignore-scripts &> /dev/null && $YARN_2 build --strictNullChecks true 2> .stderr-main > .out-main &
|
||||
pid2=$!
|
||||
|
||||
# wait for the processes that are expected to fail
|
||||
@ -66,7 +65,7 @@ jobs:
|
||||
MAIN=$(grep "Found [0-9]* errors" .out-main | sed 's/Found \(.*\) errors in .* files./\1/')
|
||||
|
||||
if [ $CURRENT -gt $MAIN ]; then
|
||||
comment "After enabling [\`strictNullChecks\`](https://www.typescriptlang.org/tsconfig#strictNullChecks) this PR would be **increasing** the number of null check errors from ${MAIN} to ${CURRENT}. <br /> Make sure your branch is up-to-date with ${MAIN_BRANCH} and **check the diff in the console output** to gather more details."
|
||||
comment "After enabling [\`strictNullChecks\`](https://www.typescriptlang.org/tsconfig#strictNullChecks) this PR would be **increasing** the number of null check errors from ${MAIN} to ${CURRENT}. <br /> Make sure your branch is up-to-date with ${MAIN_BRANCH} and **check the diff in the console output** to pinpoint the offending files."
|
||||
diff .out-current .out-main
|
||||
exit 1
|
||||
else
|
||||
|
@ -35,9 +35,9 @@
|
||||
"lint": "eslint ./src",
|
||||
"local:package": "del-cli --force build && mkdir build && cp -r dist docs CHANGELOG.md LICENSE README.md package.json build",
|
||||
"prebuild:watch": "yarn run clean",
|
||||
"build:watch": "tsc -w",
|
||||
"build:watch": "tsc -w --strictNullChecks false",
|
||||
"prebuild": "yarn run clean",
|
||||
"build": "yarn run copy-templates && tsc --pretty",
|
||||
"build": "yarn run copy-templates && tsc --pretty --strictNullChecks false",
|
||||
"prepare": "node scripts/husky-install && cd frontend && yarn && cd .. && yarn run build",
|
||||
"test": "NODE_ENV=test PORT=4243 jest",
|
||||
"test:unit": "NODE_ENV=test PORT=4243 jest --testPathIgnorePatterns=src/test/e2e --testPathIgnorePatterns=dist",
|
||||
|
@ -27,7 +27,7 @@
|
||||
/* Strict Type-Checking Options */
|
||||
// "strict": true, /* Enable all strict type-checking options. */
|
||||
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
|
||||
// "strictNullChecks": true, /* Enable strict null checks. */
|
||||
"strictNullChecks": true /* Enable strict null checks. */,
|
||||
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
|
||||
"strictBindCallApply": true /* Enable strict 'bind', 'call', and 'apply' methods on functions. */,
|
||||
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
|
||||
|
Loading…
Reference in New Issue
Block a user