question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Lint pug template

See original GitHub issue

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>

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

7reactions
Shinigami92commented, Aug 22, 2021

Author of https://github.com/prettier/plugin-pug here.

Please watch/star https://github.com/Shinigami92/eslint-plugin-vue-pug-sfc I will try to tackle eslint vue pug support in next time

1reaction
Shinigami92commented, Sep 16, 2021

https://www.npmjs.com/package/eslint-plugin-vue-pug-sfc/v/1.0.0-alpha.2 👀

This is a first alpha and “supports” vue-pug-sfc/this-in-template for the never option. always is currently NOT supported due to it is much harder to implement.

Please give it a try and please also start to create issues in the repo for every rule you want to get support for! Please do NOT use the --fix option right know (or at least with a backup), cause it can damage your code! The ranges are not accurate yet so the ~~~~ lines are positioned to broad right now.

Please also feel free to jump into the code and help me 😃 If you use VSCode jump into the Debug Launcher and run the tests with debug-breakpoints.


Please note, if you consider this plugin as helpful, that I’m open to receive money via GitHub sponsoring. I would really appreciate it.


I will not spam here anymore, so please lets move all discussions to the project’s repo.

Read more comments on GitHub >

github_iconTop Results From Across the Web

pugjs/pug-lint: An unopinionated and configurable linter ...
pug -lint. An unopinionated and configurable linter and style checker for Pug (formerly Jade). build status coverage status dependency status npm ...
Read more >
pug-lint | Yarn - Package Manager
pug -lint. An unopinionated and configurable linter and style checker for Pug (formerly Jade). build status coverage status dependency status npm ...
Read more >
Pug-lint | npm.io
An unopinionated and configurable linter and style checker for Pug (formerly Jade). puglintjadelintpug-lintjade-lintpugjadelintcode styleformatterstyle ...
Read more >
Migrating to Pug 2 - Pug.js
Removed Language Features ¶. Most of these removals can be automatically detected by pug-lint , our official linter.
Read more >
pug-lint - npm
An unopinionated and configurable linter and style checker for Pug (formerly Jade). Latest version: 2.6.0, last published: 4 years ago.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found