beautifier/js-beautify
Add `defaultOptions` method to main beautifier
Aperta
#1584 aperta il 1 nov 2018
good first issueimplementation: javascripttype: enhancement
Metriche repository
- Star
- (8342 stelle)
- Metriche merge PR
- (Metriche PR in attesa)
Descrizione
Description
Related to #1364. #1568 added a basic implementation for this.
We need to add beautify.defaultOptions() that:
- calls core
Optionsconstructor - calls each of the child
defaultOptions() - removes the inherited settings and also the
raw_optionsfield
It should return something like what is shown below.
Finally, we should consider calling this method during the build to generate the .jsbeautifyrc file.
There should be one source of truth the settings for the project.
{
"disabled": false,
"eol": "auto",
"end_with_newline": false,
"indent_size": 4,
"indent_char": " ",
"indent_level": 0,
"preserve_newlines": true,
"max_preserve_newlines": 32786,
"indent_with_tabs": false,
"wrap_line_length": 0,
"js": {
"brace_preserve_inline": false,
"brace_style": "collapse",
"unindent_chained_methods": false,
"break_chained_methods": false,
"space_in_paren": false,
"space_in_empty_paren": false,
"jslint_happy": false,
"space_after_anon_function": false,
"space_after_named_function": false,
"keep_array_indentation": false,
"space_before_conditional": true,
"unescape_strings": false,
"e4x": false,
"comma_first": false,
"operator_position": "before-newline",
"test_output_raw": false
},
"css": {
"selector_separator_newline": true,
"newline_between_rules": true,
"space_around_combinator": false
},
"html": {
"js": {},
"css": {},
"indent_inner_html": false,
"indent_body_inner_html": true,
"indent_head_inner_html": true,
"indent_handlebars": true,
"wrap_attributes": "auto",
"wrap_attributes_indent_size": 4,
"extra_liners": [
"head",
"body",
"/html"
],
"inline": [
"a", "abbr", "area", "audio", "b", "bdi", "bdo", "br", "button", "canvas", "cite", "code", "data", "datalist", "del", "dfn", "em", "embed", "i", "iframe", "img", "input", "ins", "kbd", "keygen", "label", "map", "mark", "math", "meter", "noscript", "object", "output", "progress", "q", "ruby", "s", "samp", "select", "small", "span", "strong", "sub", "sup", "svg", "template", "textarea", "time", "u", "var", "video", "wbr", "text", "acronym", "address", "big", "dt", "ins", "strike", "tt"
],
"void_elements": [
"area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "menuitem", "meta", "param", "source", "track", "wbr", "!doctype", "?xml", "?php", "?=", "basefont", "isindex"
],
"unformatted": [],
"content_unformatted": [
"pre",
"textarea"
],
"indent_scripts": "normal"
}
}