Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 31 2019 22:00
    bobtiki starred beautify-web/js-beautify
  • Jan 31 2019 18:35
    Nico-Duduf starred beautify-web/js-beautify
  • Jan 31 2019 17:02
    bitwiseman commented #1625
  • Jan 31 2019 13:45
  • Jan 31 2019 13:02
    oleedd commented #1625
  • Jan 31 2019 12:50
  • Jan 31 2019 11:26
    bitwiseman unlabeled #1625
  • Jan 31 2019 11:26
    bitwiseman labeled #1625
  • Jan 31 2019 10:55
    bitwiseman closed #1625
  • Jan 31 2019 10:55
    bitwiseman commented #1625
  • Jan 31 2019 09:49
    oleedd commented #1625
  • Jan 31 2019 08:55
    bitwiseman commented #1625
  • Jan 31 2019 08:54
    bitwiseman labeled #1625
  • Jan 31 2019 02:22
    lettenj61 starred beautify-web/js-beautify
  • Jan 30 2019 19:48
    oleedd opened #1625
  • Jan 30 2019 17:08
  • Jan 30 2019 16:06
    bitwiseman commented #1532
  • Jan 30 2019 11:28
    bitwiseman commented #1623
  • Jan 30 2019 11:16

    bitwiseman on v1.9.0-beta5

    (compare)

  • Jan 30 2019 11:16

    bitwiseman on release

    correctly indenting handlebars/… added test for indenting handle… comment referring to issue whic… and 13 more (compare)

Liam Newman
@bitwiseman
However, I don’t thnk I can do that currently.
Oh, turns out I’m wrong.
If you set "preserve_newlines": false, it will collapse the first input to:
 <span>{page.title} </span>
