Registry / testing / eslint-plugin-pug

eslint-plugin-pug

JSON →
library1.2.7jsnpmunverified

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.

npm install eslint-plugin-pug
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-PUG
E
eslint-plugin-pug
testingjavascriptv1.2.7
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.

default
import pug from 'eslint-plugin-pug'
const pug = require('eslint-plugin-pug')
ESM-only for eslint v9 flat config; CJS require works for v8.
pug
import pug from 'eslint-plugin-pug'
import { pug } from 'eslint-plugin-pug'
Plugin is a default export, named export is not available.
plugins
plugins: { pug }
plugins: ['pug']
ESLint flat config requires plugin object, not string.

Shows minimal ESLint flat config to lint inline scripts in .pug files with a processeor and custom rule.

// eslint.config.js (ESLint v9+) import { defineConfig } from 'eslint/config'; import pugPlugin from 'eslint-plugin-pug'; export default defineConfig([ { name: 'pug-processor', files: ['**/*.pug'], plugins: { pug: pugPlugin }, processor: 'pug/pug', }, { name: 'pug-rules', files: ['**/*.pug.mjs'], rules: { '@stylistic/eol-last': ['error', 'never'], }, }, ]);
Debug
Known issues
breakingESLint v9 flat config requires processor and rules config split, plugin must be imported default.
fix
Use flat config with processor and rules separate sections; import default export.
affects: >=1.0.0
gotchaOnly script tags without type or with type 'text/javascript' are linted; other scripts are ignored.
fix
Ensure your script tags have no type attribute or type='text/javascript'.
affects: >=0.1.0
gotchaVirtual files are created with extensions .pug.js or .pug.mjs; rules must target these patterns.
fix
Set files in rules config to ['**/*.pug.js', '**/*.pug.mjs'] (or similar).
affects: >=1.0.0
deprecatedESLint v8 .eslintrc style config is not supported with v9; plugin must be used in flat config.
fix
Migrate to flat config (eslint.config.js).
affects: >=1.0.0
gotchaProcessor only extracts inline scripts; does not lint Pug syntax itself.
fix
Use a separate tool like pug-lint for Pug syntax validation.
affects: >=0.1.0
Errors
Common errors & fixes
Error: Failed to load plugin 'pug' declared in 'plugins': Cannot find module 'eslint-plugin-pug'
Plugin not installed or missing in package.json.
fix
npm install --save-dev eslint-plugin-pug
TypeError: Cannot read properties of undefined (reading 'pug')
Using named import instead of default import in flat config.
fix
import pug from 'eslint-plugin-pug' not import { pug } from ...
ESLint configuration for processor is invalid: "pug/pug" is not a valid processor.
Processor string must be '<plugin>/<processorName>' with correct plugin name/alias.
fix
Set processor: 'pug/pug' after adding plugin with key 'pug'.
Upgrade
Version history
1.2.7latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
eslint-plugin-pug — npm install eslint-plugin-pug · libregistry