Skip to content

Instantly share code, notes, and snippets.

@softwarespot
Last active January 8, 2023 10:42
Show Gist options
  • Save softwarespot/8a6d9bb6b848f3cc9824 to your computer and use it in GitHub Desktop.
Save softwarespot/8a6d9bb6b848f3cc9824 to your computer and use it in GitHub Desktop.
JS Beautifier configuration
// Documentation: https://github.com/beautify-web/js-beautify
// Example URL: https://github.com/victorporof/Sublime-HTMLPrettify/blob/master/.jsbeautifyrc
// Based on Airbnb's JavaScript Style Guide, URL: https://github.com/airbnb/javascript
{
// Collapse curly brackets
"brace_style": "collapse",
// Break chained method calls across subsequent lines
"break_chained_methods": true,
// End output with newline
"end_with_newline": true,
// Evaluate code
"eval_code": false,
// Indentation character
"indent_char": " ",
// Initial indentation level
"indent_level": 0,
// Indentation character size
"indent_size": 4,
// Indent with tabs, overrides 'indent_size' and 'indent_char'
"indent_with_tabs": false,
// Enable jslint-stricter mode
"jslint_happy": false,
// Preserve array indentation
"keep_array_indentation": false,
// Preserve function indentation
"keep_function_indentation": false,
// Number of line-breaks to be preserved in one chunk
"max_preserve_newlines": 10,
// Preserve newlines
"preserve_newlines": true,
// Add a space before an anonymous function's parentheses, i.e. function ()
"space_after_anon_function": true,
// Add a space before the conditional statement i.e. 'if (true)'
"space_before_conditional": true,
// Add padding spaces within empty parentheses i.e. 'f( )'
"space_in_empty_paren": false,
// Add padding spaces within parentheses i.e. 'f( a, b )'
"space_in_paren": false,
// Decode printable characters encoded in xNN notation
"unescape_strings": false,
// Wrap lines at next opportunity after N characters
"wrap_line_length": 0
}
// Note: Remove the comments when adding to the project
@brecke
Copy link

brecke commented Nov 30, 2016

Good job! But why are you using 4 spaces for indent? airbnb states otherwise here.

@PolGuixe
Copy link

I'll give it try! Thanks.

@tayfunyasar
Copy link

Thanks.!

@gitsupersmecher
Copy link

Is any way to remove the space near the tags ?
E.g. : "export class HomeLoader extends React.Component < IHomeLoaderProps, IHomeLoaderState > {"
I would like it to be : "export class HomeLoader extends React.Component <IHomeLoaderProps, IHomeLoaderState> {"

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment