# pug-lint

> An unopinionated and configurable linter and style checker for Pug (formerly Jade)

Latest version **2.7.0** (published 2023-03-21) · ISC license · 0 weekly downloads

## Install

```sh
npm install pug-lint
pnpm add pug-lint
yarn add pug-lint
bun add pug-lint
```

Provides the command `pug-lint`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.7.0 |
| Published | 2023-03-21 |
| First published | 2015-12-17 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 13 |
| Unpacked size | 125.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 226 |
| Author | Ben Edwards |
| Maintainers | benedfit, forbeslindesay, timothygu, adrienverge |
| Keywords | puglint, jadelint, pug-lint, jade-lint, pug, jade, lint, code style, formatter, style guide, validate, lint pug, lint jade, pug lint, jade lint, linter, linter pug, linter jade, pug linter, jade linter, pug-linter, jade-linter, linting, linting pug, linting jade, pug linting, jade linting, pug-linting, jade-linting, hint, hint pug, hint jade, pug hint, jade hint, pug-hint, jade-hint, hinter, hinter pug, hinter jade, pug hinter, jade hinter, pug-hinter, jade-hinter, hinting, hinting pug, hinting jade, pug hinting, jade hinting, pug-hinting, jade-hinting |

## Links

- npm: https://www.npmjs.com/package/pug-lint
- Repository: https://github.com/pugjs/pug-lint
- Issues: https://github.com/pugjs/pug-lint/issues
- npm.io page: https://npm.io/package/pug-lint

## Dependencies (13)

- [glob](https://npm.io/package/glob.md) ^7.0.3
- [acorn](https://npm.io/package/acorn.md) ^4.0.1
- [resolve](https://npm.io/package/resolve.md) ^1.1.7
- [commander](https://npm.io/package/commander.md) ^2.9.0
- [minimatch](https://npm.io/package/minimatch.md) ^3.0.3
- [pug-attrs](https://npm.io/package/pug-attrs.md) ^2.0.4
- [pug-error](https://npm.io/package/pug-error.md) ^1.3.3
- [pug-lexer](https://npm.io/package/pug-lexer.md) ^4.1.0
- [void-elements](https://npm.io/package/void-elements.md) ^2.0.1
- [find-line-column](https://npm.io/package/find-line-column.md) ^0.5.2
- [path-is-absolute](https://npm.io/package/path-is-absolute.md) ^1.0.0
- [css-selector-parser](https://npm.io/package/css-selector-parser.md) ^1.1.0
- [strip-json-comments](https://npm.io/package/strip-json-comments.md) ^2.0.1

## Alternatives

- [eslint-plugin-sonarjs](https://npm.io/package/eslint-plugin-sonarjs.md) — 2.9M weekly downloads
- [eslint-config-expo](https://npm.io/package/eslint-config-expo.md) — 1.5M weekly downloads
- [@matter/protocol](https://npm.io/package/@matter/protocol.md) — 63.5K weekly downloads
- [@eventcatalog/linter](https://npm.io/package/@eventcatalog/linter.md) — 24.8K weekly downloads
- [@inrupt/eslint-config-base](https://npm.io/package/@inrupt/eslint-config-base.md) — 4.5K weekly downloads

## Recent versions

- 2.7.0 (latest) — 2023-03-21
- 2.6.0 — 2019-06-24
- 2.5.0 — 2017-09-03
- 2.4.0 — 2017-02-01
- 2.3.0 — 2016-07-18
- 2.2.2 — 2016-06-06
- 2.2.1 — 2016-06-06
- 2.2.0 — 2016-06-02
- 2.1.10 — 2016-06-01
- 2.1.9 — 2016-06-01
- 2.1.8 — 2016-05-31
- 2.1.7 — 2016-04-18
- 2.1.6 — 2016-02-25
- 2.1.5 — 2016-02-25
- 2.1.4 — 2016-02-25
- … 4 more at https://npm.io/package/pug-lint/versions

## README

# pug-lint

An unopinionated and configurable linter and style checker for Pug (formerly Jade)

[![build status](https://img.shields.io/travis/pugjs/pug-lint/master.svg)](https://travis-ci.org/pugjs/pug-lint)
[![coverage status](https://img.shields.io/codecov/c/github/pugjs/pug-lint/master.svg)](https://codecov.io/gh/pugjs/pug-lint)
[![dependency status](https://img.shields.io/david/pugjs/pug-lint.svg)](https://david-dm.org/pugjs/pug-lint)
[![npm](https://img.shields.io/npm/v/pug-lint.svg)](https://www.npmjs.com/package/pug-lint)

## CLI

### Installation

```shell
$ npm install -g pug-lint
```

### Usage

```shell
$ pug-lint [options] <file ...>
```

#### Options

* `-h, --help`: output usage information
* `-V, --version`: output the version number
* `-c, --config <path>`: [configuration file](#configuration-file) path
* `-r, --reporter <reporter>`: error reporter; console - default, inline

## Editor integration

### Sublime Text 3

If you use SublimeLinter 3 with Sublime Text 3, you can install the
[SublimeLinter-pug-lint](https://github.com/SublimeLinter/SublimeLinter-pug-lint)
plugin using [Package Control](https://packagecontrol.io/).

### Atom

If you use Atom, you can install the [linter-pug](https://atom.io/packages/linter-pug) package.

### VS Code

If you use VS Code, you can install the [vscode-puglint](https://marketplace.visualstudio.com/items?itemName=mrmlnc.vscode-puglint) extension.

### Vim

pug-lint is part of [syntastic](https://github.com/scrooloose/syntastic).

If you are using [vim-plug](https://github.com/junegunn/vim-plug) to manage your
Vim plugins (recommended), you can do:

```
" In your ~/.vimrc
Plug 'scrooloose/syntastic'
" Then run these commands
:source %
:PlugInstall
```

Then to turn the pug linter on, you will need this line in your `.vimrc`.

```
let g:syntastic_pug_checkers = ['pug_lint']
```

## Build system integration

### Gulp

If you're using Gulp as your build system, you can use [gulp-pug-linter](https://github.com/ilyakam/gulp-pug-linter) for easier integration.

### Grunt

If you're using Grunt as your build system, you can use [grunt-puglint](https://github.com/mrmlnc/grunt-puglint) for easier integration.

## Configuration file

Options and rules can be specified in a `.pug-lintrc`, `.pug-lintrc.js`, or `.pug-lintrc.json` file, or via adding a `"pugLintConfig"` option to `package.json`.

### Options

#### preset `deprecated`

Presets have been deprecated in favour of [extending configuration files](#extends).

> Instructions for those wishing to continue to use the rules defined in the deprecated `clock` preset can be found at https://github.com/pugjs/pug-lint/issues/80#issuecomment-223283681

#### extends

Type: `string`

If you want to extend a specific configuration file, you can use the `extends` property and specify the path to the file. The path can be either relative or absolute

Configurations can be extended by using:

1. JSON file
2. JS file
3. [Shareable configuration package](#shareable-configuration-packages)

The extended configuration provides base rules, which can be overridden by the configuration that references it. For example:

```json
{
  "extends": "./node_modules/coding-standard/.pug-lintrc",
  "disallowIdLiterals": null
}
```

You can also extend configurations using [shareable configuration packages](#shareable-configuration-packages). To do so, be sure to install the configuration package you want from npm and then use the package name, such as:

```shell
$ npm install --save-dev pug-lint-config-clock
```

```json
{
  "extends": "pug-lint-config-myrules",
  "disallowIdLiterals": null
}
```

In this example, the `pug-lint-config-myrules` package will be loaded as an object and used as the parent of this configuration. You can override settings from the shareable configuration package by adding them directly into your `.pug-lintrc` file.

You can find config to extend on NPM using [`"pug-lint-config"` query](https://www.npmjs.com/search?q=pug-lint-config).

> **Note**: You can omit `pug-lint-config-` and pug-lint will automatically insert it for you

#### excludeFiles

Type: `Array`

Default: `["node_modules/**"]`

Disables style checking for specified paths declared with glob patterns.

#### additionalRules

Type: `Array`

Array of file path matching patterns to load additional rules from, e.g.:

```json
{
  "additionalRules": ["project-rules/*.js"]
}
```

### Rules

[List of available rules](docs/rules.md)

You can specifically disable any rule by omitting it from your `.pug-lintrc` config file or by assigning it to null, like so:

```json
{
  "disallowBlockExpansion": null
}
```

Some rules, if enabled at the same time, would be contradictory to one another, such as:

```json
{
  "disallowSpaceAfterCodeOperator": true,
  "requireSpaceAfterCodeOperator": true
}
```

In this case `requireSpaceAfterCodeOperator` is treated as null, and ignored.

### Shareable configuration packages

Shareable configs are simply npm packages that export a configuration object. To start, [create a Node.js module](https://docs.npmjs.com/getting-started/creating-node-modules) like you normally would. Make sure the module name begins with `pug-lint-config-`, such as `pug-lint-config-myconfig`. Create a new index.js file and export an object containing your settings:

```js
module.exports = {
  disallowBlockExpansion: true
};
```

Once your shareable config is ready, you can [publish to npm](https://docs.npmjs.com/getting-started/publishing-npm-packages) to share with others. We recommend using the [`puglint`](https://www.npmjs.com/browse/keyword/puglint) and [`puglintconfig`](https://www.npmjs.com/browse/keyword/puglintconfig) keywords so others can easily find your module.

---
_Source: https://npm.io/package/pug-lint · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
