@igoro00/prettier-config

1.2.0 • Public • Published

Prettier Config

npm version

My very opinionated prettier config. If you're not me you probably shouldn't use it.

Table of Contents

Installation

  1. Make sure your project is using a Node version >= 10

  2. Install dependencies

     ```sh
     npm install --save-dev @igoro00/prettier-config prettier@2.x.x
    
     # or
    
     yarn add --dev @igoro00/prettier-config prettier@2.x.x
     ```
    
  3. Create a prettier.config.js file at the root of your project with the following:

     ```js
     module.exports = require('@igoro00/prettier-config');
     ```
    

Editor Integration & Autoformatting

VS Code

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

  2. Reload the editor

  3. Open your settings JSON file and add the following

     ```json
     // Format on save with Prettier rules
     "editor.formatOnSave": true,
     // Tell the ESLint plugin to run on save
     "editor.codeActionsOnSave": {
     	"source.fixAll.eslint": true
     },
     // Turn off Prettier format on save, use ESLint to format instead
     "[javascript]": {
     	"editor.formatOnSave": false
     },
     "[vue]": {
     	"editor.formatOnSave": false
     },
     "eslint.alwaysShowStatus": true,
     // An array of language identifiers specify the files to be validated
     "eslint.options": {
     	"extensions": [".html", ".js", ".vue", ".jsx"]
     },
     ```
    

Sublime Text 3

https://packagecontrol.io/packages/JsPrettier

Atom

https://atom.io/packages/prettier-atom

Publishing to npm

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

  1. Checkout and pull the master branch

  2. Run the release script to bump the version numbers (the script will create a commit and push up the release branch to GitHub for you)

    ./scripts/release

    Use semantic versioning to choose the appropriate version number.

  3. Submit and merge a PR from the release branch into master

  4. Make sure you're logged into npm from the command line using npm whoami. If you're not logged in, npm login with the credentials in 1pass

  5. npm publish

Enforced Rules

Check out all of Prettier's configuration options.

Print Width
Line wrap at 100 characters.
Tabs
Spaces are for separating words, not scope of code blocks!
Semicolons
Always print semicolons at the ends of statements.

```js
const greeting = 'hi';
```
Quote
Use an actual quotes instead of apostrophes.

```js
const quote = "With double quotes you don't have to escape apostrophes. It's better, isn't it?";
```
Trailing Commas
Always put trailing commas.

```js
const obj = {
	a: 'hi',
	b: 'hey',
};
```
Bracket Spacing
Print spaces between brackets in object literals.

```js
{ foo: bar }
```

Readme

Keywords

Package Sidebar

Install

npm i @igoro00/prettier-config

Weekly Downloads

0

Version

1.2.0

License

ISC

Unpacked Size

6 kB

Total Files

6

Last publish

Collaborators

  • igoro00