vue项目.prettierrc文件配置 error:Strings must use singlequote

Module Warning (from ./node_modules/eslint-loader/index.js):

error:Strings must use singlequote(quotes) at src/store.js:1:17:

> 1 | import Vue from "vue"

    |                ^

  2 | import Vuex from 'vuex'

  3 | Vue.use(Vuex)

  4 | export default new Vuex.Store({

error:Expected indentation of 2 spaces but found 4(indent) at src/store.js:5:1:

  3 | Vue.use(Vuex)

  4 | export default new Vuex.Store({

> 5 |    state: {

    | ^

  6 |

  7 |    },

  8 |    mutations: {

error:Expected indentation of 2 spaces but found 4(indent) at src/store.js:7:1:

   5 |    state: {

   6 |

>  7 |    },

     | ^

   8 |    mutations: {

   9 |

  10 |    },

error:Expected indentation of 2 spaces but found 4(indent) at src/store.js:8:1:

   6 |

   7 |    },

>  8 |    mutations: {

     | ^

   9 |

  10 |    },

  11 |    actions: {


Prettier配置

作用:自定义代码格式

我这边是因为没有安装 Prettier,所以才报错的,安装 npm i prettier -g

{

  "semi": false,

  "singleQuote": true

}

使用快捷键:alt + shift + f  整理代码

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容