Registry / testing / pug-lint

pug-lint

JSON →
library2.7.0jsnpmunverified

An unopinionated and configurable linter and style checker for Pug (formerly Jade). Current stable version is 2.7.0, released in 2016 with no further updates. The project is effectively abandoned; no releases since 2016. It provides a CLI, configuration via .pug-lintrc files or package.json, and supports extending configs from npm packages. Key differentiators: highly configurable with many rules, but no longer maintained, so use with caution.

npm install pug-lint
INSTALL
IMPORT
SIG · PUG-LINT
P
pug-lint
testingjavascriptv2.7.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

Linter
import { Linter } from 'pug-lint'
const Linter = require('pug-lint').Linter
Correct import for the Linter class in modern usage.
default
import pugLint from 'pug-lint'
const pugLint = require('pug-lint').default
Default export is the Linter constructor.
ConfigFile
import { loadConfig } from 'pug-lint/lib/config'
Internal helper; not part of public API but sometimes used.

Shows how to create a linter instance, configure it with rules, and lint a Pug string.

const pugLint = require('pug-lint'); const linter = new pugLint(); linter.configure({ rules: { 'disallowIdLiterals': true } }); const results = linter.checkString('div#my-id'); console.log(results);
pug-lint --version
Debug
Known issues
deprecatedDeprecated preset configuration option in favour of extends.
fix
Use extends property in config file instead of preset.
affects: >=2.2.0
gotchaConfiguration file loading can be inconsistent with .pug-lintrc.js needing module.exports.
fix
Ensure .pug-lintrc.js exports a config object via module.exports.
affects: >=2.0.0
gotchaSome rules like 'validateIndentation' may not report correct column numbers in older versions.
fix
Update to v2.1.8+ or adjust error parsing.
affects: <2.1.8
Errors
Common errors & fixes
Error: Cannot find module 'pug-lexer'
Missing peer dependency pug-lexer.
fix
Install pug-lexer: npm install pug-lexer
TypeError: linter.configure is not a function
Using default import incorrectly (e.g. import pugLint from 'pug-lint' without calling new).
fix
Use const linter = new pugLint.Linter() or import { Linter } from 'pug-lint' and then new Linter().
Error: No configuration found for pug-lint
Missing .pug-lintrc or package.json pugLintConfig.
fix
Create a .pug-lintrc file or add pugLintConfig to package.json.
Upgrade
Version history
2.7.0latest on npm
Audit
Dependencies
pug-lexerrequiredParses Pug templates into tokens for linting.
Agent activity
6 hits · last 30 days
node
6
Resources
pug-lint — npm install pug-lint · libregistry