es6 导入中换行符的 JsFormat 规则
JsFormat rule for newline in es6 imports
JsFormat for Sublime Text 3 符合大多数 ES6 标准,但是,当自动格式化导入语句时,它会在对象导入中添加一个新行。这是预先格式化的行的样子:
import {func1, func2, func3} from 'some-module';
自动格式化时变成:
import {
func1, func2, func3
}
from 'some-module';
有没有办法禁用这种格式?
根据 the Github repo, JsFormat uses js-beautify to do the formatting. That project has an open issue 的说法,人们抱怨各种格式问题,其中之一就是这个问题。有一个以 "Pull requests welcome" 结尾的稍长的评论线程,因此不幸的是,目前似乎没有办法禁用这种格式。
在 http://jsbeautifier.org/ 上,有启用此设置的复选框:"Preserve inline braces/code blocks"。
此功能是在美化器的最新版本中作为 brace-style
的 preserve-inline
选项添加的。这将使内联(全部在同一行)大括号块保持不变。它用作基本设置的修饰符(例如,brace-style: "collapse,preserve-inline"
)。
JsFormat for Sublime Text 3 符合大多数 ES6 标准,但是,当自动格式化导入语句时,它会在对象导入中添加一个新行。这是预先格式化的行的样子:
import {func1, func2, func3} from 'some-module';
自动格式化时变成:
import {
func1, func2, func3
}
from 'some-module';
有没有办法禁用这种格式?
根据 the Github repo, JsFormat uses js-beautify to do the formatting. That project has an open issue 的说法,人们抱怨各种格式问题,其中之一就是这个问题。有一个以 "Pull requests welcome" 结尾的稍长的评论线程,因此不幸的是,目前似乎没有办法禁用这种格式。
在 http://jsbeautifier.org/ 上,有启用此设置的复选框:"Preserve inline braces/code blocks"。
此功能是在美化器的最新版本中作为 brace-style
的 preserve-inline
选项添加的。这将使内联(全部在同一行)大括号块保持不变。它用作基本设置的修饰符(例如,brace-style: "collapse,preserve-inline"
)。