在JavaScript中的无操作(空)函数中不添加换行符的选项(IntelliJ Web/PHP风暴)

Option to not add line breaks in no-op (empty) functions in JavaScript (IntelliJ Web/PHP storm)

本文关键字:选项 IntelliJ Web 风暴 PHP 换行符 函数 JavaScript 操作 添加      更新时间:2023-09-26

我一辈子都找不到一个格式化程序选项来关闭no-op函数大括号内的自动换行。换行符是为箭头函数和常规函数自动添加的。例如,当不将任何操作函数传递给其他函数(作为挂钩或回调),即wrapWithCommonErrors(() => {})时,这是令人沮丧的。

function() {}成为
function() { }

() => {}成为
() => { }

您尝试过Simple blocks in one line选项吗?

你可以在找到它

File->Settings->Code Style->JavaScript->Wrapping and Braces->Keep when reformatting