Skip to content

bugeats/eslint-pretty

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published