From 3e36972c57660da16768d170d463c64f4c763008 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Wed, 17 Jun 2015 04:06:48 -0400 Subject: [PATCH 1/3] Added js-beautify\js-beautify.d.ts Options sourced from https://github.com/beautify-web/js-beautify. --- js-beautify/js-beautify.d.ts | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 js-beautify/js-beautify.d.ts diff --git a/js-beautify/js-beautify.d.ts b/js-beautify/js-beautify.d.ts new file mode 100644 index 000000000..87ede5737 --- /dev/null +++ b/js-beautify/js-beautify.d.ts @@ -0,0 +1,29 @@ +// Type definitions for js_beautify +// Project: https://github.com/beautify-web/js-beautify/ +// Definitions by: Josh Goldberg +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare var js_beautify: { + (js_source_text: string, options?: { + "indent_size"?: number; + "indent_char"?: string; + "eol"?: string; + "indent_level"?: number; + "indent_width_tabs"?: boolean; + "preserve_newlines"?: boolean; + "max_preserve_newlines"?: number; + "jslint_happy": boolean; + "space_after_anon_function": boolean; + "brace_style": string; + "keep_array_indentation": boolean; + "keep_function_indentation": boolean; + "space_before_conditional": boolean; + "break_chained_methods": boolean; + "eval_code": boolean; + "unescape_strings": boolean; + "wrap_line_length": number; + "wrap_attributes": string; + "wrap_attributes_indent_size": number; + "end_with_newline": boolean; + }): string; +}; From fe73bb68e7e2ff417eacb37d23887b29975d5abd Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Wed, 17 Jun 2015 04:09:21 -0400 Subject: [PATCH 2/3] Added js-beautify unit tests There are only two: a simple string for the basic usage, and a full string for the full usage. This should trigger Travis CI. --- js-beautify/js-beautify-tests.ts | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 js-beautify/js-beautify-tests.ts diff --git a/js-beautify/js-beautify-tests.ts b/js-beautify/js-beautify-tests.ts new file mode 100644 index 000000000..bcd431c2b --- /dev/null +++ b/js-beautify/js-beautify-tests.ts @@ -0,0 +1,28 @@ +/// + +var simple: string = js_beautify("console.log('Hello world!');"); + +var full: string = js_beautify( + "console.log('Hello world!');", + { + "indent_size": 4, + "indent_char": " ", + "eol": "\n", + "indent_level": 0, + "indent_with_tabs": false, + "preserve_newlines": true, + "max_preserve_newlines": 10, + "jslint_happy": false, + "space_after_anon_function": false, + "brace_style": "collapse", + "keep_array_indentation": false, + "keep_function_indentation": false, + "space_before_conditional": true, + "break_chained_methods": false, + "eval_code": false, + "unescape_strings": false, + "wrap_line_length": 0, + "wrap_attributes": "auto", + "wrap_attributes_indent_size": 4, + "end_with_newline": false + }); From e7046a1b8598bb1d65d57d7f07bfbee48c1d3c6f Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Wed, 17 Jun 2015 05:24:12 -0400 Subject: [PATCH 3/3] Removed quotes from d.ts As requested in https://github.com/borisyankov/DefinitelyTyped/pull/4658/files#r32606502 --- js-beautify/js-beautify.d.ts | 40 ++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/js-beautify/js-beautify.d.ts b/js-beautify/js-beautify.d.ts index 87ede5737..e52614ad8 100644 --- a/js-beautify/js-beautify.d.ts +++ b/js-beautify/js-beautify.d.ts @@ -5,25 +5,25 @@ declare var js_beautify: { (js_source_text: string, options?: { - "indent_size"?: number; - "indent_char"?: string; - "eol"?: string; - "indent_level"?: number; - "indent_width_tabs"?: boolean; - "preserve_newlines"?: boolean; - "max_preserve_newlines"?: number; - "jslint_happy": boolean; - "space_after_anon_function": boolean; - "brace_style": string; - "keep_array_indentation": boolean; - "keep_function_indentation": boolean; - "space_before_conditional": boolean; - "break_chained_methods": boolean; - "eval_code": boolean; - "unescape_strings": boolean; - "wrap_line_length": number; - "wrap_attributes": string; - "wrap_attributes_indent_size": number; - "end_with_newline": boolean; + indent_size?: number; + indent_char?: string; + eol?: string; + indent_level?: number; + indent_width_tabs?: boolean; + preserve_newlines?: boolean; + max_preserve_newlines?: number; + jslint_happy: boolean; + space_after_anon_function: boolean; + brace_style: string; + keep_array_indentation: boolean; + keep_function_indentation: boolean; + space_before_conditional: boolean; + break_chained_methods: boolean; + eval_code: boolean; + unescape_strings: boolean; + wrap_line_length: number; + wrap_attributes: string; + wrap_attributes_indent_size: number; + end_with_newline: boolean; }): string; };