-
Notifications
You must be signed in to change notification settings - Fork 91
Plugins
JavaScript is a very flexible language, which means people write it in many different ways, since adding support for every single kind of style would be impossible, we decided to introduce plugins; that should give enough flexibility to tailor the formatting to match the craziest needs.
@pgilad created an user interface to search all the packages on npm with the esformatter-plugin
keyword: http://pgilad.github.io/esformatter-plugins/ so if you're creating a new plugin please add it to your package.json
-
es-strip-semicolons
- Strip unnecessary semicolons from Ecmascript code
-
esformatter-asi
- Esformatter plugin to automatically remove semicolons that would be inserted by ASI rules
-
esformatter-braces
- enforces braces around statements.
-
esformatter-collapse-objects
- conditionally collapse object and array literals on a single line
-
esformatter-curly
- keep the multiline
import
, if it was multiline - keep simple object inline, if it was inline
- keep the multiline
-
esformatter-dot-notation
- transform
obj['property']
intoobj.property
for valid string literals.
- transform
-
esformatter-eol-last
- add newline to end of formatted file if one is missing.
-
esformatter-flow
- format Flow type annotations.
-
esformatter-jquery-chain
- formatting chained member expressions according to the jQuery style guide, with traversal methods like find() adding additional indent
-
esformatter-jsx
- allows esformatter to format files that contain Facebook React jsx syntax, using the html beautifier from
js-beautify
to format the HTML Like jsx blocks.
- allows esformatter to format files that contain Facebook React jsx syntax, using the html beautifier from
-
esformatter-jsx-ignore
- allows esformatter to format files that contain Facebook React jsx syntax (ignoring the blocks, but beautifying the rest of the file as defined in your esformatter configuration)
- important: not needed after v0.7.0
-
esformatter-literal-notation
- transform array and object constructors to literal notations. (example:
new Object()
=>{}
)
- transform array and object constructors to literal notations. (example:
-
esformatter-onevar
- hoist all variables declarations to top of function scope.
-
esformatter-parseint
- adds the radix parameter to parseInt
-
esformatter-phonetic
- rename variables to pronouncable names. useful for obfuscated scripts.
-
esformatter-quote-props
- fixes ESLint
quote-props
rule by removing quotes around props that don't need quotes.
- fixes ESLint
-
esformatter-quotes
- enforces coding style that string literals are delimited with single or double quotes.
-
esformatter-remove-trailing-commas
- remove trailing commas (object & array)
-
esformatter-rename
- rename variables, parameters, and labels to whatever you want.
-
esformatter-semicolons
- adds missing and removes unnecessary semicolons.
-
esformatter-semicolons-first
- add semicolon before
[
and(
if they are the first things on the line.
- add semicolon before
-
esformatter-shebang-ignore
- allows esformatter to apply its magic on files that contain shebang lines (
#!/usr/bin node
i.e.) - important: not needed after v0.6.0
- allows esformatter to apply its magic on files that contain shebang lines (
-
esformatter-spaced-lined-comment
- add space to line comments, fixes ESLint
spaced-lined-comment
rule failures.
- add space to line comments, fixes ESLint
-
esformatter-special-bangs
- a very simple plugin to insert a space after groups of negation operators, but not affect other unary expressions
-
esformatter-use-strict
- makes sure there is only one 'use strict' statement in a module and it's the first statement.
-
esformatter-var-each
- expand all comma-based
var
statements into multiplevar
statements
- expand all comma-based
-
rocambole-commafirst
- rewrites program following the comma-first style.
List of plugins that we would like to see developed/maintained:
- normalize comments at the end/beginning of lines/blocks.
- hard wrap lines if over a certain length.
- sort variables and properties
If you're interested in writing a plugin, check out the documentation on writing plugins.
We are also flagging any issues that could/should be implemented as a plugin with the tag plugins-wishlist