Registry / testing / eslint-plugin-vue-pug

eslint-plugin-vue-pug

JSON →
library0.6.2jsnpmunverified

eslint-plugin-vue-pug is an ESLint plugin designed to extend the linting capabilities of `eslint-plugin-vue` to support Pug templates within Vue Single File Components (SFCs). It enables developers to enforce coding standards and identify potential issues directly within their `<template lang="pug">` blocks. The current stable version is `0.6.2`, released in late 2022. Due to the lack of recent commits and releases since then, the package appears to be in a maintenance mode, with infrequent updates or new feature development. Its key differentiator is providing specific linting rules for Pug syntax within the Vue ecosystem, bridging a gap not covered by standard `eslint-plugin-vue` configurations alone. It relies heavily on `eslint-plugin-vue` for its core Vue-specific linting foundation.

npm install eslint-plugin-vue-pug
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-VUE-
E
eslint-plugin-vue-pug
testingjavascriptv0.6.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Plugin registration
{ "plugins": [ "vue-pug" ] }
const vuePugPlugin = require('eslint-plugin-vue-pug'); // This is how ESLint internally loads the plugin, not for user configuration.
ESLint plugins are registered in the `plugins` array of your `.eslintrc` configuration file, making their rules and recommended configs available.
Recommended configuration
{ "extends": [ "plugin:vue/vue3-recommended", "plugin:vue-pug/recommended" ] }
{ "extends": [ "plugin:vue-pug" ] } // Missing '/recommended' suffix, will not load predefined rules.
To leverage the recommended rules provided by `eslint-plugin-vue-pug`, extend its configuration after the base `eslint-plugin-vue` recommended config.
Individual rule
{ "rules": { "vue-pug/no-bare-template-tag": "error" } }
{ "rules": { "no-bare-template-tag": "error" // Rules must be prefixed with the plugin name. } }
When configuring individual rules, you must prefix them with `vue-pug/` to indicate they belong to this plugin.

Demonstrates how to install and configure `eslint-plugin-vue-pug` in an ESLint configuration file (`.eslintrc.cjs`) for a Vue 3 project using Pug templates. This setup enables basic linting rules for Pug within Vue Single File Components, integrating with the recommended configurations of both `eslint` and `eslint-plugin-vue`.

module.exports = { root: true, env: { node: true, browser: true }, extends: [ 'eslint:recommended', 'plugin:vue/vue3-recommended', // Or vue2-recommended, essential, etc. 'plugin:vue-pug/recommended' // Integrates Pug-specific linting ], parserOptions: { ecmaVersion: 2020, sourceType: 'module', // The parser for <script> blocks in Vue SFCs parser: '@babel/eslint-parser', // Or '@typescript-eslint/parser' if using TypeScript requireConfigFile: false }, rules: { // Example of a specific vue-pug rule 'vue-pug/no-bare-template-tag': 'error', 'vue-pug/no-dupe-attributes': 'error', 'vue-pug/attribute-hyphenation': ['error', 'always'], // General ESLint rules 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off', 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off' } };
Debug
Known issues
breakingVersion `0.6.0` removed the `vca-style` configuration option and instead aligned with `vue3-recommended`. Users migrating from older versions that relied on `vca-style` for Vue Composition API linting will need to update their extends configuration.
fix
Update your `.eslintrc` configuration to use `plugin:vue/vue3-recommended` (or another appropriate `eslint-plugin-vue` recommended config) and ensure `plugin:vue-pug/recommended` is also listed.
affects: >=0.6.0
gotchaThis plugin has a peer dependency on `eslint-plugin-vue`. Mismatched versions between the two plugins can lead to unexpected parsing errors, unapplied rules, or complete failure of the linting process.
fix
Ensure that your installed version of `eslint-plugin-vue` satisfies the peer dependency range specified by `eslint-plugin-vue-pug`. Typically, running `npm install` or `yarn install` will alert you to peer dependency issues, or explicitly install compatible versions.
affects: >=0.1.0
gotchaWhile `eslint-plugin-vue-pug` adds rules for Pug, it relies on `@vue/eslint-parser` (which is typically part of `eslint-plugin-vue`'s setup) to actually parse the Pug template syntax. Incorrect `parserOptions.parser` configuration for the `<script>` blocks (e.g., missing Babel or TypeScript parser) can prevent ESLint from properly processing Vue SFCs, even if Pug linting rules are defined.
fix
Ensure your `.eslintrc` includes an appropriate `parser` in `parserOptions` (e.g., `@babel/eslint-parser` for JavaScript or `@typescript-eslint/parser` for TypeScript) to handle the `<script>` sections of your Vue files, as `@vue/eslint-parser` handles the overall SFC structure and template.
affects: >=0.1.0
Errors
Common errors & fixes
Error: Failed to load plugin 'vue-pug' declared in '...', It was not found.
The `eslint-plugin-vue-pug` package is not installed or incorrectly referenced in the ESLint configuration.
fix
Ensure `eslint-plugin-vue-pug` is installed: `npm install eslint-plugin-vue-pug eslint-plugin-vue --save-dev` or `yarn add -D eslint-plugin-vue-pug eslint-plugin-vue`. Verify the plugin name 'vue-pug' is correctly spelled in your `.eslintrc` plugins array.
Error: Parsing error: The template requires a parser to be specified.
This error typically indicates that `@vue/eslint-parser` or another template-aware parser is not correctly configured for your `.vue` files, or that it cannot correctly interpret the Pug syntax.
fix
Ensure `eslint-plugin-vue` is correctly configured and its recommended configuration is extended, as it brings in `@vue/eslint-parser`. Also, verify that the Pug templates themselves are well-formed and valid Pug syntax.
Error: Invalid configuration for rule 'vue-pug/some-rule-name'
The specified rule does not exist, is misspelled, or is not available in the currently loaded version of the plugin.
fix
Double-check the rule name for typos. Refer to the `eslint-plugin-vue-pug` documentation or its `lib/rules` directory on GitHub to confirm available rule names and their options.
Upgrade
Version history
0.6.2latest on npm
Audit
Dependencies
eslint-plugin-vuerequiredProvides core Vue.js linting functionality and the parser (`@vue/eslint-parser`) which handles Pug templates. This plugin extends its capabilities.
Agent activity
2 hits · last 30 days
node
2
Resources
eslint-plugin-vue-pug — npm install eslint-plugin-vue-pug · libregistry