js-beautify

how to use beautify for javascript/react?

浪尽此生 提交于 2021-02-08 08:00:37
问题 I have installed Beautify to use it for my react.js code. However, it apparently does not properly beautify the html format in the file. For example, it turns this: into this: Among all the options, which option should I use to fix this ? 回答1: I used to have the same problem. Apparently beautify doesn't support JSX. I uninstalled and instead of it, I installed Prettier, it works great for me. Hope I helped you. 回答2: Just change language mode javascript to javascript react [temporary] VSCode

how to use beautify for javascript/react?

不想你离开。 提交于 2021-02-08 08:00:18
问题 I have installed Beautify to use it for my react.js code. However, it apparently does not properly beautify the html format in the file. For example, it turns this: into this: Among all the options, which option should I use to fix this ? 回答1: I used to have the same problem. Apparently beautify doesn't support JSX. I uninstalled and instead of it, I installed Prettier, it works great for me. Hope I helped you. 回答2: Just change language mode javascript to javascript react [temporary] VSCode

Leaving case statement in one line using beautify plugin in VS Code

元气小坏坏 提交于 2019-12-11 04:10:21
问题 After installing beautify plugin in VS Code pressing Shift + Alt + F results in reformatting a switch case form switch (cmd) { case glob.CmdsClient.GET_CHANGED_ITEMS: cmds.getChangedItems(data, socket); break; case glob.CmdsClient.UPDATE_ITEM: cmds.updateItem(data); break; default: console.log("Unkonwn CMD #", cmd); } to switch(cmd) { case glob.CmdsClient.GET_CHANGED_ITEMS: cmds.getChangedItems(data, socket); break; case glob.CmdsClient.UPDATE_ITEM: cmds.updateItem(data); break; default:

How to reformat all files in a VS Code Project?

独自空忆成欢 提交于 2019-12-11 01:27:42
问题 I'm starting to work on an existing un-beautified project, and I have reformat-on-save in my IDE, so every 1-line edit turns into a whole reformatting of the file. Instead I'd like to reformat all the files in the project. What's the easiest way to do that with VS Code? 回答1: Try the vscode-formatall extension. It adds a Do Format command that reformats all files specified by the pattern in the formatall.search.include setting. 来源: https://stackoverflow.com/questions/47735943/how-to-reformat

`no such file or directory` While installing js beautify in npm

旧城冷巷雨未停 提交于 2019-12-10 12:49:31
问题 I get this error when i use npm -g install js-beautify npm ERR! path /home/developer/software/nodejs/lib/node_modules/js- beautify/js/bin/css-beautify.js npm ERR! code ENOENT npm ERR! errno -2 npm ERR! syscall chmod npm ERR! enoent ENOENT: no such file or directory, chmod '/home/developer/software/nodejs/lib/node_modules/js- beautify/js/bin/css-beautify.js' npm ERR! enoent This is related to npm not being able to find a file. npm ERR! enoent npm ERR! A complete log of this run can be found in

How to force closing HTML tags on a new line?

ぐ巨炮叔叔 提交于 2019-12-07 01:09:51
问题 In VS Code, I use Beautify extensively. But it unnerves me that closing tags always wrap on the same line as "floating" text, or self-closing tags. For instance, before Beautify : <div class="wrap"> <img src="/wp-content/uploads/2018/08/image.png"> </div> <div class="wrap">This is just some text <strong>but it needs to be emphasized</strong>! And then some... </div> And after Beautify : <div class="wrap"> <img src="/wp-content/uploads/2018/08/image.png"> </div> <div class="wrap">This is just

JsFormat rule for newline in es6 imports

北城余情 提交于 2019-12-04 03:15:36
问题 JsFormat for Sublime Text 3 conforms to most ES6 standards, however, when auto-formatting import statements, it adds a new line to object imports. Here is what the pre-formatted line looks like: import {func1, func2, func3} from 'some-module'; When auto-formatting, it turns into: import { func1, func2, func3 } from 'some-module'; Is there a way to disable this kind of formatting? 回答1: According to the Github repo, JsFormat uses js-beautify to do the formatting. That project has an open issue