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
--fixand 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.0andvue-eslint-parser^10.0.0
Install
sh
npm install --save-dev eslint eslint-plugin-vue vue-eslint-parser eslint-plugin-pug-vuesh
pnpm add -D eslint eslint-plugin-vue vue-eslint-parser eslint-plugin-pug-vuesh
yarn add -D eslint eslint-plugin-vue vue-eslint-parser eslint-plugin-pug-vueConfigure
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 fixedTo fix on save in VS Code, see Editor setup.
Next steps
- Configuration: the two configs,
baseIndent, keeping a suppressed rule. - Rules: what each
vue-pug/*rule does and its options. - Known limitations before you roll it out on a large codebase.
- Coming from
eslint-plugin-vue-pug? Read the migration guide.