Skip to content

Lint pug template #640

Closed
Closed
@Aysnine

Description

@Aysnine

Tell us about your environment

  • ESLint Version: 5.8.0
  • eslint-plugin-vue Version: 5.0.0-0
  • Node Version: 8.12.0

Please show your full configuration:

{
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint"
  },
  "dependencies": {
    "vue": "^2.5.17"
  },
  "devDependencies": {
    "@vue/cli-plugin-babel": "^3.1.1",
    "@vue/cli-plugin-eslint": "^3.1.1",
    "@vue/cli-service": "^3.1.1",
    "@vue/eslint-config-prettier": "^4.0.0",
    "babel-eslint": "^10.0.1",
    "eslint": "^5.8.0",
    "eslint-plugin-vue": "^5.0.0-0",
    "pug": "^2.0.3",
    "pug-plain-loader": "^1.0.0",
    "stylus": "^0.54.5",
    "stylus-loader": "^3.0.2",
    "vue-template-compiler": "^2.5.17"
  },
  "eslintConfig": {
    "root": true,
    "env": {
      "node": true
    },
    "extends": [
      "plugin:vue/essential",
      "@vue/prettier"
    ],
    "rules": {
      "prettier/prettier": [
        "warn",
        {
          "singleQuote": true,
          "semi": false,
          "trailingComma": "none"
        }
      ]
    },
    "parserOptions": {
      "parser": "babel-eslint"
    }
  },
  "postcss": {
    "plugins": {
      "autoprefixer": {}
    }
  },
  "browserslist": [
    "> 1%",
    "last 2 versions",
    "not ie <= 8"
  ]
}

What did you do? Please include the actual source code causing the issue.

<template lang="pug">
  #app
    img(alt='Vue logo', src='./assets/logo.png')
    hello-world(msg='Welcome to Your Vue.js App')
</template>

<script>
import HelloWorld from './components/HelloWorld.vue'

export default {
  name: 'app',
  components: {
    HelloWorld
  }
}
</script>

What did you expect to happen?

  • Create vue app by vue-cli3 with lint ( eslint & prettier )
  • Add pug support, yarn add pug pug-plain-loader -D
  • Edit the template of App.vue use pug, got incorrect lint.

What actually happened? Please include the actual, raw output from ESLint.

 WARNING  Compiled with 1 warnings                                             15:54:43
Module Warning (from ./node_modules/@vue/cli-plugin-eslint/node_modules/eslint-loader/index.js):
warning: Replace `⏎····img(alt='Vue·logo',·src='./assets/logo.png')⏎····hel
lo-world(msg='Welcome·to` with `·img(alt='Vue·logo',·src='./assets/logo.png')·hell
o-world(msg='Welcome·to⏎·` (prettier/prettier) at src\App.vue:2:7:
  1 | <template lang="pug">
> 2 |   #app
    |       ^
  3 |     img(alt='Vue logo', src='./assets/logo.png')
  4 |     hello-world(msg='Welcome to Your Vue.js App')
  5 | </template>


1 warning found.
1 warning potentially fixable with the `--fix` option.

yarn lint --fix then

<template lang="pug">
  #app img(alt='Vue logo', src='./assets/logo.png') hello-world(msg='Welcome to
  Your Vue.js App')
</template>

<script>
import HelloWorld from './components/HelloWorld.vue'

export default {
  name: 'app',
  components: {
    HelloWorld
  }
}
</script>

work around

<!-- prettier-ignore -->
<template lang="pug">
  #app
    img(alt='Vue logo', src='./assets/logo.png')
    hello-world(msg='Welcome to Your Vue.js App')
</template>

<script>
import HelloWorld from './components/HelloWorld.vue'

export default {
  name: 'app',
  components: {
    HelloWorld
  }
}
</script>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions