prettier/eslint-plugin-prettier

Name: eslint-plugin-prettier

Owner: Prettier

Description: ESLint plugin for prettier formatting

Created: 2017-01-26 04:09:32.0

Updated: 2018-05-24 07:05:26.0

Pushed: 2018-02-02 00:31:21.0

Homepage: null

Size: 101

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

eslint-plugin-prettier Build Status

Runs Prettier as an ESLint rule and reports differences as individual ESLint issues.

Sample
r: Insert `,` (prettier/prettier) at pkg/commons-atom/ActiveEditorRegistry.js:22:25:
 | import {
 |   observeActiveEditorsDebounced,
 |   editorChangesDebounced
 |                         ^
 | } from './debounced';;
 |
 | import {observableFromSubscribeFunction} from '../commons-node/event';


r: Delete `;` (prettier/prettier) at pkg/commons-atom/ActiveEditorRegistry.js:23:21:
 |   observeActiveEditorsDebounced,
 |   editorChangesDebounced
 | } from './debounced';;
 |                     ^
 |
 | import {observableFromSubscribeFunction} from '../commons-node/event';
 | import {cacheWhileSubscribed} from '../commons-node/observable';


rors found.

./node_modules/.bin/eslint --format codeframe pkg/commons-atom/ActiveEditorRegistry.js (code from nuclide).

Installation
install --save-dev eslint-plugin-prettier
install --save-dev --save-exact prettier

eslint-plugin-prettier does not install Prettier or ESLint for you. You must install these yourself.

Then, in your .eslintrc.json:


lugins": [
"prettier"

ules": {
"prettier/prettier": "error"


Recommended Configuration

This plugin works best if you disable all other ESLint rules relating to code formatting, and only enable rules that detect patterns in the AST. (If another active ESLint rule disagrees with prettier about how code should be formatted, it will be impossible to avoid lint errors.) You can use eslint-config-prettier to disable all formatting-related ESLint rules.

If your desired formatting does not match the prettier output, you should use a different tool such as prettier-eslint instead.

To integrate this plugin with eslint-config-prettier, you can use the "recommended" configuration:

  1. In addition to the above installation instructions, install eslint-config-prettier:

    install --save-dev eslint-config-prettier
    
  2. Then all you need in your .eslintrc.json is:

    
    ends": [
    lugin:prettier/recommended"
    
    
    

This does three things:

  1. Enables eslint-plugin-prettier.
  2. Sets the prettier/prettier rule to "error".
  3. Extends the eslint-config-prettier configuration.

You can then set Prettier's own options inside a .prettierrc file.

Options

Note: While it is possible to pass options to Prettier via your ESLint configuration file, it is not recommended because editor extensions such as prettier-atom and prettier-vscode will read .prettierrc, but won't read settings from ESLint, which can lead to an inconsistent experience.


Contributing

See CONTRIBUTING.md


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.