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.

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.
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.
npm install grunt-puglint
yarn add grunt-puglint
pnpm add grunt-puglint

Installs grunt-puglint and configures a Grunt task to lint Pug files with custom rules.

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