beautifier/js-beautify

Add `defaultOptions` method to main beautifier

Open

#1,584 opened on 2018年11月1日

GitHub で見る
 (2 comments) (3 reactions) (0 assignees)JavaScript (8,342 stars) (1,460 forks)batch import
good first issueimplementation: javascripttype: enhancement

説明

Description

Related to #1364. #1568 added a basic implementation for this.

We need to add beautify.defaultOptions() that:

  1. calls core Options constructor
  2. calls each of the child defaultOptions()
  3. removes the inherited settings and also the raw_options field

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"
  }
}

コントリビューターガイド

Add `defaultOptions` method to main beautifier · beautifier/js-beautify#1584 | Good First Issue