Socket
Socket
Sign inDemoInstall

eslint-pretty

Package Overview
Dependencies
158
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    eslint-pretty

Wrap eslint and esformatter to format and pretty-print from stdin


Version published
Maintainers
1
Install size
22.3 MB
Created

Readme

Source

eslint-pretty

Wrap eslint and esformatter to format and pretty-print javascript via stdio.

Installation

npm install -g eslint-pretty

Usage

cat uglylinty.js | eslint-pretty > uglylinty_pretty.js

Why

After carefully building your .eslintrc.js file, wouldn't it be nice to quickly format code according to those rules?

How

This project is merely a thin wrapper around two very excellent projects: esformatter and eslint.

It does a couple of passes over the linty code. First it uses esformatter to fix the basic stuff like indenting. Then it uses eslint to apply any rules that are "fixable". It may pass through eslint a few times. This can be slow.

All the rules detected from your local .eslintrc.js and .esformatter will apply.

If anything goes wrong, eslint-pretty will fail open and return your original input.

Usage in Vim / Neovim

Add this to your vimrc:

autocmd FileType javascript setlocal equalprg=eslint-pretty

Now visually select some nasty code and hit =. Bam! Nice and pretty.

Run :help equalprg to see why this works.

Contributing

Whatever just do this:

npm test

Keywords

FAQs

Last updated on 13 Jun 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc