Skip to content

Commit faff186

Browse files
committed
Merge pull request DefinitelyTyped#4658 from JoshuaKGoldberg/master
Add d.ts for js-beautify
2 parents 002a9a9 + e7046a1 commit faff186

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

js-beautify/js-beautify-tests.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/// <reference path="js-beautify.d.ts" />
2+
3+
var simple: string = js_beautify("console.log('Hello world!');");
4+
5+
var full: string = js_beautify(
6+
"console.log('Hello world!');",
7+
{
8+
"indent_size": 4,
9+
"indent_char": " ",
10+
"eol": "\n",
11+
"indent_level": 0,
12+
"indent_with_tabs": false,
13+
"preserve_newlines": true,
14+
"max_preserve_newlines": 10,
15+
"jslint_happy": false,
16+
"space_after_anon_function": false,
17+
"brace_style": "collapse",
18+
"keep_array_indentation": false,
19+
"keep_function_indentation": false,
20+
"space_before_conditional": true,
21+
"break_chained_methods": false,
22+
"eval_code": false,
23+
"unescape_strings": false,
24+
"wrap_line_length": 0,
25+
"wrap_attributes": "auto",
26+
"wrap_attributes_indent_size": 4,
27+
"end_with_newline": false
28+
});

js-beautify/js-beautify.d.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Type definitions for js_beautify
2+
// Project: https://github.com/beautify-web/js-beautify/
3+
// Definitions by: Josh Goldberg <https://github.com/JoshuaKGoldberg/>
4+
// Definitions: https://github.com/borisyankov/DefinitelyTyped
5+
6+
declare var js_beautify: {
7+
(js_source_text: string, options?: {
8+
indent_size?: number;
9+
indent_char?: string;
10+
eol?: string;
11+
indent_level?: number;
12+
indent_width_tabs?: boolean;
13+
preserve_newlines?: boolean;
14+
max_preserve_newlines?: number;
15+
jslint_happy: boolean;
16+
space_after_anon_function: boolean;
17+
brace_style: string;
18+
keep_array_indentation: boolean;
19+
keep_function_indentation: boolean;
20+
space_before_conditional: boolean;
21+
break_chained_methods: boolean;
22+
eval_code: boolean;
23+
unescape_strings: boolean;
24+
wrap_line_length: number;
25+
wrap_attributes: string;
26+
wrap_attributes_indent_size: number;
27+
end_with_newline: boolean;
28+
}): string;
29+
};

0 commit comments

Comments
 (0)