js-beautify 不換行

 最近在用Hbuilder-X,自帶js-beautify。可是默認格式化設置實在是看着太難受。來看看一個VX的格式化,參數愣是給用了三行才格式化完,並且兩個參數還分開了,看着太難受。ui

// mutations
const mutations = {
    setProducts(state, { 
        defects 
        }) {
        console.log("mutations.setProducts", defects)
        state.all = defects
    }
}

 

讓咱們來美化一下,是否是看着很舒服了。spa

const mutations = {
    setProducts(state, { defects }) {
        console.log("mutations.setProducts", defects)
        state.all = defects
    }
}

 

具體配置就是打開js-beautify的配置文件,修改兩個配置就能夠了code

 "brace_style": "collapse-preserve-inline", //代碼樣式,可選值 [collapse|expand|end-expand|none][,preserve-inline] [collapse,preserve-inline
"wrap_line_length": 12000, //根據須要設置換行長度
相關文章
相關標籤/搜索