-
Notifications
You must be signed in to change notification settings - Fork 91
Plugins
Antoine Lehurt edited this page Mar 31, 2015
·
41 revisions
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.
-
esformatter-quotes
- enforces coding style that string literals are delimited with single or double quotes.
-
rocambole-commafirst
- rewrites program following the comma-first style.
-
esformatter-braces
- enforces braces around statements.
-
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-dot-notation
- transform
obj['property']
intoobj.property
for valid string literals.
- transform
-
esformatter-literal-notation
- transform array and object constructors to literal notations. (example:
new Object()
=>{}
)
- transform array and object constructors to literal notations. (example:
-
esformatter-parseint
- adds the radix parameter to parseInt
-
esformatter-onevar
- hoist all variables declarations to top of function scope.
-
esformatter-var-each
- expand all comma-based
var
statements into multiplevar
statements
- expand all comma-based
-
esformatter-phonetic
- rename variables to pronouncable names. useful for obfuscated scripts.
-
esformatter-rename
- rename variables, parameters, and labels to whatever you want.
-
esformatter-eol-last
- add newline to end of formatted file if one is missing.
-
esformatter-spaced-lined-comment
- add space to line comments, fixes ESLint
spaced-lined-comment
rule failures.
- add space to line comments, fixes ESLint
-
esformatter-use-strict
- makes sure there is only one 'use strict' statement in a module and it's the first statement.
-
esformatter-quote-props
- fixes ESLint
quote-props
rule by removing quotes around props that don't need quotes.
- fixes ESLint
-
esformatter-shebang-ignore
- allows esformatter to apply its magic on files that contain shebang lines (
#!/usr/bin node
i.e.)
- allows esformatter to apply its magic on files that contain shebang lines (
-
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)
-
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-special-bangs
- a very simple plugin to insert a space after groups of negation operators, but not affect other unary expressions
-
esformatter-jquery-chain
- formatting chained member expressions according to the jQuery style guide, with traversal methods like find() adding additional indent
-
esformatter-remove-trailing-commas
- remove trailing commas (object & array)
List of plugins that we would like to see developed/maintained:
- normalize comments at the end/beginning of lines/blocks.
- keep objects and arrays into a single line if short enough.
- hard wrap lines if over a certain length.
- enforce braces in conditionals/loops/scopes
- 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