Skip to content

Commit

Permalink
style: 添加eslint airbnb 代码风格检查
Browse files Browse the repository at this point in the history
  • Loading branch information
IWANABETHATGUY committed Jan 20, 2020
1 parent 4a6d05e commit ca833ac
Show file tree
Hide file tree
Showing 22 changed files with 2,328 additions and 1,081 deletions.
19 changes: 15 additions & 4 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,26 @@ module.exports = {
env: {
node: true
},
'extends': [
'plugin:vue/essential',
'eslint:recommended'
extends: [
'plugin:vue/recommended',
'eslint:recommended',
'airbnb-base'
],
rules: {
'no-console': 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'vue/no-unused-components': 0,
'no-unused-vars': 0
'no-unused-vars': 0,
'import/extensions': 0,
'import/no-unresolved': 0,
'comma-dangle': [2, 'never'],
semi: [2, 'never'],
'no-unused-expressions': 0,
'no-plusplus': 0,
'import/prefer-default-export': 0,
"no-use-before-define": 0,
"no-param-reassign": 0,
"arrow-parens": [2, "as-needed"]
},
parserOptions: {
parser: 'babel-eslint'
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@
"@vue/cli-plugin-eslint": "^4.1.0",
"@vue/cli-service": "^4.1.0",
"babel-eslint": "^10.0.3",
"eslint": "^5.16.0",
"eslint-plugin-vue": "^5.0.0",
"eslint": "^6.8.0",
"eslint-config-airbnb-base": "^14.0.0",
"eslint-plugin-import": "^2.20.0",
"eslint-plugin-vue": "^6.1.2",
"sass": "^1.23.7",
"sass-loader": "^8.0.0",
"svg-sprite-loader": "^4.1.6",
Expand Down
19 changes: 14 additions & 5 deletions src/components/SvgIcon/index.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
<template>
<div v-if="isExternal" :style="styleExternalIcon" class="svg-external-icon svg-icon" v-on="$listeners" />
<svg v-else :class="svgClass" aria-hidden="true" v-on="$listeners">
<div
v-if="isExternal"
:style="styleExternalIcon"
class="svg-external-icon svg-icon"
v-on="$listeners"
/>
<svg
v-else
:class="svgClass"
aria-hidden="true"
v-on="$listeners"
>
<use :xlink:href="iconName" />
</svg>
</template>
Expand Down Expand Up @@ -32,10 +42,9 @@ export default {
},
svgClass() {
if (this.className) {
return 'svg-icon ' + this.className
} else {
return 'svg-icon'
return `svg-icon ${this.className}`
}
return 'svg-icon'
},
styleExternalIcon() {
return {
Expand Down
Loading

0 comments on commit ca833ac

Please sign in to comment.