Vue Pug ESLint Plugin

0.6.2 · maintenance · verified Sun Apr 19

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.

Common errors

Warnings

Install

Imports

Quickstart

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'
  }
};

view raw JSON →