I need to run yarn tsc
and yarn lint
during every yarn start
to identify any code errors.
This is how my scripts property is set up:
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"test": "jest --watchAll",
"clean": "expo start -c",
},
To incorporate this, I added the following:
"lint": "eslint . --ext .ts,.tsx,.json",
"prestart": "yarn tsc && yarn lint"
However, if either command encounters an error, the script stops executing entirely.
I attempted using ||
:
"lint": "eslint . --ext .ts,.tsx,.json",
"prestart": "yarn tsc || yarn lint || exit 0"
Unfortunately, this solution also falls short as it only runs the first command, skipping eslint
if no errors occur.
Is there a way to configure a script to run multiple commands and ignore exit errors should any of them fail?
The ultimate goal is to replicate the functionality of the create-react-app
template, where errors are checked on every start... with the additional step of implementing a typescript check.