From fb40931d6648aca6d6b490d0e2b647a86063bcb4 Mon Sep 17 00:00:00 2001 From: Pan Date: Fri, 17 Aug 2018 10:58:24 +0800 Subject: [PATCH] add eslint-plugin-vue --- .eslintrc.js | 26 +++++----- package.json | 2 +- src/App.vue | 2 +- src/components/Breadcrumb/index.vue | 6 +-- src/components/Hamburger/index.vue | 32 +++++++++---- src/components/SvgIcon/index.vue | 7 +-- src/router/index.js | 15 +++--- src/views/404.vue | 2 +- src/views/dashboard/index.vue | 6 +-- src/views/form/index.vue | 26 +++++----- src/views/layout/Layout.vue | 10 ++-- src/views/layout/components/AppMain.vue | 2 +- src/views/layout/components/Navbar.vue | 6 +-- .../layout/components/Sidebar/SidebarItem.vue | 48 +++++++++++-------- src/views/layout/components/Sidebar/index.vue | 4 +- src/views/login/index.vue | 21 +++++--- src/views/table/index.vue | 22 +++++---- src/views/tree/index.vue | 11 ++++- 18 files changed, 143 insertions(+), 105 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 54790a4..51e5d46 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,7 +1,7 @@ module.exports = { root: true, - parser: 'babel-eslint', parserOptions: { + parser: 'babel-eslint', sourceType: 'module' }, env: { @@ -9,22 +9,19 @@ module.exports = { node: true, es6: true, }, - extends: 'eslint:recommended', - // required to lint *.vue files - plugins: [ - 'html' - ], - // check if imports actually resolve - 'settings': { - 'import/resolver': { - 'webpack': { - 'config': 'build/webpack.base.conf.js' - } - } - }, + extends: ['plugin:vue/strongly-recommended', 'eslint:recommended'], + // add your custom rules here //it is base on https://github.com/vuejs/eslint-config-vue rules: { + "vue/max-attributes-per-line": [2, { + "singleline": 10, + "multiline": { + "max": 1, + "allowFirstLine": false + } + }], + "vue/name-property-casing": ["error", "PascalCase"], 'accessor-pairs': 2, 'arrow-spacing': [2, { 'before': true, @@ -196,3 +193,4 @@ module.exports = { 'array-bracket-spacing': [2, 'never'] } } + diff --git a/package.json b/package.json index b800b4e..1e68074 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "eslint": "4.19.1", "eslint-friendly-formatter": "4.0.1", "eslint-loader": "2.0.0", - "eslint-plugin-html": "4.0.5", + "eslint-plugin-vue": "4.7.1", "eventsource-polyfill": "0.9.6", "file-loader": "1.1.11", "friendly-errors-webpack-plugin": "1.7.0", diff --git a/src/App.vue b/src/App.vue index 812eef2..721d3a3 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,6 +1,6 @@ diff --git a/src/components/Breadcrumb/index.vue b/src/components/Breadcrumb/index.vue index b5d9471..4f8ee6e 100644 --- a/src/components/Breadcrumb/index.vue +++ b/src/components/Breadcrumb/index.vue @@ -1,9 +1,9 @@