NO PRODUCTION PLUGIN: IT'S STILL UNDER DEVELOPMENT
esformatter-onevar
esformatter plugin for enforcing one var statement per function scope
Esformatter-onevar is a plugin for esformatter meant for onevar enforcement in function scope. Recommended by Douglas Crockford in his coding style guide.
Turn this:
var foo = 'foo' bar = 'bar'; var hello = true world = false; for var i = 0 l = 10; i < l; i++ var chain = chain + ' ' + i;
into:
var foo = 'foo' bar = 'bar' hello world i l chain; hello = true;world = false; for i = 0 l = 10; i < l; i++ chain = chain + ' ' + i;
For more information see:
- The jscs option - disallowMultipleVarDecl
For any other formatting (such as onevar placement, spacing and line wrapping) use esformatter or other plugins.
Installation
$ npm install esformatter-onevar --save-dev
Config
Newest esformatter versions autoload plugins from your node_modules
See this
Add to your esformatter config file:
Or you can manually register your plugin:
// register pluginesformatter;
Usage
var fs = ;var esformatter = ;//register plugin manuallyesformatter; var str = fs;var output = esformatter;//-> output will now contain the formatted string
See esformatter for more options and further usage.
License
MIT ©2014 Evan Vosberg