diff -Nru node-js-beautify-1.13.5+dfsg+~0.15.3/CHANGELOG.md node-js-beautify-1.13.6+dfsg+~0.15.3/CHANGELOG.md --- node-js-beautify-1.13.5+dfsg+~0.15.3/CHANGELOG.md 2021-01-12 19:44:55.000000000 +0000 +++ node-js-beautify-1.13.6+dfsg+~0.15.3/CHANGELOG.md 2021-01-26 17:37:55.000000000 +0000 @@ -1,4 +1,14 @@ # Changelog +## v1.13.6 + +### Description + + +### Closed Issues +* Fix space-before-conditional: false to work on switch-case statement ([#1881](https://github.com/beautify-web/js-beautify/pull/1881)) +* Optional chaining obj?.[expr] ([#1801](https://github.com/beautify-web/js-beautify/issues/1801)) + + ## v1.13.5 ### Description diff -Nru node-js-beautify-1.13.5+dfsg+~0.15.3/debian/changelog node-js-beautify-1.13.6+dfsg+~0.15.3/debian/changelog --- node-js-beautify-1.13.5+dfsg+~0.15.3/debian/changelog 2021-01-15 07:18:23.000000000 +0000 +++ node-js-beautify-1.13.6+dfsg+~0.15.3/debian/changelog 2021-01-27 14:22:42.000000000 +0000 @@ -1,3 +1,10 @@ +node-js-beautify (1.13.6+dfsg+~0.15.3-1) unstable; urgency=medium + + * Team upload + * New upstream version 1.13.6+dfsg+~0.15.3 + + -- Xavier Guimard Wed, 27 Jan 2021 15:22:42 +0100 + node-js-beautify (1.13.5+dfsg+~0.15.3-1) unstable; urgency=medium * Team upload diff -Nru node-js-beautify-1.13.5+dfsg+~0.15.3/js/src/javascript/beautifier.js node-js-beautify-1.13.6+dfsg+~0.15.3/js/src/javascript/beautifier.js --- node-js-beautify-1.13.5+dfsg+~0.15.3/js/src/javascript/beautifier.js 2021-01-12 19:44:55.000000000 +0000 +++ node-js-beautify-1.13.6+dfsg+~0.15.3/js/src/javascript/beautifier.js 2021-01-26 17:37:55.000000000 +0000 @@ -546,7 +546,7 @@ } } - if (!in_array(this._flags.last_token.type, [TOKEN.START_EXPR, TOKEN.END_EXPR, TOKEN.WORD, TOKEN.OPERATOR])) { + if (!in_array(this._flags.last_token.type, [TOKEN.START_EXPR, TOKEN.END_EXPR, TOKEN.WORD, TOKEN.OPERATOR, TOKEN.DOT])) { this._output.space_before_token = true; } } else { @@ -554,7 +554,7 @@ if (this._flags.last_token.text === 'for') { this._output.space_before_token = this._options.space_before_conditional; next_mode = MODE.ForInitializer; - } else if (in_array(this._flags.last_token.text, ['if', 'while'])) { + } else if (in_array(this._flags.last_token.text, ['if', 'while', 'switch'])) { this._output.space_before_token = this._options.space_before_conditional; next_mode = MODE.Conditional; } else if (in_array(this._flags.last_word, ['await', 'async'])) { diff -Nru node-js-beautify-1.13.5+dfsg+~0.15.3/js/test/generated/beautify-javascript-tests.js node-js-beautify-1.13.6+dfsg+~0.15.3/js/test/generated/beautify-javascript-tests.js --- node-js-beautify-1.13.5+dfsg+~0.15.3/js/test/generated/beautify-javascript-tests.js 2021-01-12 19:44:55.000000000 +0000 +++ node-js-beautify-1.13.6+dfsg+~0.15.3/js/test/generated/beautify-javascript-tests.js 2021-01-26 17:37:55.000000000 +0000 @@ -4481,6 +4481,7 @@ 'do\n' + ' c();\n' + 'while(a) b()'); + bt('switch(a) b()'); bt( 'if(a)\n' + 'b();', @@ -4501,6 +4502,12 @@ 'do\n' + ' c();\n' + 'while(a);'); + bt( + 'switch(a)\n' + + 'b()', + // -- output -- + 'switch(a)\n' + + ' b()'); bt('return [];'); bt('return ();'); @@ -4514,6 +4521,7 @@ 'do\n' + ' c();\n' + 'while (a) b()'); + bt('switch (a) b()'); bt( 'if(a)\n' + 'b();', @@ -4534,6 +4542,12 @@ 'do\n' + ' c();\n' + 'while (a);'); + bt( + 'switch(a)\n' + + 'b()', + // -- output -- + 'switch (a)\n' + + ' b()'); bt('return [];'); bt('return ();'); @@ -6975,6 +6989,11 @@ ' new Date().getTime()\n' + '].join("-");'); + // Issue 1801 - Optional chaining w/ obj?.[expr] syntax + bt( + 'let nestedProp = obj?.["prop" + "Name"];\n' + + 'let arrayItem = arr?.[42];'); + // Issue 1374 - Parameters starting with ! or [ merged into single line bt( 'fn(\n' + diff -Nru node-js-beautify-1.13.5+dfsg+~0.15.3/package.json node-js-beautify-1.13.6+dfsg+~0.15.3/package.json --- node-js-beautify-1.13.5+dfsg+~0.15.3/package.json 2021-01-12 19:44:55.000000000 +0000 +++ node-js-beautify-1.13.6+dfsg+~0.15.3/package.json 2021-01-26 17:37:55.000000000 +0000 @@ -1,6 +1,6 @@ { "name": "js-beautify", - "version": "1.13.5", + "version": "1.13.6", "description": "beautifier.io for node", "main": "js/index.js", "bin": { diff -Nru node-js-beautify-1.13.5+dfsg+~0.15.3/package-lock.json node-js-beautify-1.13.6+dfsg+~0.15.3/package-lock.json --- node-js-beautify-1.13.5+dfsg+~0.15.3/package-lock.json 2021-01-12 19:44:55.000000000 +0000 +++ node-js-beautify-1.13.6+dfsg+~0.15.3/package-lock.json 2021-01-26 17:37:55.000000000 +0000 @@ -1,6 +1,6 @@ { "name": "js-beautify", - "version": "1.13.5", + "version": "1.13.6", "lockfileVersion": 1, "requires": true, "dependencies": { diff -Nru node-js-beautify-1.13.5+dfsg+~0.15.3/README.md node-js-beautify-1.13.6+dfsg+~0.15.3/README.md --- node-js-beautify-1.13.5+dfsg+~0.15.3/README.md 2021-01-12 19:44:55.000000000 +0000 +++ node-js-beautify-1.13.6+dfsg+~0.15.3/README.md 2021-01-26 17:37:55.000000000 +0000 @@ -61,17 +61,17 @@ To pull the latest version from one of these services include one set of the script tags below in your document: ```html - - - - - - - - - - - + + + + + + + + + + + ``` Older versions are available by changing the version number. @@ -404,4 +404,4 @@ Vasilevsky, Vital Batmanov, Ron Baldwin, Gabriel Harrison, Chris J. Shull, Mathias Bynens, Vittorio Gambaletta and others. -(README.md: js-beautify@1.13.5) +(README.md: js-beautify@1.13.6) diff -Nru node-js-beautify-1.13.5+dfsg+~0.15.3/test/data/javascript/tests.js node-js-beautify-1.13.6+dfsg+~0.15.3/test/data/javascript/tests.js --- node-js-beautify-1.13.5+dfsg+~0.15.3/test/data/javascript/tests.js 2021-01-12 19:44:55.000000000 +0000 +++ node-js-beautify-1.13.6+dfsg+~0.15.3/test/data/javascript/tests.js 2021-01-26 17:37:55.000000000 +0000 @@ -2576,6 +2576,7 @@ { unchanged: 'if{{s}}(a) b()' }, { unchanged: 'while{{s}}(a) b()' }, { unchanged: 'do\n c();\nwhile{{s}}(a) b()' }, + { unchanged: 'switch{{s}}(a) b()' }, { input: 'if(a)\nb();', output: 'if{{s}}(a)\n b();' @@ -2588,6 +2589,10 @@ input: 'do\nc();\nwhile(a);', output: 'do\n c();\nwhile{{s}}(a);' }, + { + input: 'switch(a)\nb()', + output: 'switch{{s}}(a)\n b()' + }, { unchanged: 'return [];' }, { unchanged: 'return ();' } ] @@ -3775,6 +3780,13 @@ ] }, { + comment: "Issue 1801 - Optional chaining w/ obj?.[expr] syntax", + unchanged: [ + 'let nestedProp = obj?.["prop" + "Name"];', + 'let arrayItem = arr?.[42];' + ] + }, + { comment: "Issue 1374 - Parameters starting with ! or [ merged into single line", unchanged: [ 'fn(',