Skip to content

'v-else-if' directives require that attribute value #921

Closed
@shiyingyan

Description

@shiyingyan
  • ESLint Version: 5.8.0
  • Node Version: 8.10.0
  • npm Version: 3.5.2

What parser (default, Babel-ESLint, etc.) are you using? eslint-plugin-vue

//package.json config file
{
  "name": "mj-tools-vue",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint"
  },
  "dependencies": {
    "ace-builds": "^1.4.5",
    "ant-design-vue": "^1.3.5",
    "axios": "^0.18.0",
    "babel-plugin-import": "^1.11.0",
    "echarts": "^4.2.1",
    "less": "^3.9.0",
    "less-loader": "^4.1.0",
    "moment": "^2.24.0",
    "readline": "^1.3.0",
    "register-service-worker": "^1.5.2",
    "reset-css": "^4.0.1",
    "vue": "^2.6.6",
    "vue-analog-clock": "^1.0.2",
    "vue-piczoom": "^1.0.6",
    "vue-router": "^3.0.1",
    "vuex": "^3.1.0"
  },
  "devDependencies": {
    "@vue/cli-plugin-babel": "^3.4.0",
    "@vue/cli-plugin-eslint": "^3.4.0",
    "@vue/cli-plugin-pwa": "^3.4.0",
    "@vue/cli-service": "^3.7.0",
    "@vue/eslint-config-airbnb": "^4.0.0",
    "ace-builds": "^1.4.5",
    "babel-eslint": "^10.0.1",
    "eslint": "^5.8.0",
    "eslint-plugin-vue": "^5.0.0",
    "lint-staged": "^8.1.0",
    "node-sass": "^4.9.0",
    "sass-loader": "^7.1.0",
    "vue-analog-clock": "^1.0.2",
    "vue-directive-image-previewer": "^2.2.1",
    "vue-template-compiler": "^2.5.21"
  },
  "lint-staged": {
    "*.js": [
      "vue-cli-service lint",
      "git add"
    ],
    "*.vue": [
      "vue-cli-service lint",
      "git add"
    ]
  },
  "description": "## Project setup ``` npm install ```",
  "main": ".eslintrc.js",
  "repository": {
    "type": "git",
    "url": "xx"
  },
  "keywords": [],
  "author": "",
  "license": "ISC"
}


        // my source code
        <template v-for="col in columns" :slot="col.dataIndex" slot-scope="text, record">
          <div :key="col.dataIndex">
            <template v-if="col.dataIndex==='execStatus'">{{taskStatus[record[col.dataIndex]]}}</template>
            <template
              v-else-if="col.dataIndex==='userCancelMark'"
            >{{userCancelMark[record[col.dataIndex].toString()]}}</template>
            <template
              v-else-if="col.dataIndex==='m2Status'"
            >{{taskContinueCreateM2Status[record[col.dataIndex]]}}</template>
            <template
              v-else-if="col.dataIndex==='resultAnalysisFlag'"
            >{{record[col.dataIndex]===true?'Y':'N'}}</template>
            <template
              v-else-if="['submitTime','startTime','finishTime','lastUpdateTime'].indexOf(col.dataIndex)!===-1"
            >{{timestampToDateStr(new Date(record[col.dataIndex]).getTime())}}</template>
              <!-- v-else-if="col.dataIndex==='submitTime' || col.dataIndex==='startTime' || col.dataIndex==='finishTime' || col.dataIndex==='lastUpdateTime' " -->
            <template v-else>{{text}}</template>
          </div>
        </template>

What did you expect to happen?
v-else-if directive , 可以使用数组indexOf或者includes判断元素是否存在, 而不是必须连续使用几个或等于

What actually happened? Please include the actual, raw output from ESLint.
[vue/valid-v-else-if]
'v-else-if' directives require that attribute value.eslint-plugin-vue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions