0.0.12 • Published 2 years ago

@iunu-inc/code-style v0.0.12

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

IUNU Code Style Guide

A bunch of configuration files for code style standards. Intended to be shared across all IUNU's repos.

Usage

Add config files

  1. Install the files

    npm i -D @iunu-inc/code-style
    npx add-code-style
  2. Verify settings match the type of project you're working on.

    ESLint in particular has a bunch of settings that will vary base on the type of project you're working on. Node vs browser, what version of ES / TS you're working with, etc.

    We provide some other eslint configs for different environments:

Consider adding some editor settings

  • VS Code

    .vscode/settings.json

  • Vim

    let g:prettier#autoformat_config_present = 1
    let g:prettier#autoformat_require_pragma = 0

Consider installing editor plugins

This will automatically apply formatting and linting to your files.

Formatting a pre-existing project

  1. Make sure you've got a clean working tree
  2. Run Prettier

    prettier -w
  3. Commit changes

    git add .
    git commit --author="Prettier (see commit msg) <software@iunu.com>" \
    -m "🎨 format with prettier (see message)" -m \
    'To see the original author of a line with `git blame`, use:
    
    ```bash
    git config blame.ignoreRevsFile .git-blame-ignore-revs
    ```
    
    This will configure git to ignore this commit when looking at history for `blame`.'
  4. Add formatting commit hash to .git-blame-ignore-revs

    This makes git blame ignore the formatting commit so you can see the actual author of the line.

  5. Commit .git-blame-ignore-revs

    git add .git-blame-ignore-revs
    git commit -m "🔧 add git-blame-ignore-revs" -m \
    'Run the following command to ignore the repo-wide prettier format
    
    ```bash
    git config blame.ignoreRevsFile .git-blame-ignore-revs
    ```'
  6. Setup git to ignore the formatting commit

    git config blame.ignoreRevsFile .git-blame-ignore-revs