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.

  1. Open a terminal.
  2. mkdir -p ~/.local/git_hooks
  3. cd ~/.local/git_hooks && vim
  4. Press the i key to go to insert mode and paste this code:
    #!/bin/sh
    git submodule update --init --recursive
  1. Press ESC then :w post-checkout and press return.
  2. You should get a file written message.
  3. Enter :w post-merge and press return.
  4. Enter :q and press return.
  5. Run chmod +x post*
  6. 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.

  1. Install the vscode-save-runner plugin @ https://github.com/OneOfOne/vscode-save-runner
  2. 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.