Dev Tips
Turn off NPM annoyances
Turn off audit messaging, speeds up some commands.
npm config set audit false --user
Turn off project is looking for funding messages, speeds up some commands.
npm config set fund false --user
Automatic submodule updating
The problem with a normal pull is Git won't by default checkout any updates that have been made to the submodule references. Since Git 2.9 there has been support for a global hooks directory so we can easily automate this.
- Open a terminal.
mkdir -p ~/.local/git_hooks
cd ~/.local/git_hooks && vim
- Press the i key to go to insert mode and paste this code:
#!/bin/sh
git submodule update --init --recursive
- Press ESC then
:w post-checkout
and press return. - You should get a file written message.
- Enter
:w post-merge
and press return. - Enter
:q
and press return. - Run
chmod +x post*
-
Now we'll configure git to use these with this command:
git config --global --add core.hooksPath '~/.local/git_hooks'
VScode Automated ESlint formatting
While the eslint plugin reports to have an autofix on save option I have so far not been able to get it to work properly. Until such time as it is working here is a good work around.
- Install the vscode-save-runner plugin @ https://github.com/OneOfOne/vscode-save-runner
- Add this section to your user settings.json
File > Preferences > Settings > 3 dots menu -> show settings.json
{
// start copy after this line
"save-runner.enabled": true,
"save-runner.commands": [
{
"enabled": true,
"include": "\\.[tj]sx?$",
"exclude": "/node_modules/",
"useTempFile": false,
"post": "npx eslint -o /dev/null --fix ${file}"
},
{
"enabled": true,
"include": "\\.vue$",
"useTempFile": false,
"exclude": "/node_modules/",
"post": "npx eslint -o /dev/null --fix ${file}"
}
],
// end copy before this line
}
Now when your js or vue file is saved it will be automatically ran through the locally installed eslint and formatted according to your config.