grunt-puglint
raw JSON → 1.0.0 verified Fri May 01 auth: no javascript
A Grunt plugin for linting Pug (formerly Jade) templates using pug-lint. Current stable version is 1.0.0, which updates pug-lint to v2.2.0 and renames the `preset` option to `config`, removing support for `.pugLintRc`. The plugin integrates with Grunt ~1.0.0 and allows configuration via inline rules or presets. Compared to running pug-lint directly, this plugin provides seamless integration into Grunt workflows.
Common errors
error Warning: Task "puglint" not found. ↓
cause The plugin was not loaded with grunt.loadNpmTasks.
fix
Add
grunt.loadNpmTasks('grunt-puglint'); to your Gruntfile. error Fatal error: Cannot find module 'pug-lint' ↓
cause pug-lint is not installed as a dependency.
fix
Run
npm install pug-lint --save-dev. error Invalid options: preset is not allowed. ↓
cause Using the deprecated 'preset' option with grunt-puglint v1.0.0+.
fix
Change
preset to config as described in the documentation. Warnings
breaking The `preset` option has been renamed to `config` in v1.0.0. ↓
fix Replace `preset: 'name'` with `config: { extends: 'name' }`.
breaking Support for `.pugLintRc` file was removed in v1.0.0. ↓
fix Use `config: { extends: '...' }` or a standard `.pug-lintrc` file (with hyphen).
deprecated The `pug-lint-config-clock` preset is deprecated; it may be removed in future versions. ↓
fix Migrate to inline config or a community-supported preset.
gotcha Grunt ~1.0.0 required; using older Grunt may cause undefined behavior. ↓
fix Ensure Grunt version is >=1.0.0.
Install
npm install grunt-puglint yarn add grunt-puglint pnpm add grunt-puglint Imports
- puglint wrong
require('grunt-puglint');correctgrunt.loadNpmTasks('grunt-puglint'); - puglint task configuration wrong
puglint: { options: { preset: 'clock' }, src: ['**/*.pug'] }correctpuglint: { options: { config: { extends: 'clock' } }, src: ['**/*.pug'] } - config file wrong
Using `.pugLintRc` (deprecated)correctUse inline `config` object or `.pug-lintrc` file
Quickstart
npm install grunt-puglint --save-dev
// Gruntfile.js
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-puglint');
grunt.initConfig({
puglint: {
options: {
config: {
validateIndentation: 2,
disallowHtmlText: true
}
},
src: ['templates/**/*.pug']
}
});
grunt.registerTask('default', ['puglint']);
};