From 5d769533ac84f0df81f80fe40940243281655c35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8A=B1=E8=A3=A4=E8=A1=A9?= Date: Mon, 20 Aug 2018 15:45:15 +0800 Subject: [PATCH] add: eslint-plugin-vue (#148) --- .eslintrc.js | 26 +++++----- package.json | 2 +- src/App.vue | 2 +- src/components/Breadcrumb/index.vue | 12 ++--- src/components/Hamburger/index.vue | 32 +++++++++---- src/components/SvgIcon/index.vue | 7 +-- src/router/index.js | 15 +++--- src/views/404.vue | 4 +- src/views/dashboard/index.vue | 6 +-- src/views/form/index.vue | 28 +++++------ src/views/layout/Layout.vue | 12 ++--- src/views/layout/components/AppMain.vue | 2 +- src/views/layout/components/Navbar.vue | 12 ++--- .../layout/components/Sidebar/SidebarItem.vue | 48 +++++++++++-------- src/views/layout/components/Sidebar/index.vue | 6 +-- src/views/login/index.vue | 23 +++++---- src/views/nested/menu1/index.vue | 2 +- src/views/nested/menu1/menu1-1/index.vue | 2 +- src/views/nested/menu1/menu1-2/index.vue | 2 +- .../nested/menu1/menu1-2/menu1-2-1/index.vue | 2 +- .../nested/menu1/menu1-2/menu1-2-2/index.vue | 2 +- src/views/nested/menu1/menu1-3/index.vue | 2 +- src/views/nested/menu2/index.vue | 2 +- src/views/table/index.vue | 36 ++++++++------ src/views/tree/index.vue | 35 ++++++++------ 25 files changed, 180 insertions(+), 142 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 54790a4..0e5c28a 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/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..11ce3a5 100644 --- a/src/components/Breadcrumb/index.vue +++ b/src/components/Breadcrumb/index.vue @@ -1,9 +1,9 @@