But that will collapse a lot of other things as well, so beware.
ripπ
@mostlyrip:matrix.org
[m]
Hi, i am currently implmenting a check function (#741) and wanted to test my python implementation. I have little python experience and can't find a way to execute js-beautify after building with make py
2 replies
Alzamer
@Alzamer
Hello, I wanted to start contributing to js-beautifier. I found this issue (#1840) easy, so I modified the appropriate regex. I build locally, run make ci, everything worked - I was testing on Ubuntu. My PR (#1903) is failing on MacOs - I checked the logs, and I don't know what went wrong. The error says Post-build git status check - FAILED. Where do I made mistake? Aren't these unstaged changes made in tests?
Liam Newman
@bitwiseman
@Alzamer Thanks for contributing. The check ensures that we don't have uncommitted changes in the workspace after the build. It sometimes runs into issue with different environments. I've fixed the issue for you.
Caroline Kistler
@carolinekistler
Hi guys! I am starting on issue #1823 and would like some clarification on what the desired output is? Thanks!
Liam Newman
@bitwiseman
@carolinekistler The output should be the same for <button>Click here</button><!--end button--> and <button>Click here</button><!-- end button-->
@carolinekistler I've updated the issue with an example.
ripπ
@mostlyrip:matrix.org
[m]
Thanks. That builds the test files? My question was more regarding the final 'executable'.
Liam Newman
@bitwiseman
make py
I think I'm not understanding your request.
ripπ
@mostlyrip:matrix.org
[m]
Basicly I did 'make py' but I cant run the files I build / where are they located?. For javascript I just execute the file in js/bin. Maybe I am understanding that python build thing wrong?
Liam Newman
@bitwiseman
Yeah, python doesn't need any building to run really, but we do use a python virtualenv. try ./tools/python-dev js-beautify
ripπ
@mostlyrip:matrix.org
[m]
Thanks, thats exactly what I needed
Alzamer
@Alzamer
Hi, I made 2 PR's (#1927 and #1928 ) which seems to me are working. Both of them are not passing the Post-build git status check. I request for help, because I think I encountered same error april 10th. If not, what am I overlooking?
Liam Newman
@bitwiseman
@Alzamer Run make all (or just make). When that is done, you will see you local workspace has some changes. Commit and push those changes.
Liam Newman
@bitwiseman
@Alzamer Looks like there was a change in the black formatter for python. I've pushed a fix.
DannySalvatore
@DannySalvatore
I am trying to decode one js file
Please can someone help?
Liam Newman
@bitwiseman
@DannySalvatore Sure. https://beautifier.io/ issue?
M.U.N.I.N
@SNDST00M
What's the logo of this project? :P
M.U.N.I.N
@SNDST00M
Better q - how would one conceptually communicate "JS beautifier" by icon?
M.U.N.I.N
@SNDST00M
Opened an issue: #1936
Liam Newman
@bitwiseman
@4086606 Interesting.
pr0grammm
@pr0grammm
Hello! I would like to try this good first issue if it hasn't already been resolved: beautify-web/js-beautify#1683
Also I faced one issue while building in my local...
make js is successful but make static fails. Can someone help me please?
Ensure all expected functions are defined
All 3 tests passed.
Testing js-beautifier with node.js CommonJS (src/index)...
All 38143 tests passed.
Testing css-beautifier with node.js CommonJS (src/index)...
All 4671 tests passed.
Testing html-beautifier with node.js CommonJS (src/index)...
All 11258 tests passed.
athena@athena-VirtualBox:~/js-beautify$ 
athena@athena-VirtualBox:~/js-beautify$ make static
make: *** No rule to make target 'static'.  Stop.
Liam Newman
@bitwiseman
I think the action name has changed from static to something else. The documentation is probably slightly out of date. Try calling make help, or look at the makefile to see what the action is.
Also sorry for the slow response.
pr0grammm
@pr0grammm
Oh okay I will check that then..no issues thanks for replying :)
Liam Newman
@bitwiseman
Probably make serve.
pr0grammm
@pr0grammm
oh wow yes this is it
pr0grammm
@pr0grammm

hi @bitwiseman I have done the code changes and submitted a PR for the issue #1683 and I was trying to add a test as well but I am stuck here. Appreciate your help!
my input is switch (x) { case 0: if (y == z) { a(); } else { b(); } case 1: c(); }
and output is

nodejs js-beautify.js foo.js
switch (x) {
    case 0:
        if (y == z) {
            a();
        } else {
            b();
        }
    case 1:
        c();

How should I write the test for this?
I tried adding the below test case to the test\data\javascript\tests.js file

        {
          comment: "Issue #1683",
          input: 'switch (x) { case 0: if (y == z) { a(); } else { b(); } case 1: c(); }',
          output: 'switch (x) {\n    case 0:\n        if (y == z) {\n            a();\n        } else {\n            b();\n        }\n    case 1:\n        c();\n}'
        }

But when I run make js (in the branch that has the fix) a few tests are failing

Testing js-beautifier with node.js CommonJS (src/index)...
==== jslint and space after anon function - (jslint_happy = "true", space_after_anon_function = "true") ============================================================
---- input -------
switch (x) { case 0: if (y == z) { a(); } else { b(); } case 1: c(); }
---- expected ----
switch (x) {
    case 0:
        if (y == z) {
            a();
        } else {
            b();
        }
    case 1:
        c();
}
---- output ------
switch (x) {
case 0:
    if (y == z) {
        a();
    } else {
        b();
    }
case 1:
    c();
}
---- expected-ws ------
switch_(x)_{\n
____case_0:\n
________if_(y_==_z)_{\n
____________a();\n
________}_else_{\n
____________b();\n
________}\n
____case_1:\n
________c();\n
}
---- output-ws ------
switch_(x)_{\n
case_0:\n
____if_(y_==_z)_{\n
________a();\n
____}_else_{\n
________b();\n
____}\n
case_1:\n
____c();\n
}
================================================================

==== jslint and space after anon function - (jslint_happy = "true", space_after_anon_function = "false") ============================================================
---- input -------
switch (x) { case 0: if (y == z) { a(); } else { b(); } case 1: c(); }
---- expected ----
switch (x) {
    case 0:
        if (y == z) {
            a();
        } else {
            b();
        }
    case 1:
        c();
}
---- output ------
switch (x) {
case 0:
    if (y == z) {
        a();
    } else {
        b();
    }
case 1:
    c();
}
---- expected-ws ------
switch_(x)_{\n
____case_0:\n
________if_(y_==_z)_{\n
____________a();\n
________}_else_{\n
____________b();\n
________}\n
____case_1:\n
________c();\n
}
---- output-ws ------
switch_(x)_{\n
case_0:\n
____if_(y_==_z)_{\n
________a();\n
____}_else_{\n
________b();\n
____}\n
case_1:\n
____c();\n
}
================================================================

2 tests failed.

make: *** [Makefile:28: js] Error 1
pr0grammm
@pr0grammm
It seems to me that when jslint is enabled I should be specifying a different expected output in the test case?
Liam Newman
@bitwiseman
Yes, jslint unindents case to the same level as switch.
I think you added your test input to a matrix section that is testing jslint.
@pr0grammm Try moving your added test to a different section that doesn't have that matrix.
pr0grammm
@pr0grammm
oh okay I am still a little bit unsure...let me try
Liam Newman
@bitwiseman
If you can't figure it out, that's okay, commit your change and push it so I can see what you have and maybe I can point you in the right direction.
pr0grammm
@pr0grammm
okay thank you I will do that right away :)
pr0grammm
@pr0grammm
@bitwiseman thank you , moved to a different section and it works now
pr0grammm
@pr0grammm
Hi I had a general question as to why two separate codebases are maintained in python and javascript? Thanks
Liam Newman
@bitwiseman
@pr0grammm When I took maintainership both were present. There were and still are consumers of the both implementations. Some python tools build specifically on the python implementation and do not want to have to run Javascript engine such as node.
pr0grammm
@pr0grammm
okay thanks :thumbsup:
Liam Newman
@bitwiseman
The downside of this philosophy is that neither implementation can take deep dependencies on external libraries inside the beautification engine itself.
Each has a CLI component and some other adapter code that wraps the core beautifier code. The core remains as close to identical as possible. whic
pr0grammm
@pr0grammm
oh okay thanks for the details
M.U.N.I.N
@SNDST00M
New logo proposal at this PR!
beautify-web/js-beautify#1951
Bhavesh Vasnani
@bhaveshvasnani

I'm also receiving this error when running 'make py' even when I have python2 installed.

Testing python beautify functionality...
/mnt/c/Open_Source/js-beautify/tools/python-dev3 black --config=python/pyproject.toml python
Usage: black [OPTIONS] SRC ...
Try 'black -h' for help.

Error: Invalid value for '-t' / '--target-version': 'py27' is not one of 'py33', 'py34', 'py35', 'py36', 'py37', 'py38', 'py39', 'py310'.
make: *** [Makefile:33: py] Error 2

Upon removing py27 dependecy from pyproject.toml, it builds fine. Is this a common issue and how can I fix this?

Bhavesh Vasnani
@bhaveshvasnani
Also with the latest version of black, there are other formatting changes forced to other python files. @bitwiseman should I continue with that and push the same? Will modify the pyproject.toml and documentation accordingly because latest version dropped supporting python2.
Bhavesh Vasnani
@bhaveshvasnani
@bitwiseman could you please help me with the above question? I’m still stuck and the above query and thus unable to raise a fix for an issue. Thanks!!