by

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)

Alexander Regueiro
@alexreg
also, maybe this could be achieved dynamically somehow... by some sort of function/hook when calling jsbeautify from code?
Liam Newman
@bitwiseman
inline = this element is treated the same as text.
feature for removals/additions: yes, that sounds good. something like "inline+": ["li"]
Alexander Regueiro
@alexreg
yep, right
Liam Newman
@bitwiseman
Could you file that as a feature request?
Alexander Regueiro
@alexreg
and yes that would work. :-) inline- and inline+ properties
sure
about to head to sleep, but can do that tomorrow.
Liam Newman
@bitwiseman
Great thanks!
also feel free to update the docs or file a task to update the docs on inline behavior.
:)
Thanks for you input and feedback!
Alexander Regueiro
@alexreg
yeah
no problem
there's no functionality for a function that dynamically selects inline elements based on the html, right now, is there?
useful for discriminating between e.g. "ul.classA > li" and "ul.classB > li" (to use CSS/jQuery syntax)
TheRealBluebird
@TheRealBluebird
Hi, I wonder if anyone might be able to help me with an issue in VS Code. How can I configure beautify to NOT indent the <script> tags (just the tags - I want to indent the script contents as normal). I've found out how to use the .jsbeautifyrc file for everything else but I can't see where or how to make this one change.
Liam Newman
@bitwiseman
@TheRealBluebird I don't think... wait, let me check.
@TheRealBluebird there's --indent-inner-html but that only applies to head and body. So, there isn't a way to do this currently. Please file an issue.
Robert Wildling
@rowild
hi! I read that question on how to use beautify should be posted here. Now I see that the last entry was almost a year ago. I wonder, if this is an active group here?

Let’s try! … I am setting up a standard vue project with vue-cli using eslint:standard as the linting standard. In VScode, whenever I open a js file - e.g. the index.js with the router configuration, and format the document, the bracket and the opening curley braces are put into one line (not the closing ones):

const router = [{
      […]
   }
]

This makes eslit upset, because the first line below after the const definition has 4 spaces indented now.

I use a .jsbeautifyrc and try all available options for brace_style:

{
  "js": {
    "brace_style": “collapse|none|expand|end-expand,preserve-inline”,
   [...]
  }
}

but to no avail. Eventually I end up puting ignore comments around the code - which kind of defeats the urpose…

Am I missing a configuration combination to keep a bracket and a curly each in their own line, but the curly properly indented as it is, when a curly follows a regular parenthesis?

Liam Newman
@bitwiseman
I’m here. Thanks for asking the question here instead of filing a “question” issue. :)
@rowild Let me take a look.
First off you can you https://beautifier.io to test out configurations quickly.
Liam Newman
@bitwiseman
You are right the behavior or this pretty inflexible (and some of that inflexibilty is bugs).
You can try adding this entirely other setting: "keep_array_indentation": true.
Side note you code above has incorrect double quotes in it:
 “collapse|none|expand|end-expand,preserve-inline”,
is not the same as
 "collapse|none|expand|end-expand,preserve-inline",
I don’t know if that is just an artifact of the editor here, but I’ve been burned so many times I thought I’d point it out to you.
Back to your question: "keep_array_indentation": true will cause arrays to try to keep the same item indententation, but in this case it seems to make the behavior you want happen.
Liam Newman
@bitwiseman
The problem with the braces are probably already filed issue, but feel free to file another one if you don’t find it. You are also welcome to submit a fix.
Robert Wildling
@rowild
@bitwiseman Liam! Thank you so much for your response! (Gitter does not notify me, when there is a message, so I missed that, since that app is not always open here…) – for the moment I put disable comments around the code in question, but I will try your tipps ASAP and will report back. Thanks for pointing out the double quotes! No idea, how this happened, but I have never ever used them (simply because they have a complicated key-combination on German keyboards…), however, I’ll pay attention to that!
And of course I always go to beautifier.io first before I bother other people with my questions :-)
Liam Newman
@bitwiseman
Quotes: Messaging and word processing apps “help” you by automatically converting the quotes while you type (that’s what happend in this sentence.
In the case off gitter app, It seems to do it even when I’ve started a code block .
That shoud have been ".
At least on the Mac it does. :sob: That is a horrible bug.
Liam Newman
@bitwiseman
@rowild Anyhow, talking about the beautifier … This is definitely a bug and the none setting should at minimum no change the formatting. :(.
Robert Wildling
@rowild
@bitwiseman (As for the quotation: yeah… when you get too much unwated help from software it usually turn into a time intensive search for the culprit and fixing it…)
Do you want me to create an issue on GitHub?
Robert Wildling
@rowild
@bitwiseman i just checked the "keep_array_indentation": true and am happy to be able to report that this options works fine for what I need! Thank you!
Robert Wildling
@rowild

Unfortunately eslint still complains, when there is a fat arrow function like this one:

nearestWithMeta.meta.metaTags.map(tagDef => {
      const tag = document.createElement('meta')

      Object.keys(tagDef).forEach(key => {
        tag.setAttribute(key, tagDef[key])
      })
}

I wonder if this if not more of a eslint problem…
Any idea how to solve such a situation, so that js-beautify and eslint can live alongside each other?

Liam Newman
@bitwiseman
@rowild There are issues filed around eslint (including a blanket request to support an “eslint" setting), but I haven’t had time to work on them. What is eslint’s complaiint for what you showed above?
Robert Wildling
@rowild

@bitwiseman It’s about the indent: eslint want 4, jsbeautify creates 6.

But I actually decided to use only eslint for JS formatting now. Hope you don’t mind! I way always of the opinion that both, eslint AND jsbeautify have to be used alongside, but it turns out, that I was wrong. So I will continue using jsbeautiy for CSS and HTML, and eslint for JS only. That seems to work just fine. I hope this is ok with you! :-)

Thank you very much for your help!

Liam Newman
@bitwiseman
Cool. Glad you figured out a use that works for you.
notcool
@__notcool_twitter

Hi I'm tryout the cli js-beautify to format html contents

Indent with Tabs, Tabsize - 2 How can i set ?

--indent-size 2 is overriding if i pass --indent-with-tabs

js-beautify --indent-with-tabs --indent-size 2 -r sample.html
Liam Newman
@bitwiseman
What version are you using?
aswinkumar863
@aswinkumar863

Hi, I'm using js-beautify to format Smarty template files in vscode extension.

The syntax is similar to handlebars, but only single braces. I'm facing some issue like aswinkumar863/smarty-vscode-support#9 in formatting.

My question is that, is there any way to add/modify directive. So that the formatter ignores the smarty tags.

This is not a feature request, necessarily, I'm happy to fork the repo, but any help would be hugely appreciated. Thank you.

Liam Newman
@bitwiseman
Ah, and now I see your question here. :| Sorry for missing it before
Mayank Shouche
@mayankshouche
Hello! I opened a PR as a fix to #1801 and I'm having some trouble with the Azure build pipeline. Running 'make ci' locally doesn't result in any errors, but on Azure, (specifically on the Linux with Python builds) I'm getting a fail on the git status check that shows the one line I added as a diff. Any help with resolving this would be appreciated! Here is the build results as reference.