npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

es-beautifier

v1.2.0

Published

ECMAScript beautifier based on eslint

Downloads

3,636

Readme

Build Status npm vim atom vscode

ECMAScript beautifier based on eslint

screenshot

Motivation

JS Beautifier is so great that it can reduce formatting issues, however, there are two major issues: a) customization and b) ES.next.

a) If you like the result of code generated by JS Beautifier, it's just fine, but if you can't manage with its configuration options, you are out of luck.

b) If you are using a new ECMAScript feature or features that are not even standardized, you are also out of luck, because the parser does not support the features. Among such is JSX.

ESLint is a linting tool widely used, which adopts a pluggable architecture so that it's highly customizable. It also has an ability to automatically fix problems. There's lots of plugins developed, forming a big ecosystem.

So, why not build a beautifying tool using eslint?

Usage (CLI)

Install

npm install es-beautifier -g --only=production
es-beautifier --help

Example

es-beautifier < file.js > file-beautified.js
es-beautifier file-to-be-beautified.js

Usage (Vim)

Example with NeoBundle

NeoBundle 'dai-shi/es-beautifier', {'rtp': 'contrib/vim', 'external_commands': 'node', 'build_commands': 'npm', 'build': {'others': 'npm install --only=production'}}
autocmd FileType javascript nnoremap <buffer> <Leader>e :call EsBeautifier()<cr>
autocmd FileType javascript vnoremap <buffer> <Leader>e :call RangeEsBeautifier()<cr>

Usage (Atom)

https://atom.io/packages/es-beautifier

Toggle the Command Palette and enter "es-beautifier".

For the long term use, you might want to configure keybindings, for example:

'atom-text-editor':
  'shift-cmd-e': 'es-beautifier'

If you want to use your eslintrc files do the following, but please be reminded that it may conflict with the beautifier rule and may cause unexpected behavior.

'es-beautifier':
  'useEslintrc': true

Usage (Visual Studio Code)

ext install vscode-es-beautifier

Open the Change Language Mode (Cmd-K M / Ctrl-K M) and select "es-beautifier". You can format code just like the original formatter.

For the long term use, you might want to configure it in settings.json:

{
  "files.associations": {"*.js":"es-beautifier"}
}

If you want to use your eslintrc files add the following, but please be reminded that it may conflict with the beautifier rule and may cause unexpected behavior.

"[es-beautifier]": {
  "useEslintrc": true
}

Usage (eslint-plugin)

You can customize it just like a normal eslint plugin.

Install

In your project directory:

npm install eslint eslint-plugin-es-beautifier --save-dev

Example

Add the following to your .eslintrc or eslintConfig in package.json.

{
  "plugins": [
    "es-beautifier"
  ],
  "extends": [
    "plugin:es-beautifier/standard"
  ]
}

Add the following scripts in package.json.

{
  "scripts": {
    "beautify": "eslint --fix ."
  }
}

Run:

npm run beautify

Similar projects

There are several tools that do smiliar to what es-beautifier does.

To see the comparison:

git clone https://github.com/dai-shi/es-beautifier.git
cd es-beautifier
npm install
npm run examples

Here's more intuitive (biased) comparison in table:

| | js-beautify | uglify-js | esformatter | prettydiff | es-beautifier | prettier | |----------------|-------------|-----------|-------------|------------|---------------|---------------| | ES2015 Parser | Own | Own | Esprima | Own | Espree | Babylon | | Customization | Limited | No | Plugin | Somewhat | Plugin | Limited | | Comments | OK | Removed | OK | OK | OK | OK | | JSX Support | No | Error | No | Limited | Yes | Yes | | Array in array | Yes | No | No | Wierd | Yes | Yes | | Execution Time | Short | Short | Long | Short | Long | Short | | Completion | Mature | Good | Young | Good | Young | Active |

Blogs