UNPKG

3.9 kBTypeScriptView Raw
1// Type definitions for js_beautify 1.13
2// Project: https://github.com/beautify-web/js-beautify/
3// Definitions by: Hans Windhoff <https://github.com/hansrwindhoff>
4// Gavin Rehkemper <https://github.com/gavinr/>
5// Piotr Błażejewicz <https://github.com/peterblazejewicz/>
6// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
7
8declare namespace js_beautify {
9 interface CoreBeautifyOptions {
10 disabled?: boolean | undefined;
11 eol?: string | undefined;
12 end_with_newline?: boolean | undefined;
13 indent_size?: number | undefined;
14 indent_char?: string | undefined;
15 indent_level?: number | undefined;
16 preserve_newlines?: boolean | undefined;
17 max_preserve_newlines?: number | undefined;
18 indent_with_tabs?: boolean | undefined;
19 wrap_line_length?: number | undefined;
20 indent_empty_lines?: boolean | undefined;
21 templating?: string[] | undefined;
22 }
23
24 interface JSBeautifyOptions extends CoreBeautifyOptions {
25 brace_style?: 'collapse' | 'expand' | 'end-expand' | 'none' | 'preserve-inline' | undefined;
26 unindent_chained_methods?: boolean | undefined;
27 break_chained_methods?: boolean | undefined;
28 space_in_paren?: boolean | undefined;
29 space_in_empty_paren?: boolean | undefined;
30 jslint_happy?: boolean | undefined;
31 space_after_anon_function?: boolean | undefined;
32 space_after_named_function?: boolean | undefined;
33 keep_array_indentation?: boolean | undefined;
34 space_before_conditional?: boolean | undefined;
35 unescape_strings?: boolean | undefined;
36 e4x?: boolean | undefined;
37 comma_first?: boolean | undefined;
38 operator_position?: 'before-newline' | 'after-newline' | 'preserve-newline' | undefined;
39 test_output_raw?: boolean | undefined;
40 }
41
42 interface HTMLBeautifyOptions extends CoreBeautifyOptions {
43 templating?: string[] | undefined;
44 indent_inner_html?: boolean | undefined;
45 indent_body_inner_html?: boolean | undefined;
46 indent_head_inner_html?: boolean | undefined;
47 indent_handlebars?: boolean | undefined;
48 wrap_attributes?:
49 | 'auto'
50 | 'force'
51 | 'force-aligned'
52 | 'force-expand-multiline'
53 | 'aligned-multiple'
54 | 'preserve'
55 | 'preserve-aligned' | undefined;
56 wrap_attributes_indent_size?: number | undefined;
57 extra_liners?: string[] | undefined;
58 inline?: string[] | undefined;
59 void_elements?: string[] | undefined;
60 unformatted?: string[] | undefined;
61 content_unformatted?: string[] | undefined;
62 unformatted_content_delimiter?: string | undefined;
63 indent_scripts?: 'normal' | 'keep' | 'separate' | undefined;
64 }
65
66 interface CSSBeautifyOptions extends CoreBeautifyOptions {
67 selector_separator_newline?: boolean | undefined;
68 newline_between_rules?: boolean | undefined;
69 space_around_selector_separator?: boolean | undefined;
70 space_around_combinator?: boolean | undefined;
71 }
72}
73
74declare var js_beautify: {
75 (js_source_text: string, options?: js_beautify.JSBeautifyOptions): string;
76 js: (js_source_text: string, options?: js_beautify.JSBeautifyOptions) => string;
77 js_beautify: (js_source_text: string, options?: js_beautify.JSBeautifyOptions) => string;
78
79 css: (js_source_text: string, options?: js_beautify.CSSBeautifyOptions) => string;
80 css_beautify: (js_source_text: string, options?: js_beautify.CSSBeautifyOptions) => string;
81
82 html: (js_source_text: string, options?: js_beautify.HTMLBeautifyOptions) => string;
83 html_beautify: (js_source_text: string, options?: js_beautify.HTMLBeautifyOptions) => string;
84};
85
86export as namespace js_beautify;
87export = js_beautify;