vscode中prettier和eslint換行縮進(jìn)沖突的問(wèn)題
prettier
Javascript
// Input const example1 = someValue === 'a' ? 'hello world, branch a' : someValue === 'b' ? 'hello world, branch a && b' : someValue === 'c' ? 'hello world, branch a && b && c' : someValue === 'd' ? 'hello world, branch a && b && c && d' : null; const example2 = someValue === 'a' ? someValue === 'b' ? someValue === 'c' ? 'hello world, branch a && b && c' : 'hello world, branch a && b && !c' : 'hello world, branch a && !b' : null; // Output (Prettier 1.14) const example1 = someValue === "a" ? "hello world, branch a" : someValue === "b" ? "hello world, branch a && b" : someValue === "c" ? "hello world, branch a && b && c" : someValue === "d" ? "hello world, branch a && b && c && d" : null; const example2 = someValue === "a" ? someValue === "b" ? someValue === "c" ? "hello world, branch a && b && c" : "hello world, branch a && b && !c" : "hello world, branch a && !b" : null; // Output (Prettier 1.15) const example1 = someValue === "a" ? "hello world, branch a" : someValue === "b" ? "hello world, branch a && b" : someValue === "c" ? "hello world, branch a && b && c" : someValue === "d" ? "hello world, branch a && b && c && d" : null; const example2 = someValue === "a" ? someValue === "b" ? someValue === "c" ? "hello world, branch a && b && c" : "hello world, branch a && b && !c" : "hello world, branch a && !b" : null;
異常展示
prettier 格式化后輸出結(jié)果
<div v-if=" statusSetting.a === element.status || statusSetting.b === element.status " class="ticket__background" />
eslint沖突輸出結(jié)果
<div v-if=" statusSetting.a === element.status || statusSetting.b === element.status " class="ticket__background" />
解決方案
方案一
工作區(qū)禁用eslint
方案二
修改 vscode 配置
/** 保存文檔時(shí)自動(dòng)格式化 */ "editor.formatOnSave": false, /** 保存時(shí)按照哪個(gè)規(guī)則進(jìn)行格式化(上面的保存文檔時(shí)自動(dòng)格式化必須關(guān)閉否則會(huì)有沖突) */ "editor.codeActionsOnSave": { "source.fixAll": true, },
總結(jié)
以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。
相關(guān)文章
elementUI實(shí)現(xiàn)下拉選項(xiàng)加多選框的示例代碼
因產(chǎn)品需求和UI樣式調(diào)整,本文主要實(shí)現(xiàn)elementUI下拉選項(xiàng)加多選框的示例代碼,文中通過(guò)示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2021-10-10解決vue-router中的query動(dòng)態(tài)傳參問(wèn)題
下面小編就為大家分享一篇解決vue-router中的query動(dòng)態(tài)傳參問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2018-03-03vuejs如何解決瀏覽器切換頁(yè)面后setInterval計(jì)時(shí)器停止執(zhí)行的問(wèn)題
setinterval()是定時(shí)調(diào)用的函數(shù),可按照指定的周期(以毫秒計(jì))來(lái)調(diào)用函數(shù)或計(jì)算表達(dá)式,這篇文章主要給大家介紹了關(guān)于vuejs如何解決瀏覽器切換頁(yè)面后setInterval計(jì)時(shí)器停止執(zhí)行的問(wèn)題,需要的朋友可以參考下2024-01-01vue多頁(yè)面項(xiàng)目實(shí)現(xiàn)版本快照功能示例詳解
這篇文章主要為大家介紹了vue多頁(yè)面項(xiàng)目實(shí)現(xiàn)版本快照功能示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2023-01-01vue修飾符v-model及.sync原理及區(qū)別詳解
這篇文章主要為大家介紹了vue修飾符v-model及.sync原理及使用區(qū)別詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2022-07-07基于Vue的SPA動(dòng)態(tài)修改頁(yè)面title的方法(推薦)
這篇文章主要介紹了基于Vue的SPA動(dòng)態(tài)修改頁(yè)面title的方法,需要的朋友可以參考下2018-01-01