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

vue?如何配置eslint代碼檢查

 更新時間:2022年04月14日 08:47:26   作者:_蔥  
這篇文章主要介紹了vue?如何配置eslint代碼檢查,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教

1.安裝依賴

"eslint": "^5.12.0",
"eslint-config-standard": "^12.0.0",
"eslint-friendly-formatter": "^4.0.1",
"eslint-loader": "^2.1.1",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-node": "^8.0.1",
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-standard": "^4.0.0",
"eslint-plugin-vue": "^5.1.0",
"acorn": "^6.0.5",
"babel-eslint": "^8.2.1",

2.webstorm代碼格式化快捷鍵為win + alt + L

在webstorm preference里面找到code style,在里面設(shè)置webstorm代碼快捷格式化選項。

比如這里勾選上in empty tag時,當我們按win + alt + L格式化代碼時,就會自動在閉合標簽前面添加空格。

如果webstorm格式化與eslint規(guī)則沖突,大多時候也可以從這里設(shè)置規(guī)則。

3.設(shè)置webstorm校驗規(guī)則為本地項目安裝的eslint

如下:

4.在項目本地新建.editorconfig文件

設(shè)置webstorm格式。

root = true
 
[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
in_empty_tag = true

5.在項目本地新建.eslintrc.js文件

// https://eslint.org/docs/user-guide/configuring
 
module.exports = {
  root: true,
  parserOptions: {
    parser: 'babel-eslint'
  },
  env: {
    browser: true,
  },
  extends: [
    // https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
    // consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
    'plugin:vue/essential',
    // https://github.com/standard/standard/blob/master/docs/RULES-en.md
    'standard'
  ],
  // required to lint *.vue files
  plugins: [
    'vue'
  ],
  // add your custom rules here
  rules: {
    // allow async-await
    'generator-star-spacing': 'off',
    // allow debugger during development
    'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
    "vue/no-use-v-if-with-v-for": ["error", {
      "allowUsingIterationVar": false
    }],
    "vue/return-in-computed-property": ["error", {
      "treatUndefinedAsUnspecified": false
    }],
    "vue/no-unused-components": ["error", {
      "ignoreWhenBindingPresent": true
    }],
    "vue/attribute-hyphenation": ["error", "always", {
      "ignore": []
    }],
    "vue/component-name-in-template-casing": ["error", "kebab-case", {
      "ignores": []
    }],
    "vue/html-closing-bracket-newline": ["error", {
      "singleline": "never",
      "multiline": "always"
    }],
    "vue/html-closing-bracket-spacing": ["error", {
      "startTag": "never",
      "endTag": "never",
      "selfClosingTag": "always"
    }],
    "vue/html-indent": ["error", 2, {
      "attribute": 1,
      "baseIndent": 1,
      "closeBracket": 0,
      "alignAttributesVertically": true,
      "ignores": []
    }],
    "vue/html-quotes": ["error", "double"],
    "vue/html-self-closing": ["error", {
      "html": {
        "void": "never",
        "normal": "never",
        "component": "always"
      },
      "svg": "always",
      "math": "always"
    }],
    "vue/max-attributes-per-line": ["error", {
      "singleline": 3,
      "multiline": {
        "max": 3,
        "allowFirstLine": true
      }
    }],
    "vue/multiline-html-element-content-newline": ["error", {
      "ignoreWhenEmpty": true,
      "ignores": ["pre", "textarea"]
    }],
    "vue/mustache-interpolation-spacing": ["error", "always"],
    "vue/name-property-casing": ["error", "kebab-case"],
    "vue/no-multi-spaces": ["error", {
      "ignoreProperties": false
    }],
    "vue/no-spaces-around-equal-signs-in-attribute": ["error"],
    "vue/no-template-shadow": ["error"],
    "vue/prop-name-casing": ["error", "camelCase"],
    "vue/require-default-prop": ["error"],
    "vue/v-bind-style": ["error", "shorthand"],
    "vue/v-on-style": ["error", "shorthand"],
    "vue/attributes-order": ["error", {
      "order": [
        "DEFINITION",
        "LIST_RENDERING",
        "CONDITIONALS",
        "RENDER_MODIFIERS",
        "GLOBAL",
        "UNIQUE",
        "TWO_WAY_BINDING",
        "OTHER_DIRECTIVES",
        "OTHER_ATTR",
        "EVENTS",
        "CONTENT"
      ]
    }],
    "vue/order-in-components": ["error", {
      "order": [
        "el",
        "name",
        "parent",
        "functional",
        ["delimiters", "comments"],
        ["components", "directives", "filters"],
        "extends",
        "mixins",
        "inheritAttrs",
        "model",
        ["props", "propsData"],
        "data",
        "computed",
        "watch",
        "LIFECYCLE_HOOKS",
        "methods",
        ["template", "render"],
        "renderError"
      ]
    }],
    "vue/this-in-template": ["error", "never"]
  }
}

以上為個人經(jīng)驗,希望能給大家一個參考,也希望大家多多支持腳本之家。 

相關(guān)文章

  • 基于Vue3+Three.js實現(xiàn)一個3D模型可視化編輯系統(tǒng)

    基于Vue3+Three.js實現(xiàn)一個3D模型可視化編輯系統(tǒng)

    這篇文章主要介紹了基于Vue3+Three.js實現(xiàn)一個3D模型可視化編輯系統(tǒng),本文通過實例代碼給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2023-09-09
  • Vue消息提示this.$message方法使用解讀

    Vue消息提示this.$message方法使用解讀

    這篇文章主要介紹了Vue消息提示this.$message方法使用,具有很好的參考價值,希望對大家有所幫助,
    2023-09-09
  • 關(guān)于Vue中axios的封裝實例詳解

    關(guān)于Vue中axios的封裝實例詳解

    這篇文章主要給大家介紹了關(guān)于Vue中axios的封裝的相關(guān)資料,文中通過示例代碼介紹的非常詳細,對大家的學習或者使用Vue具有一定的參考學習價值,需要的朋友們下面來一起學習學習吧
    2019-10-10
  • Vuex(多組件數(shù)據(jù)共享的Vue插件)搭建與使用

    Vuex(多組件數(shù)據(jù)共享的Vue插件)搭建與使用

    Vuex是實現(xiàn)組件全局狀態(tài)(數(shù)據(jù))管理的一種機制,可以方便的實現(xiàn)組件之間數(shù)據(jù)的共享,數(shù)據(jù)緩存等等,下面這篇文章主要給大家介紹了關(guān)于Vuex(多組件數(shù)據(jù)共享的Vue插件)搭建與使用的相關(guān)資料,需要的朋友可以參考下
    2022-10-10
  • Vue組件之間的通信方式(推薦!)

    Vue組件之間的通信方式(推薦!)

    組件是 vue.js最強大的功能之一,而組件實例的作用域是相互獨立的,這就意味著不同組件之間的數(shù)據(jù)無法相互進行直接的引用,所以組件間的相互通信是非常重要的,這篇文章主要給大家介紹了關(guān)于Vue組件之間的通信方式,需要的朋友可以參考下
    2022-06-06
  • 詳解Vue CLI3配置解析之css.extract

    詳解Vue CLI3配置解析之css.extract

    這篇文章主要介紹了詳解Vue CLI3配置解析之css.extract,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2018-09-09
  • vue中keep-alive組件的入門使用教程

    vue中keep-alive組件的入門使用教程

    這篇文章主要給大家介紹了關(guān)于vue中keep-alive組件的入門使用教程,文中通過示例代碼介紹的非常詳細,對大家學習或者使用vue具有一定的參考學習價值,需要的朋友們下面來一起學習學習吧
    2019-06-06
  • Vue使用Vue-cropper實現(xiàn)圖片裁剪

    Vue使用Vue-cropper實現(xiàn)圖片裁剪

    這篇文章主要為大家詳細介紹了Vue使用Vue-cropper實現(xiàn)圖片裁剪,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2022-05-05
  • vue中的el-button樣式自定義方式

    vue中的el-button樣式自定義方式

    這篇文章主要介紹了vue中的el-button樣式自定義方式,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2022-07-07
  • VUE表格顯示錯位的兩種解決思路分享

    VUE表格顯示錯位的兩種解決思路分享

    這篇文章主要介紹了VUE表格顯示錯位的兩種解決思路,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教
    2023-10-10

最新評論

余姚市| 额尔古纳市| 高雄市| 五指山市| 繁昌县| 安岳县| 河东区| 商河县| 江口县| 沧州市| 旌德县| 信丰县| 安岳县| 辰溪县| 乐昌市| 建始县| 汶上县| 郧西县| 湖北省| 新兴县| 九江县| 上林县| 诏安县| 辽源市| 南开区| 青神县| 上饶县| 连山| 海伦市| 元江| 长丰县| 黑龙江省| 玉门市| 浙江省| 广东省| 通河县| 洛阳市| 玛多县| 疏勒县| 任丘市| 桦南县|