Skip to content

IlluminiTech/prettier-config

Repository files navigation

prettier-config

This package provides Illumini's base prettier configuration.

Pairs well with our ESLint configuration.

Table of Contents

Installation

npm

npm install --save-dev @illumini/prettier-config

If you don't have it installed already, also install prettier as a devDependency.

npm install --save-dev prettier

yarn

yarn add --dev @illumini/prettier-config prettier

Configurations

We export one ESLint configuration for your usage:

  1. Default

Default Config

Create a prettier.config.js file at the root of your project that contains:

module.exports = require('@illumini/prettier-config');

VS Code

  1. Install Prettier extension: View → Extensions then find and install Prettier - Code formatter

  2. Reload the editor

  3. In your VS Code user settings Code/File → Preferences → Settings or CMD/CTRL + , click the {} icon in the top right corner to modify your settings.json file

    // Format on save with Prettier rules
    "editor.formatOnSave": true,

Pre-commit Hook

As another line of defence, if you want ESLint to automatically fix your errors on commit, you can use lint-staged with husky, which manages git hooks.

  1. npm install --save-dev lint-staged husky

  2. In your package.json:

    {
      "lint-staged": {
        "*.js": ["eslint --fix"]
      },
      "husky": {
        "hooks": {
          "pre-commit": "lint-staged"
        }
      }
    }

Publishing to npm

Read npm's docs on How to Update a Package.

  1. npm login
    • Make sure you're logged into illumini's npm account with the credentials from 1pass. npm whoami will tell you if you're already logged in.
  2. npm version <update_type>
    • update_type can be patch, minor, or major. If you don't know which one to use, go read about semantic versioning.
  3. npm publish

Releases

No releases published

Packages

No packages published