Closed Scott-Ian closed 3 years ago
Well I neglected to get the styling up to snuff for the linter. I can't get the linter to run on my machine either. Can you remind me of the command? I keep getting a missing script: lint error on my machine when attempting to run.
I'll have to troubleshoot it at a later date though.
Well I neglected to get the styling up to snuff for the linter. I can't get the linter to run on my machine either. Can you remind me of the command? I keep getting a missing script: lint error on my machine when attempting to run.
I'll have to troubleshoot it at a later date though.
The command to lint your project is npm run ci:lint
. But VSCode should also be set up to provide live linting for you. You also need to make sure that you have prettier installed as well. If you don't have eslint or prettier on your command line you can add them with
npm install -g eslint
npm install -g prettier
In addition to adding eslint and prettier to your machine, you'll also need to add them as extensions to VS code: https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode
Here is the Yargs implementation/example.
I spread out the implementation into three files which we will probably want to adjust later:
cli.ts: - just processed the arguments, and calls handleArguments
cli_options.ts: defines the accepted/required arguments, matches arguments with code to be executed, and contains handleArguments which executes code associated with flags, should the flag be present in the execution.
-cli_functions.ts : contains the functions which are to be executed if a flag is present. parameters may be passed through if the flag requires more information
I tested this to make sure it's working as intended. The only issue is that I am receiving a TypeError warning with cli_options.ts (line 37: cliExecutableskey;) but it all works as intended.
While installing yargs as a dependency, this also adds a @types/node dependency, as the jest tests were failing on my system.