{"id":19883,"library":"eslint-plugin-pug","title":"eslint-plugin-pug","description":"ESLint plugin for linting inline JavaScript in Pug template files, currently at version 1.2.7. It extracts script tags without a type attribute or with type text/javascript and lints them using ESLint rules. The plugin processes .pug and .jade files, creating virtual files for linting. It has a simple setup with both processor and rules config. Alternative: eslint-plugin-html for HTML. Released under Unlicense with no dependencies.","status":"active","version":"1.2.7","language":"javascript","source_language":"en","source_url":"https://github.com/valpackett/eslint-plugin-pug","tags":["javascript","eslint","eslintplugin","eslint-plugin","lint","pug","jade"],"install":[{"cmd":"npm install eslint-plugin-pug","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-pug","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-pug","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM-only for eslint v9 flat config; CJS require works for v8.","wrong":"const pug = require('eslint-plugin-pug')","symbol":"default","correct":"import pug from 'eslint-plugin-pug'"},{"note":"Plugin is a default export, named export is not available.","wrong":"import { pug } from 'eslint-plugin-pug'","symbol":"pug","correct":"import pug from 'eslint-plugin-pug'"},{"note":"ESLint flat config requires plugin object, not string.","wrong":"plugins: ['pug']","symbol":"plugins","correct":"plugins: { pug }"}],"quickstart":{"code":"// eslint.config.js (ESLint v9+)\nimport { defineConfig } from 'eslint/config';\nimport pugPlugin from 'eslint-plugin-pug';\n\nexport default defineConfig([\n  {\n    name: 'pug-processor',\n    files: ['**/*.pug'],\n    plugins: { pug: pugPlugin },\n    processor: 'pug/pug',\n  },\n  {\n    name: 'pug-rules',\n    files: ['**/*.pug.mjs'],\n    rules: {\n      '@stylistic/eol-last': ['error', 'never'],\n    },\n  },\n]);","lang":"javascript","description":"Shows minimal ESLint flat config to lint inline scripts in .pug files with a processeor and custom rule."},"warnings":[{"fix":"Use flat config with processor and rules separate sections; import default export.","message":"ESLint v9 flat config requires processor and rules config split, plugin must be imported default.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Ensure your script tags have no type attribute or type='text/javascript'.","message":"Only script tags without type or with type 'text/javascript' are linted; other scripts are ignored.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Set files in rules config to ['**/*.pug.js', '**/*.pug.mjs'] (or similar).","message":"Virtual files are created with extensions .pug.js or .pug.mjs; rules must target these patterns.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Migrate to flat config (eslint.config.js).","message":"ESLint v8 .eslintrc style config is not supported with v9; plugin must be used in flat config.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Use a separate tool like pug-lint for Pug syntax validation.","message":"Processor only extracts inline scripts; does not lint Pug syntax itself.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"npm install --save-dev eslint-plugin-pug","cause":"Plugin not installed or missing in package.json.","error":"Error: Failed to load plugin 'pug' declared in 'plugins': Cannot find module 'eslint-plugin-pug'"},{"fix":"import pug from 'eslint-plugin-pug' not import { pug } from ...","cause":"Using named import instead of default import in flat config.","error":"TypeError: Cannot read properties of undefined (reading 'pug')"},{"fix":"Set processor: 'pug/pug' after adding plugin with key 'pug'.","cause":"Processor string must be '<plugin>/<processorName>' with correct plugin name/alias.","error":"ESLint configuration for processor is invalid: \"pug/pug\" is not a valid processor."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}