Skip to content

Getting started ​

eslint-plugin-pug-vue lints and formats <template lang="pug"> (and lang="jade") in Vue single-file components:

  • Your vue/* rules from eslint-plugin-vue run on Pug templates, under their usual names and with your usual options.
  • The vue-pug/* rules format the Pug itself: indentation, attribute layout, quotes, commas, shorthands. One optional rule reports Pug compile-time constructs.
  • Every fix that touches a Pug template is checked before ESLint applies it (the fix guard), so --fix and fix-on-save do not break templates.
  • No Prettier and no separate formatter: fixes come from ESLint.

Requirements ​

  • Node.js ^20.19.0 || ^22.13.0 || >=24
  • ESLint ^9.15.0 || ^10.0.0, flat config only (eslint.config.js)
  • eslint-plugin-vue ^10.0.0 and vue-eslint-parser ^10.0.0

Install ​

sh
npm install --save-dev eslint eslint-plugin-vue vue-eslint-parser eslint-plugin-pug-vue
sh
pnpm add -D eslint eslint-plugin-vue vue-eslint-parser eslint-plugin-pug-vue
sh
yarn add -D eslint eslint-plugin-vue vue-eslint-parser eslint-plugin-pug-vue

Configure ​

js
// eslint.config.js
import pluginVue from 'eslint-plugin-vue'
import vuePug from 'eslint-plugin-pug-vue'

export default [
  ...pluginVue.configs['flat/recommended'],
  ...vuePug.configs.recommended,
]

Put ...vuePug.configs.recommended after the eslint-plugin-vue configs. It sets the parser options, the processor and the rules that must be off for Pug. A later config that sets its own processor, or turns one of the crashing rules back on, breaks linting of Pug files.

Run it ​

sh
npx eslint .          # report problems
npx eslint . --fix    # fix what can be fixed

To fix on save in VS Code, see Editor setup.

Next steps ​

Released under the MIT License.