Skip to content
prettier-config / 0.1.3

prettier-config 0.1.3

Install from the command line:
Learn more about npm packages
$ npm install @lovetoknow/prettier-config@0.1.3
Install via package.json:
"@lovetoknow/prettier-config": "0.1.3"

About this version

@lovetoknow/prettier-config

LoveToKnow's Prettier default configuration

ℹ ALREADY INCLUDED IN @lovetoknow/eslint-config

If you have the eslint configuration with LTK's rules and you followed the instructions in https://github.com/LoveToKnow/lint/blob/main/packages/eslint-config/README.md you don't need to install @lovetoknow/prettier-config because you already have it.

Installation

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

Usage

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

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

Enforced Rules

Check out all of Prettier's configuration options.

  • Print Width

    Line wrap at 100 characters.

  • Tab Width

    2 spaces per indentation-level.

  • Tabs

    Indent lines with spaces, not tabs.

  • Semicolons

    Never print semicolons at the ends of statements. Only when it's needed, put semicolors at the start of the next line.

    const greeting = 'hi'
  • Quote

    Use single quotes instead of double quotes wherever possible.

    const quote = 'single quotes are better'
  • Trailing Commas

    Use trailing commas wherever possible.

    const obj = {
      a: 'hi',
      b: 'hey',
    }
  • Bracket Spacing

    Print spaces between brackets in object literals.

    { foo: bar }
  • JSX Brackets

    Put the > of a multi-line JSX element at the end of the last line instead of being alone on the next line (does not apply to self closing elements) if the line is too long and the text wraps or there is no other rule controlling this behaviour, like vue/max-attributes-per-line.

    <button
      className="prettier-class"
      id="prettier-id"
      onClick={this.handleClick}
    >
      Click Here
    </button>
  • Arrow Function Parentheses

    Omit parens when possible.

    x => x
  • HTML Whitespace Sensitivity

    Respects whitespace the same way you would expect for inline elements in your HTML.

    See more info here: https://prettier.io/blog/2018/11/07/1.15.0.html#whitespace-sensitive-formatting

Overriding rules

You can also choose to our Prettier configuration passing addtional options like this (it is also explained in the official docs):

// .prettierrc.js
- module.exports = require('@lovetoknow/prettier-config')
+ module.exports = {
+  ...require('@lovetoknow/prettier-config'),
+  printWidth: 80,
+ }

Overriding specific files

See official docs: https://prettier.io/docs/en/configuration.html#configuration-overrides

Details


Assets

  • prettier-config-0.1.3.tgz

Download activity

  • Total downloads 0
  • Last 30 days 0
  • Last week 0
  • Today 0