最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

vscode中prettier和eslint換行縮進(jìn)沖突的問(wèn)題

 更新時(shí)間:2023年10月20日 10:17:12   作者:Simorel  
這篇文章主要介紹了vscode中prettier和eslint換行縮進(jìn)沖突的問(wèn)題及解決,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教

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)文章

最新評(píng)論

齐齐哈尔市| 白玉县| 上饶市| 太康县| 乐清市| 南充市| 昔阳县| 绍兴县| 商河县| 随州市| 文山县| 延边| 衡南县| 济阳县| 清丰县| 兰州市| 尼勒克县| 金川县| 吉首市| 大方县| 武宣县| 鄂州市| 岱山县| 苗栗市| 务川| 怀柔区| 仁怀市| 浙江省| 合作市| 昌都县| 青浦区| 桃园市| 静安区| 思南县| 黎城县| 天柱县| 兴隆县| 弋阳县| 玉树县| 东台市| 吉木乃县|