js-beautify 1.7.3 → 1.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +137 -0
- package/CONTRIBUTING.md +3 -3
- package/README.md +15 -12
- package/js/lib/beautify-html.js +1 -1
- package/js/lib/beautify.js +2 -2
- package/js/lib/cli.js +1 -1
- package/js/src/javascript/beautifier.js +2 -2
- package/js/test/generated/beautify-javascript-tests.js +38 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,31 @@
|
|
|
1
1
|
# Changelog
|
|
2
|
+
## v1.7.4
|
|
3
|
+
|
|
4
|
+
### Description
|
|
5
|
+
Thanks @cejast for contributing!
|
|
6
|
+
|
|
7
|
+
### Closed Issues
|
|
8
|
+
* Whitespace after ES7 `async` keyword for arrow functions ([#896](https://github.com/beautify-web/js-beautify/issues/896))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## v1.7.3
|
|
12
|
+
|
|
13
|
+
### Description
|
|
14
|
+
* Fixed broken installs
|
|
15
|
+
|
|
16
|
+
Lessons learned:
|
|
17
|
+
* Don't publish and go to bed.
|
|
18
|
+
* I thought I had sufficient test coverage and I did not. Tests will be implemented to protect against this before the next release (#1254).
|
|
19
|
+
* Also, this break highlights the need to create a beta channel for releases and a way to request feedback on beta releases (#1255).
|
|
20
|
+
* The project has been maintained by mostly one person over the past year or so, with some additions by other individuals. This break also highlights the need for this project to have a few more people who have the ability address issues/emergencies (#1256).
|
|
21
|
+
* Many projects do not not lock or even limit their version dependencies. Those that do often use `^x.x.x` instead of `~x.x.x`. Consider switching to making major version updates under more circumstances to limit risk to dependent projects. (#1257)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Closed Issues
|
|
25
|
+
* Version 1.7.0 fail to install through pip ([#1250](https://github.com/beautify-web/js-beautify/issues/1250))
|
|
26
|
+
* Installing js-beautify fails ([#1247](https://github.com/beautify-web/js-beautify/issues/1247))
|
|
27
|
+
|
|
28
|
+
|
|
2
29
|
## v1.7.0
|
|
3
30
|
|
|
4
31
|
### Description
|
|
@@ -297,6 +324,21 @@ Version jump due to release script tweaks
|
|
|
297
324
|
|
|
298
325
|
|
|
299
326
|
### Closed Issues
|
|
327
|
+
* Fix tokenizer's bracket pairs' open stack ([#693](https://github.com/beautify-web/js-beautify/pull/693))
|
|
328
|
+
* Indentation is incorrect for HTML5 void tag <source> ([#692](https://github.com/beautify-web/js-beautify/issues/692))
|
|
329
|
+
* Line wrapping breaks at the wrong place when the line is indented. ([#691](https://github.com/beautify-web/js-beautify/issues/691))
|
|
330
|
+
* Publish v1.5.6 ([#687](https://github.com/beautify-web/js-beautify/issues/687))
|
|
331
|
+
* Replace existing file fails using python beautifier ([#686](https://github.com/beautify-web/js-beautify/issues/686))
|
|
332
|
+
* Pseudo-classes formatted incorrectly and inconsistently with @page ([#661](https://github.com/beautify-web/js-beautify/issues/661))
|
|
333
|
+
* doc: add end_with_newline option ([#650](https://github.com/beautify-web/js-beautify/pull/650))
|
|
334
|
+
* Improve support for xml parts of jsx (React) => spaces, spread attributes and nested objects break the process ([#646](https://github.com/beautify-web/js-beautify/issues/646))
|
|
335
|
+
* html-beautify formats handlebars comments but does not format html comments ([#635](https://github.com/beautify-web/js-beautify/issues/635))
|
|
336
|
+
* Support for ES7 async ([#630](https://github.com/beautify-web/js-beautify/issues/630))
|
|
337
|
+
* css beautify adding an extra newline after a comment line in a css block ([#609](https://github.com/beautify-web/js-beautify/issues/609))
|
|
338
|
+
* No option to "Indent with tabs" for HTML files ([#587](https://github.com/beautify-web/js-beautify/issues/587))
|
|
339
|
+
* Function body is indented when followed by a comment ([#583](https://github.com/beautify-web/js-beautify/issues/583))
|
|
340
|
+
* JSX support ([#425](https://github.com/beautify-web/js-beautify/issues/425))
|
|
341
|
+
* Alternative Newline Characters ([#260](https://github.com/beautify-web/js-beautify/issues/260))
|
|
300
342
|
|
|
301
343
|
|
|
302
344
|
## v1.5.5
|
|
@@ -309,6 +351,21 @@ Version jump due to release script tweaks
|
|
|
309
351
|
* General bug fixing
|
|
310
352
|
|
|
311
353
|
### Closed Issues
|
|
354
|
+
* Add GUI support for `--indent-inner-html`. ([#633](https://github.com/beautify-web/js-beautify/pull/633))
|
|
355
|
+
* Publish v1.5.5 ([#629](https://github.com/beautify-web/js-beautify/issues/629))
|
|
356
|
+
* CSS: Updating the documentation for the 'newline_between_rules' ([#615](https://github.com/beautify-web/js-beautify/pull/615))
|
|
357
|
+
* Equal Sign Removed from Filter Properties Alpha Opacity Assignment ([#599](https://github.com/beautify-web/js-beautify/issues/599))
|
|
358
|
+
* Keep trailing spaces on comments ([#598](https://github.com/beautify-web/js-beautify/issues/598))
|
|
359
|
+
* only print the file names of changed files ([#597](https://github.com/beautify-web/js-beautify/issues/597))
|
|
360
|
+
* CSS: support add newline between rules ([#574](https://github.com/beautify-web/js-beautify/pull/574))
|
|
361
|
+
* elem[array]++ changes to elem[array] ++ inserting unnecessary gap ([#570](https://github.com/beautify-web/js-beautify/issues/570))
|
|
362
|
+
* add support to less functions paramters braces ([#568](https://github.com/beautify-web/js-beautify/pull/568))
|
|
363
|
+
* selector_separator_newline: true for Sass doesn't work ([#563](https://github.com/beautify-web/js-beautify/issues/563))
|
|
364
|
+
* yield statements are being beautified to their own newlines since 1.5.2 ([#560](https://github.com/beautify-web/js-beautify/issues/560))
|
|
365
|
+
* HTML beautifier inserts extra newline into `<li>`s ending with `<code>` ([#524](https://github.com/beautify-web/js-beautify/issues/524))
|
|
366
|
+
* Add wrap_attributes option ([#476](https://github.com/beautify-web/js-beautify/issues/476))
|
|
367
|
+
* Add or preserve empty line between CSS rules ([#467](https://github.com/beautify-web/js-beautify/issues/467))
|
|
368
|
+
* Support comma first style of variable declaration ([#245](https://github.com/beautify-web/js-beautify/issues/245))
|
|
312
369
|
|
|
313
370
|
|
|
314
371
|
## v1.5.4
|
|
@@ -320,6 +377,12 @@ Version jump due to release script tweaks
|
|
|
320
377
|
https://github.com/beautify-web/js-beautify/compare/v1.5.3...v1.5.4
|
|
321
378
|
|
|
322
379
|
### Closed Issues
|
|
380
|
+
* TypeScript oddly formatted with 1.5.3 ([#552](https://github.com/beautify-web/js-beautify/issues/552))
|
|
381
|
+
* HTML beautifier inserts double spaces between adjacent tags ([#525](https://github.com/beautify-web/js-beautify/issues/525))
|
|
382
|
+
* Keep space in font rule ([#491](https://github.com/beautify-web/js-beautify/issues/491))
|
|
383
|
+
* [Brackets plug in] Space after </a> disappears ([#454](https://github.com/beautify-web/js-beautify/issues/454))
|
|
384
|
+
* Support nested pseudo-classes and parent reference (LESS) ([#427](https://github.com/beautify-web/js-beautify/pull/427))
|
|
385
|
+
* Alternate approach: preserve single spacing and treat img as inline element ([#415](https://github.com/beautify-web/js-beautify/pull/415))
|
|
323
386
|
|
|
324
387
|
|
|
325
388
|
## v1.5.3
|
|
@@ -332,6 +395,20 @@ https://github.com/beautify-web/js-beautify/compare/v1.5.3...v1.5.4
|
|
|
332
395
|
https://github.com/beautify-web/js-beautify/compare/v1.5.2...v1.5.3
|
|
333
396
|
|
|
334
397
|
### Closed Issues
|
|
398
|
+
* [TypeError: Cannot read property 'type' of undefined] ([#548](https://github.com/beautify-web/js-beautify/issues/548))
|
|
399
|
+
* Bug with RegExp ([#547](https://github.com/beautify-web/js-beautify/issues/547))
|
|
400
|
+
* Odd behaviour on less ([#520](https://github.com/beautify-web/js-beautify/issues/520))
|
|
401
|
+
* css beauitify ([#506](https://github.com/beautify-web/js-beautify/issues/506))
|
|
402
|
+
* Extra space after scss pseudo classes. ([#500](https://github.com/beautify-web/js-beautify/issues/500))
|
|
403
|
+
* Generates invalid scss when formatting ampersand selectors ([#498](https://github.com/beautify-web/js-beautify/issues/498))
|
|
404
|
+
* bad formatting of .less files using @variable or &:hover syntax ([#489](https://github.com/beautify-web/js-beautify/issues/489))
|
|
405
|
+
* Incorrect beautifying of CSS comment including an url. ([#466](https://github.com/beautify-web/js-beautify/issues/466))
|
|
406
|
+
* Handle SASS parent reference &: ([#414](https://github.com/beautify-web/js-beautify/issues/414))
|
|
407
|
+
* Js-beautify breaking selectors in less code. ([#410](https://github.com/beautify-web/js-beautify/issues/410))
|
|
408
|
+
* Problem with "content" ([#364](https://github.com/beautify-web/js-beautify/issues/364))
|
|
409
|
+
* Space gets inserted between function and paren for function in Define ([#313](https://github.com/beautify-web/js-beautify/issues/313))
|
|
410
|
+
* beautify-html returns null on broken html ([#301](https://github.com/beautify-web/js-beautify/issues/301))
|
|
411
|
+
* Indentation of functions inside conditionals not passing jslint ([#298](https://github.com/beautify-web/js-beautify/issues/298))
|
|
335
412
|
|
|
336
413
|
|
|
337
414
|
## v1.5.2
|
|
@@ -355,6 +432,36 @@ https://github.com/beautify-web/js-beautify/compare/v1.5.2...v1.5.3
|
|
|
355
432
|
https://github.com/beautify-web/js-beautify/compare/v1.5.1...v1.5.2
|
|
356
433
|
|
|
357
434
|
### Closed Issues
|
|
435
|
+
* Allow custom elements to be unformatted ([#540](https://github.com/beautify-web/js-beautify/pull/540))
|
|
436
|
+
* Need option to ignore brace style ([#538](https://github.com/beautify-web/js-beautify/issues/538))
|
|
437
|
+
* Refactor to Output and OutputLine classes ([#536](https://github.com/beautify-web/js-beautify/pull/536))
|
|
438
|
+
* Recognize ObjectLiteral on open brace ([#535](https://github.com/beautify-web/js-beautify/pull/535))
|
|
439
|
+
* Refactor to fully tokenize before formatting ([#530](https://github.com/beautify-web/js-beautify/pull/530))
|
|
440
|
+
* Cleanup checked in six.py file ([#527](https://github.com/beautify-web/js-beautify/pull/527))
|
|
441
|
+
* Changelog.md? ([#526](https://github.com/beautify-web/js-beautify/issues/526))
|
|
442
|
+
* New line added between each css declaration ([#523](https://github.com/beautify-web/js-beautify/issues/523))
|
|
443
|
+
* Kendo Template scripts get messed up! ([#516](https://github.com/beautify-web/js-beautify/issues/516))
|
|
444
|
+
* SyntaxError: Unexpected token ++ ([#514](https://github.com/beautify-web/js-beautify/issues/514))
|
|
445
|
+
* space appears before open square bracket when the object name is "set" ([#508](https://github.com/beautify-web/js-beautify/issues/508))
|
|
446
|
+
* Unclosed string problem ([#505](https://github.com/beautify-web/js-beautify/issues/505))
|
|
447
|
+
* "--n" and "++n" are not indented like "n--" and "n++" are... ([#495](https://github.com/beautify-web/js-beautify/issues/495))
|
|
448
|
+
* Allow `<style>` and `<script>` tags to be unformatted ([#494](https://github.com/beautify-web/js-beautify/pull/494))
|
|
449
|
+
* Preserve new line at end of file ([#492](https://github.com/beautify-web/js-beautify/issues/492))
|
|
450
|
+
* Line wraps breaking numbers (causes syntax error) ([#488](https://github.com/beautify-web/js-beautify/issues/488))
|
|
451
|
+
* jsBeautify acts differently when handling different kinds of function expressions ([#485](https://github.com/beautify-web/js-beautify/issues/485))
|
|
452
|
+
* AttributeError: 'NoneType' object has no attribute 'groups' ([#479](https://github.com/beautify-web/js-beautify/issues/479))
|
|
453
|
+
* installation doco for python need update -- pip install six? ([#478](https://github.com/beautify-web/js-beautify/issues/478))
|
|
454
|
+
* Move einars/js-beautify to beautify-web/js-beautify ([#475](https://github.com/beautify-web/js-beautify/issues/475))
|
|
455
|
+
* Bring back space_after_anon_function ([#474](https://github.com/beautify-web/js-beautify/pull/474))
|
|
456
|
+
* fix for #453, Incompatible handlebar syntax ([#468](https://github.com/beautify-web/js-beautify/pull/468))
|
|
457
|
+
* Python: missing explicit dependency on "six" package ([#465](https://github.com/beautify-web/js-beautify/issues/465))
|
|
458
|
+
* function declaration inside array, adds extra line. ([#464](https://github.com/beautify-web/js-beautify/issues/464))
|
|
459
|
+
* [es6] yield a array ([#458](https://github.com/beautify-web/js-beautify/issues/458))
|
|
460
|
+
* Publish v1.5.2 ([#452](https://github.com/beautify-web/js-beautify/issues/452))
|
|
461
|
+
* Port css colon character fix to python ([#446](https://github.com/beautify-web/js-beautify/issues/446))
|
|
462
|
+
* Cannot declare object literal properties with unquoted reserved words ([#440](https://github.com/beautify-web/js-beautify/issues/440))
|
|
463
|
+
* Do not put a space within `function*` generator functions. ([#428](https://github.com/beautify-web/js-beautify/issues/428))
|
|
464
|
+
* beautification of "nth-child" css fails csslint ([#418](https://github.com/beautify-web/js-beautify/issues/418))
|
|
358
465
|
|
|
359
466
|
|
|
360
467
|
## v1.5.1
|
|
@@ -373,5 +480,35 @@ Highlights:
|
|
|
373
480
|
https://github.com/einars/js-beautify/compare/v1.4.2...v1.5.1
|
|
374
481
|
|
|
375
482
|
### Closed Issues
|
|
483
|
+
* Nested if statements not displayed correctly ([#450](https://github.com/beautify-web/js-beautify/issues/450))
|
|
484
|
+
* preserve_newlines always true ([#449](https://github.com/beautify-web/js-beautify/issues/449))
|
|
485
|
+
* line wrapping breaks in weird places ([#438](https://github.com/beautify-web/js-beautify/issues/438))
|
|
486
|
+
* Update dependencies to current versions ([#437](https://github.com/beautify-web/js-beautify/pull/437))
|
|
487
|
+
* Add support for ES6 template strings ([#434](https://github.com/beautify-web/js-beautify/pull/434))
|
|
488
|
+
* Fix #402: support ES6 fat arrow ([#433](https://github.com/beautify-web/js-beautify/pull/433))
|
|
489
|
+
* Ending brace missaligned when part of first definition in var line ([#430](https://github.com/beautify-web/js-beautify/issues/430))
|
|
490
|
+
* fixing disabled line wrapping for HTML ([#429](https://github.com/beautify-web/js-beautify/pull/429))
|
|
491
|
+
* Missing semi colon ([#420](https://github.com/beautify-web/js-beautify/issues/420))
|
|
492
|
+
* Fixed require.js support ([#416](https://github.com/beautify-web/js-beautify/pull/416))
|
|
493
|
+
* should not split the es6 operator '=>' ([#402](https://github.com/beautify-web/js-beautify/issues/402))
|
|
494
|
+
* fixed relative paths for require.js ([#387](https://github.com/beautify-web/js-beautify/pull/387))
|
|
495
|
+
* Support reserved words as property names ([#378](https://github.com/beautify-web/js-beautify/issues/378))
|
|
496
|
+
* Make the AMD API match the rest of the APIs ([#376](https://github.com/beautify-web/js-beautify/pull/376))
|
|
497
|
+
* Preserve newlines in html related to issue #307 ([#375](https://github.com/beautify-web/js-beautify/pull/375))
|
|
498
|
+
* Multi-line statements ([#374](https://github.com/beautify-web/js-beautify/issues/374))
|
|
499
|
+
* Reserved words used as property/function/variable identifiers are formatted incorrectly ([#368](https://github.com/beautify-web/js-beautify/issues/368))
|
|
500
|
+
* fixed problems with colon character ([#363](https://github.com/beautify-web/js-beautify/pull/363))
|
|
501
|
+
* require.JS paths are hardcoded in beautify-html.js ([#359](https://github.com/beautify-web/js-beautify/issues/359))
|
|
502
|
+
* Regression in p.a.c.ked file detection ([#357](https://github.com/beautify-web/js-beautify/issues/357))
|
|
503
|
+
* Fix Issue #339 ([#354](https://github.com/beautify-web/js-beautify/pull/354))
|
|
504
|
+
* Added single line comment support in less/sass for javascript parser ([#353](https://github.com/beautify-web/js-beautify/pull/353))
|
|
505
|
+
* Function named 'in' not formatting correctly ([#351](https://github.com/beautify-web/js-beautify/issues/351))
|
|
506
|
+
* CSS Pseudo element ([#346](https://github.com/beautify-web/js-beautify/issues/346))
|
|
507
|
+
* array closing brace error for return statements with keep_array_indentation ([#340](https://github.com/beautify-web/js-beautify/issues/340))
|
|
508
|
+
* CSS Beautifier: breaks :before and :after (regression) ([#339](https://github.com/beautify-web/js-beautify/issues/339))
|
|
509
|
+
* Publish v1.5.0 ([#335](https://github.com/beautify-web/js-beautify/issues/335))
|
|
510
|
+
* "keep array indentation" not working ([#333](https://github.com/beautify-web/js-beautify/issues/333))
|
|
511
|
+
* CSS Beautifier: support LESS/SASS line comments ([#326](https://github.com/beautify-web/js-beautify/issues/326))
|
|
512
|
+
* Incorrect formating with semicolon-less code ([#323](https://github.com/beautify-web/js-beautify/issues/323))
|
|
376
513
|
|
|
377
514
|
|
package/CONTRIBUTING.md
CHANGED
|
@@ -93,10 +93,10 @@ Each platform has it's own release process.
|
|
|
93
93
|
|
|
94
94
|
NOTE: Before you do any of these make sure the latest changes have passed the travis-ci build!
|
|
95
95
|
|
|
96
|
-
##Web
|
|
96
|
+
## Web
|
|
97
97
|
Merge changes from `master` to `gh-pages` branch. This is very low cost and can be done whenever is convenient.
|
|
98
98
|
|
|
99
|
-
##Python
|
|
99
|
+
## Python
|
|
100
100
|
NOTE: For now, we'd like to keep python and node version numbers synchronized,
|
|
101
101
|
so if you publish a python release, you should publish a node release as well.
|
|
102
102
|
|
|
@@ -118,7 +118,7 @@ python setup.py sdist bdist_wininst upload
|
|
|
118
118
|
git push
|
|
119
119
|
```
|
|
120
120
|
|
|
121
|
-
##Node
|
|
121
|
+
## Node
|
|
122
122
|
NOTE: For now, we'd like to keep python and node version numbers synchronized,
|
|
123
123
|
so if you plan to publish a node release, you should publish a python release *first*,
|
|
124
124
|
then perform the steps below.
|
package/README.md
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
# JS Beautifier
|
|
2
|
-
[](http://travis-ci.org/beautify-web/js-beautify)
|
|
3
3
|
[](https://ci.appveyor.com/project/beautify-web/js-beautify/branch/master)
|
|
4
|
+
|
|
5
|
+
[](https://pypi.python.org/pypi/jsbeautifier)
|
|
4
6
|
[](https://cdnjs.com/libraries/js-beautify)
|
|
5
7
|
[](https://www.npmjs.com/package/js-beautify)
|
|
6
8
|
[](https://www.npmjs.com/package/js-beautify)
|
|
9
|
+
|
|
7
10
|
[](https://gitter.im/beautify-web/js-beautify?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
|
8
11
|
|
|
9
12
|
[](https://www.npmjs.org/package/js-beautify)
|
|
@@ -21,17 +24,17 @@ JS Beautifier is hosted on two CDN services: [cdnjs](https://cdnjs.com/libraries
|
|
|
21
24
|
|
|
22
25
|
To pull from one of these services include one set of the script tags below in your document:
|
|
23
26
|
```html
|
|
24
|
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.7.
|
|
25
|
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.7.
|
|
26
|
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.7.
|
|
27
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.7.4/beautify.js"></script>
|
|
28
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.7.4/beautify-css.js"></script>
|
|
29
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.7.4/beautify-html.js"></script>
|
|
27
30
|
|
|
28
|
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.7.
|
|
29
|
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.7.
|
|
30
|
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.7.
|
|
31
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.7.4/beautify.min.js"></script>
|
|
32
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.7.4/beautify-css.min.js"></script>
|
|
33
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.7.4/beautify-html.min.js"></script>
|
|
31
34
|
|
|
32
|
-
<script src="https://cdn.rawgit.com/beautify-web/js-beautify/v1.7.
|
|
33
|
-
<script src="https://cdn.rawgit.com/beautify-web/js-beautify/v1.7.
|
|
34
|
-
<script src="https://cdn.rawgit.com/beautify-web/js-beautify/v1.7.
|
|
35
|
+
<script src="https://cdn.rawgit.com/beautify-web/js-beautify/v1.7.4/js/lib/beautify.js"></script>
|
|
36
|
+
<script src="https://cdn.rawgit.com/beautify-web/js-beautify/v1.7.4/js/lib/beautify-css.js"></script>
|
|
37
|
+
<script src="https://cdn.rawgit.com/beautify-web/js-beautify/v1.7.4/js/lib/beautify-html.js"></script>
|
|
35
38
|
```
|
|
36
39
|
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).
|
|
37
40
|
|
|
@@ -274,7 +277,7 @@ HTML Beautifier Options:
|
|
|
274
277
|
-A, --wrap-attributes Wrap attributes to new lines [auto|force|force-aligned|force-expand-multiline] ["auto"]
|
|
275
278
|
-i, --wrap-attributes-indent-size Indent wrapped attributes to after N characters [indent-size] (ignored if wrap-attributes is "force-aligned")
|
|
276
279
|
-U, --unformatted List of tags (defaults to inline) that should not be reformatted
|
|
277
|
-
-T, --content_unformatted List of tags (defaults to pre)
|
|
280
|
+
-T, --content_unformatted List of tags (defaults to pre) whose content should not be reformatted
|
|
278
281
|
-E, --extra_liners List of tags (defaults to [head,body,/html] that should have an extra newline before them.
|
|
279
282
|
--editorconfig Use EditorConfig to set up the options
|
|
280
283
|
```
|
|
@@ -318,4 +321,4 @@ Thanks also to Jason Diamond, Patrick Hof, Nochum Sossonko, Andreas Schneider, D
|
|
|
318
321
|
Vasilevsky, Vital Batmanov, Ron Baldwin, Gabriel Harrison, Chris J. Shull,
|
|
319
322
|
Mathias Bynens, Vittorio Gambaletta and others.
|
|
320
323
|
|
|
321
|
-
(README.md: js-beautify@1.7.
|
|
324
|
+
(README.md: js-beautify@1.7.4)
|
package/js/lib/beautify-html.js
CHANGED
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
brace_style (default "collapse") - "collapse" | "expand" | "end-expand" | "none"
|
|
49
49
|
put braces on the same line as control statements (default), or put braces on own line (Allman / ANSI style), or just put end braces on own line, or attempt to keep them where they are.
|
|
50
50
|
unformatted (defaults to inline tags) - list of tags, that shouldn't be reformatted
|
|
51
|
-
content_unformatted (defaults to pre tag) - list of tags,
|
|
51
|
+
content_unformatted (defaults to pre tag) - list of tags, whose content shouldn't be reformatted
|
|
52
52
|
indent_scripts (default normal) - "keep"|"separate"|"normal"
|
|
53
53
|
preserve_newlines (default true) - whether existing line breaks before elements should be preserved
|
|
54
54
|
Only works before elements, not inside tags or for text.
|
package/js/lib/beautify.js
CHANGED
|
@@ -878,8 +878,8 @@ function Beautifier(js_source_text, options) {
|
|
|
878
878
|
}
|
|
879
879
|
}
|
|
880
880
|
|
|
881
|
-
// Should be a space between await and an IIFE
|
|
882
|
-
if (current_token.text === '(' && last_type === 'TK_RESERVED' && flags.last_word
|
|
881
|
+
// Should be a space between await and an IIFE, or async and an arrow function
|
|
882
|
+
if (current_token.text === '(' && last_type === 'TK_RESERVED' && in_array(flags.last_word, ['await', 'async'])) {
|
|
883
883
|
output.space_before_token = true;
|
|
884
884
|
}
|
|
885
885
|
|
package/js/lib/cli.js
CHANGED
|
@@ -359,7 +359,7 @@ function usage(err) {
|
|
|
359
359
|
msg.push(' -p, --preserve-newlines Preserve line-breaks (--no-preserve-newlines disables)');
|
|
360
360
|
msg.push(' -m, --max-preserve-newlines Number of line-breaks to be preserved in one chunk [10]');
|
|
361
361
|
msg.push(' -U, --unformatted List of tags (defaults to inline) that should not be reformatted');
|
|
362
|
-
msg.push(' -T, --content_unformatted List of tags (defaults to pre)
|
|
362
|
+
msg.push(' -T, --content_unformatted List of tags (defaults to pre) whose content should not be reformatted');
|
|
363
363
|
msg.push(' -E, --extra_liners List of tags (defaults to [head,body,/html] that should have an extra newline');
|
|
364
364
|
break;
|
|
365
365
|
case "css":
|
|
@@ -646,8 +646,8 @@ function Beautifier(js_source_text, options) {
|
|
|
646
646
|
}
|
|
647
647
|
}
|
|
648
648
|
|
|
649
|
-
// Should be a space between await and an IIFE
|
|
650
|
-
if (current_token.text === '(' && last_type === 'TK_RESERVED' && flags.last_word
|
|
649
|
+
// Should be a space between await and an IIFE, or async and an arrow function
|
|
650
|
+
if (current_token.text === '(' && last_type === 'TK_RESERVED' && in_array(flags.last_word, ['await', 'async'])) {
|
|
651
651
|
output.space_before_token = true;
|
|
652
652
|
}
|
|
653
653
|
|
|
@@ -1725,6 +1725,44 @@ function run_javascript_tests(test_obj, Urlencoded, js_beautify, html_beautify,
|
|
|
1725
1725
|
|
|
1726
1726
|
// ensure that this doesn't break anyone with the async library
|
|
1727
1727
|
bt('async.map(function(t) {})');
|
|
1728
|
+
|
|
1729
|
+
// async on arrow function. should have a space after async
|
|
1730
|
+
bt(
|
|
1731
|
+
'async() => {}',
|
|
1732
|
+
// -- output --
|
|
1733
|
+
'async () => {}');
|
|
1734
|
+
|
|
1735
|
+
// async on arrow function. should have a space after async
|
|
1736
|
+
bt(
|
|
1737
|
+
'async() => {\n' +
|
|
1738
|
+
' return 5;\n' +
|
|
1739
|
+
'}',
|
|
1740
|
+
// -- output --
|
|
1741
|
+
'async () => {\n' +
|
|
1742
|
+
' return 5;\n' +
|
|
1743
|
+
'}');
|
|
1744
|
+
|
|
1745
|
+
// async on arrow function returning expression. should have a space after async
|
|
1746
|
+
bt(
|
|
1747
|
+
'async() => 5;',
|
|
1748
|
+
// -- output --
|
|
1749
|
+
'async () => 5;');
|
|
1750
|
+
|
|
1751
|
+
// async on arrow function returning object literal. should have a space after async
|
|
1752
|
+
bt(
|
|
1753
|
+
'async(x) => ({\n' +
|
|
1754
|
+
' foo: "5"\n' +
|
|
1755
|
+
'})',
|
|
1756
|
+
// -- output --
|
|
1757
|
+
'async (x) => ({\n' +
|
|
1758
|
+
' foo: "5"\n' +
|
|
1759
|
+
'})');
|
|
1760
|
+
bt(
|
|
1761
|
+
'async (x) => {\n' +
|
|
1762
|
+
' return x * 2;\n' +
|
|
1763
|
+
'}');
|
|
1764
|
+
bt('async () => 5;');
|
|
1765
|
+
bt('async x => x * 2;');
|
|
1728
1766
|
|
|
1729
1767
|
|
|
1730
1768
|
//============================================================
|