# posthtml-lint

> PostHTML plugin to lint static markup

Latest version **0.1.1** (published 2019-09-21) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2019-09-21 |
| First published | 2019-06-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 12.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Eric Liu |
| Maintainers | metonym |
| Keywords | html, posthtml, posthtml-plugin, lint |

## Links

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

## Dependencies (1)

- [posthtml](https://npm.io/package/posthtml.md) ^0.11.6

## 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

- 0.1.1 (latest) — 2019-09-21
- 0.1.0 — 2019-06-30

## README

# posthtml-lint <img align="right" width="220" height="200" title="PostHTML logo" src="http://posthtml.github.io/posthtml/logo.svg">

[![NPM][npm]][npm-url]
[![Deps][deps]][deps-url]
[![Build][build]][build-badge]
[![Coverage][codecov-shield]][codecov]

## [Changelog](CHANGELOG.md)

`posthtml-lint` is a [PostHTML](https://github.com/posthtml/posthtml) plugin to lint static markup.

Currently supported rules include `no-duplicate-ids`, `no-duplicate-tags`, `no-empty-tags` and `no-missing-attributes`.

**Before:**

```html
<head>
  <title>Title</title>
  <title>Title</title>
</head>
<body>
  <a>Link</a>
</body>
```

**After:**

```bash
# Output printed to the terminal
There are ...
```

## Install

```bash
yarn add -D posthtml-lint
# OR
npm i posthtml-lint
```

## Usage

```js
const fs = require('fs');
const posthtml = require('posthtml');
const { lint } = require('posthtml-lint');

const html = fs.readFileSync('./index.html');

posthtml()
  .use(lint())
  .process(html)
  .then(result => fs.writeFileSync('./after.html', result.html));
```

### Options

| Name                  | Kind                       | Description                                                                   |
| --------------------- | -------------------------- | ----------------------------------------------------------------------------- |
| `noDuplicateIds`      | `boolean` (default `true`) | Disallow duplicate ids                                                        |
| `noDuplicateTags`     | `boolean` (default `true`) | Disallow duplicate occurrences of the `html`, `head`, `title` and `body` tags |
| `noEmptyTags`         | `boolean` (default `true`) | Disallow empty tags for tags that are not self-closing                        |
| `noMissingAttributes` | `boolean` (default `true`) | Disallow tags with missing required attributes.                               |

### Contributing

See [PostHTML Guidelines](https://github.com/posthtml/posthtml/tree/master/docs) and [contribution guide](CONTRIBUTING.md).

### License

[MIT](LICENSE)

[npm]: https://img.shields.io/npm/v/posthtml-lint.svg?color=blue
[npm-url]: https://npmjs.com/package/posthtml-lint
[deps]: https://david-dm.org/metonym/posthtml-lint.svg
[deps-url]: https://david-dm.org/metonym/posthtml-lint
[build]: https://travis-ci.com/metonym/posthtml-lint.svg?branch=master
[build-badge]: https://travis-ci.com/metonym/posthtml-lint
[codecov]: https://codecov.io/gh/metonym/posthtml-lint
[codecov-shield]: https://img.shields.io/codecov/c/github/metonym/posthtml-lint.svg

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