Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

js-beautify

Package Overview
Dependencies
Maintainers
2
Versions
128
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

js-beautify - npm Package Compare versions

Comparing version 1.6.8 to 1.6.9

.codeclimate.yml

84

CHANGELOG.md
# Changelog
## v1.6.9
### Description
* Fixed html formatting issue with attribute wrap (Thanks, @HookyQR!)
* Fixed python package publishing
### Closed Issues
* Wrong HTML beautification starting with v1.6.5 ([#1115](https://github.com/beautify-web/js-beautify/issues/1115))
* Ignore linebreak when meet handlebar ([#1104](https://github.com/beautify-web/js-beautify/pull/1104))
* Lines are not un-indented correctly when attributes are wrapped ([#1103](https://github.com/beautify-web/js-beautify/issues/1103))
* force-aligned is not aligned when indenting with tabs ([#1102](https://github.com/beautify-web/js-beautify/issues/1102))
* Python package fails to publish ([#1101](https://github.com/beautify-web/js-beautify/issues/1101))
* Explaination of 'operator_position' is absent from README.md ([#1047](https://github.com/beautify-web/js-beautify/issues/1047))
## v1.6.8

@@ -368,3 +384,3 @@

* Line wraps breaking numbers (causes syntax error) ([#488](https://github.com/beautify-web/js-beautify/issues/488))
* jsBeautify acts differently when handling different kinds of function expressions[BUG][javascript] ([#485](https://github.com/beautify-web/js-beautify/issues/485))
* jsBeautify acts differently when handling different kinds of function expressions ([#485](https://github.com/beautify-web/js-beautify/issues/485))
* AttributeError: 'NoneType' object has no attribute 'groups' ([#479](https://github.com/beautify-web/js-beautify/issues/479))

@@ -502,67 +518,1 @@ * installation doco for python need update -- pip install six? ([#478](https://github.com/beautify-web/js-beautify/issues/478))

## v1.3.4
### Description
1.3.3 introduced an change to function formatting. This fixes primarily that but also a few other tweaks.
### Closed Issues
* Broken indentation ([#277](https://github.com/beautify-web/js-beautify/issues/277))
* Nested inline statements (if, while, do, for) should start new line ([#276](https://github.com/beautify-web/js-beautify/issues/276))
* Bare expression followed immediately by function definition should not indent ([#275](https://github.com/beautify-web/js-beautify/issues/275))
* bug fix for "js-beautify does not create directory automatically when use '-o' parameter" ([#272](https://github.com/beautify-web/js-beautify/pull/272))
* js-beautify does not create directory automatically when use '-o' parameter ([#270](https://github.com/beautify-web/js-beautify/issues/270))
* Problem with indentation inside function ([#268](https://github.com/beautify-web/js-beautify/issues/268))
* added a deindent() function . ([#267](https://github.com/beautify-web/js-beautify/pull/267))
## v1.3.3
### Description
Another good set of fixes.
### Closed Issues
* Nested arrays indentation with --good-stuff ([#273](https://github.com/beautify-web/js-beautify/issues/273))
* Keep Array Indentation doesn't always work ([#263](https://github.com/beautify-web/js-beautify/issues/263))
* Whitespace issue with function call with object literal + other arguments. ([#262](https://github.com/beautify-web/js-beautify/issues/262))
* Implement wider fix to Indenting within parenthesis frames ([#259](https://github.com/beautify-web/js-beautify/issues/259))
* Block formatting within function call parameters. ([#258](https://github.com/beautify-web/js-beautify/issues/258))
* make python accept -w or --wrap-line-lengthmake python accept -w or --wrap-line-length ([#252](https://github.com/beautify-web/js-beautify/pull/252))
* Beautifying function call chains that end with a callback results in incorrect formatting ([#241](https://github.com/beautify-web/js-beautify/pull/241))
* Keeping New lines ([#96](https://github.com/beautify-web/js-beautify/issues/96))
## v1.3.2
### Description
Seems like there are enough features on `master` to justify a patch revision. To wit:
* Removal of `expand-strict` value for `--brace-style` option.
* Added `--space-in-paren` option.
* E4X
* Functions as sub-array literals (#246)
* Minor updates to `p_a_c_k_e_r` unpacking.
https://github.com/einars/js-beautify/compare/v1.3.1...master
### Closed Issues
* Why removed support for global object? ([#249](https://github.com/beautify-web/js-beautify/issues/249))
* Incorrect indentation of functions in array ([#246](https://github.com/beautify-web/js-beautify/issues/246))
* E4X for Python ([#243](https://github.com/beautify-web/js-beautify/issues/243))
* Single line comments on "case:" lines forced to next line ([#242](https://github.com/beautify-web/js-beautify/issues/242))
* Remove expand-strict ([#240](https://github.com/beautify-web/js-beautify/pull/240))
* empty braces should always collapse to {} on the same line ([#237](https://github.com/beautify-web/js-beautify/issues/237))
* braces "expand-strict", return { } should be on same line ([#236](https://github.com/beautify-web/js-beautify/issues/236))
* Option for different formatting of spaces in parens ([#235](https://github.com/beautify-web/js-beautify/pull/235))
* E4X ([#234](https://github.com/beautify-web/js-beautify/pull/234))
* -h option in cli.js ([#233](https://github.com/beautify-web/js-beautify/pull/233))
* Globally installed npm js-beautify will never catch .jsbeautifyrc in /home ([#228](https://github.com/beautify-web/js-beautify/issues/228))
* html conditional tag treated as open tag "<!--[if IE 8]>" ([#222](https://github.com/beautify-web/js-beautify/issues/222))
* Document package release process ([#214](https://github.com/beautify-web/js-beautify/issues/214))
* Add basic tests for beautify command line ([#209](https://github.com/beautify-web/js-beautify/issues/209))
* Index.html - "Preserve empty lines" does not describe the behavior ([#199](https://github.com/beautify-web/js-beautify/issues/199))
* Bug: <![CDATA[ ([#152](https://github.com/beautify-web/js-beautify/issues/152))
* New options proposal: spaces around arguments ([#126](https://github.com/beautify-web/js-beautify/issues/126))
* Add option to put single-statement blocks into a new line ([#116](https://github.com/beautify-web/js-beautify/issues/116))
* [Feature request] --disable-preserve-newlines to one line ([#74](https://github.com/beautify-web/js-beautify/issues/74))

@@ -46,3 +46,3 @@ # Contributing

## python
Files related to the JavaScript implmentations of the beautifiers.
Files related to the Python implmentations of the beautifiers.

@@ -49,0 +49,0 @@

@@ -304,3 +304,3 @@ /*jshint curly:true, eqeqeq:true, laxbreak:true, noempty:false */

if (this.traverse_whitespace()) {
if (handlebarsStarted < 2 && this.traverse_whitespace()) {
this.space_or_wrap(content);

@@ -494,3 +494,4 @@ continue;

for (var count = 0; count < alignment_size; count++) {
content.push(indent_character);
// only ever further indent with spaces since we're trying to align characters
content.push(' ');
}

@@ -562,6 +563,8 @@ }

if (tag_complete.indexOf('\n') !== -1) { //if there's a line break, thats where the tag name ends
// must check for space first otherwise the tag could have the first attribute included, and
// then not un-indent correctly
if (tag_complete.indexOf(' ') !== -1) { //if there's whitespace, thats where the tag name ends
tag_index = tag_complete.indexOf(' ');
} else if (tag_complete.indexOf('\n') !== -1) { //if there's a line break, thats where the tag name ends
tag_index = tag_complete.indexOf('\n');
} else if (tag_complete.indexOf(' ') !== -1) { //if there's whitespace, thats where the tag name ends
tag_index = tag_complete.indexOf(' ');
} else if (tag_complete.charAt(0) === '{') {

@@ -568,0 +571,0 @@ tag_index = tag_complete.indexOf('}');

@@ -320,9 +320,9 @@ #!/usr/bin/env node

'Beautifier Options:',
' -s, --indent-size Indentation size [4]',
' -c, --indent-char Indentation character [" "]',
' -t, --indent-with-tabs Indent with tabs, overrides -s and -c',
' -e, --eol Character(s) to use as line terminators.',
' [first newline in file, otherwise "\\n]',
' -n, --end-with-newline End output with newline',
' --editorconfig Use EditorConfig to set up the options'
' -s, --indent-size Indentation size [4]',
' -c, --indent-char Indentation character [" "]',
' -t, --indent-with-tabs Indent with tabs, overrides -s and -c',
' -e, --eol Character(s) to use as line terminators.',
' [first newline in file, otherwise "\\n]',
' -n, --end-with-newline End output with newline',
' --editorconfig Use EditorConfig to set up the options'
];

@@ -329,0 +329,0 @@

@@ -63,6 +63,9 @@ //

}
results += '---- ' + f[0] + 'input -------\n' + this.prettyprint(f[1]) + '\n';
results += '---- ' + f[0] + 'expected ----\n' + this.prettyprint(f[2]) + '\n';
results += '---- ' + f[0] + 'output ------\n' + this.prettyprint(f[3]) + '\n\n';
results += '==== ' + f[0] + '============================================================\n';
results += '---- input -------\n' + this.prettyprint(f[1]) + '\n';
results += '---- expected ----\n' + this.prettyprint(f[2]) + '\n';
results += '---- output ------\n' + this.prettyprint(f[3]) + '\n';
results += '---- expected-ws ------\n' + this.prettyprint_whitespace(f[2]) + '\n';
results += '---- output-ws ------\n' + this.prettyprint_whitespace(f[3]) + '\n';
results += '================================================================\n\n';
}

@@ -79,2 +82,10 @@ results += n_failed + ' tests failed.\n';

this.prettyprint_whitespace = function(something, quote_strings) {
return (this.prettyprint(something, quote_strings)
.replace(/\r\n/g, '\\r\n')
.replace(/\n/g, '\\n\n')
.replace(/\r/g, '\\r\n')
.replace(/ /g, '_')
.replace(/\t/g, '===|'));
};

@@ -81,0 +92,0 @@ this.prettyprint = function(something, quote_strings) {

{
"name": "js-beautify",
"version": "1.6.8",
"version": "1.6.9",
"description": "jsbeautifier.org for node",

@@ -5,0 +5,0 @@ "main": "js/index.js",

@@ -24,13 +24,13 @@ # JS Beautifier

```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.6.8/beautify.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.6.8/beautify-css.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.6.8/beautify-html.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.6.9/beautify.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.6.9/beautify-css.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.6.9/beautify-html.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.6.8/beautify.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.6.8/beautify-css.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.6.8/beautify-html.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.6.9/beautify.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.6.9/beautify-css.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.6.9/beautify-html.min.js"></script>
<script src="https://cdn.rawgit.com/beautify-web/js-beautify/v1.6.8/js/lib/beautify.js"></script>
<script src="https://cdn.rawgit.com/beautify-web/js-beautify/v1.6.8/js/lib/beautify-css.js"></script>
<script src="https://cdn.rawgit.com/beautify-web/js-beautify/v1.6.8/js/lib/beautify-html.js"></script>
<script src="https://cdn.rawgit.com/beautify-web/js-beautify/v1.6.9/js/lib/beautify.js"></script>
<script src="https://cdn.rawgit.com/beautify-web/js-beautify/v1.6.9/js/lib/beautify-css.js"></script>
<script src="https://cdn.rawgit.com/beautify-web/js-beautify/v1.6.9/js/lib/beautify-html.js"></script>
```

@@ -113,11 +113,15 @@ Disclaimer: These are free services, so there are [no uptime or support guarantees](https://github.com/rgrove/rawgit/wiki/Frequently-Asked-Questions#i-need-guaranteed-100-uptime-should-i-use-cdnrawgitcom).

-c, --indent-char Indentation character [" "]
-e, --eol character(s) to use as line terminators. (default newline - "\\n")');
-t, --indent-with-tabs Indent with tabs, overrides -s and -c
-e, --eol Character(s) to use as line terminators.
[first newline in file, otherwise "\n]
-n, --end-with-newline End output with newline
--editorconfig Use EditorConfig to set up the options
-l, --indent-level Initial indentation level [0]
-t, --indent-with-tabs Indent with tabs, overrides -s and -c
-p, --preserve-newlines Preserve line-breaks (--no-preserve-newlines disables)
-m, --max-preserve-newlines Number of line-breaks to be preserved in one chunk [10]
-P, --space-in-paren Add padding spaces within paren, ie. f( a, b )
-E, --space-in-empty-paren Add a single space inside empty paren, ie. f( )
-j, --jslint-happy Enable jslint-stricter mode
-a, --space-after-anon-function Add a space before an anonymous function's parens, ie. function ()
-b, --brace-style [collapse|expand|end-expand|none][,preserve-inline] ["collapse"]
-b, --brace-style [collapse|expand|end-expand|none][,preserve-inline] [collapse,preserve-inline]
-B, --break-chained-methods Break chained method calls across subsequent lines

@@ -128,10 +132,10 @@ -k, --keep-array-indentation Preserve array indentation

-X, --e4x Pass E4X xml literals through untouched
-n, --end-with-newline End output with newline
--good-stuff Warm the cockles of Crockford's heart
-C, --comma-first Put commas at the beginning of new line instead of end
--good-stuff Warm the cockles of Crockford's heart
--editorconfig Use EditorConfig to set up the options
-O, --operator-position Set operator position (before-newline|after-newline|preserve-newline) [before-newline]
```
These largely correspond to the underscored option keys for both library interfaces, which have these defaults:
Which correspond to the underscored option keys for both library interfaces
**defaults per CLI options**
```json

@@ -141,30 +145,37 @@ {

"indent_char": " ",
"indent_with_tabs": false,
"eol": "\n",
"end_with_newline": false,
"indent_level": 0,
"indent_with_tabs": false,
"preserve_newlines": true,
"max_preserve_newlines": 10,
"space_in_paren": false,
"space_in_empty_paren": false,
"jslint_happy": false,
"space_after_anon_function": false,
"brace_style": "collapse",
"break_chained_methods": false,
"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
"e4x": false,
"comma_first": false,
"operator_position": "before-newline"
}
```
You might notice that the CLI options and defaults hash aren't 100% correlated.
Historically, the Python and JS APIs have not been 100% identical. For example,
`space_before_conditional` is currently JS-only, and not addressable from the
CLI script. There are still a few other additional cases keeping us from
100% API-compatibility.
**defaults not exposed in the cli**
```json
{
"eval_code": false,
"space_before_conditional": true
}
```
Notice not all defaults are exposed via the CLI. Historically, the Python and
JS APIs have not been 100% identical. For example, `space_before_conditional` is
currently JS-only, and not addressable from the CLI script. There are still a
few other additional cases keeping us from 100% API-compatibility.
### Loading settings from environment or .jsbeautifyrc (JavaScript-Only)

@@ -312,2 +323,2 @@

(README.md: js-beautify@1.6.8)
(README.md: js-beautify@1.6.9)

@@ -284,2 +284,30 @@ /*

}, {
name: "Attribute Wrap alignment with spaces",
description: "Ensure attributes are internally aligned with spaces when the indent_character is set to tab",
matrix: [{
options: [
{ name: "wrap_attributes", value: "'force-aligned'" },
{ name: "indent_with_tabs", value: "true" }
]
}],
tests: [{
fragment: true,
input: '<div><div a="1" b="2"><div>test</div></div></div>',
output: '<div>\n\t<div a="1"\n\t b="2">\n\t\t<div>test</div>\n\t</div>\n</div>'
}]
}, {
name: "Attribute Wrap de-indent",
description: "Tags de-indent when attributes are wrapped",
matrix: [{
options: [
{ name: "wrap_attributes", value: "'force-aligned'" },
{ name: "indent_with_tabs", value: "false" }
]
}],
tests: [{
fragement: true,
input: '<div a="1" b="2"><div>test</div></div>',
output: '<div a="1"\n b="2">\n <div>test</div>\n</div>'
}]
}, {
name: "Attribute Wrap",

@@ -510,2 +538,8 @@ description: "Wraps attributes inside of html tags",

content: '{{!-- \\n mult-line\\ncomment \\n{{#> component}}\\n mult-line\\ncomment \\n with spacing\\n {{/ component}}--}}'
}, {
options: [
{ name: "indent_handlebars", value: "true" },
{ name: "wrap_line_length", value: "80" }
],
content: 'content'
}],

@@ -675,2 +709,5 @@ tests: [

unchanged: '<span>{{condition < 0 ? "result1" : "result2"}}</span>'
}, {
fragment: true,
unchanged: '<span>{{condition1 && condition2 && condition3 && condition4 < 0 ? "resForTrue" : "resForFalse"}}</span>'
}

@@ -677,0 +714,0 @@ ],

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc