# @htmllinter/basic-rules

> basic standard for htmllinter used for setting the standard the config

Latest version **0.5.1** (published 2020-06-02) · 0 weekly downloads

## Install

```sh
npm install @htmllinter/basic-rules
pnpm add @htmllinter/basic-rules
yarn add @htmllinter/basic-rules
bun add @htmllinter/basic-rules
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.5.1 |
| Published | 2020-06-02 |
| First published | 2020-02-28 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 36.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 19 |
| Author | anikethsaha |
| Maintainers | anixsaha |
| Keywords | linter, standard, config, htmllinter, lint |

## Links

- npm: https://www.npmjs.com/package/@htmllinter/basic-rules
- Repository: https://github.com/anikethsaha/htmllinter
- Homepage: https://github.com/anikethsaha/htmllinter#readme
- Issues: https://github.com/anikethsaha/htmllinter/issues
- npm.io page: https://npm.io/package/@htmllinter/basic-rules

## Dependencies (1)

- [@htmllinter/core](https://npm.io/package/@htmllinter/core.md) ^0.5.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
- [@pandacss/eslint-plugin](https://npm.io/package/@pandacss/eslint-plugin.md) — 18.7K weekly downloads

## Recent versions

- 0.5.1 (latest) — 2020-06-02
- 0.5.0 — 2020-05-24
- 0.4.0 — 2020-05-09
- 0.3.0 — 2020-02-29
- 0.2.0 — 2020-02-28

## README

# @htmllinter/basic-rules

this package contains rules for `htmllinter`
Comes by default with `@htmllinter/basic-config`

## Direct use as plugin

### Installation

```shell
npm install @htmllinter/core @htmllinter/basic-rules --save-dev
```

### Usage

in your `htmllinter.config.js` file

```js
module.exports = {
  plugins: [require('@htmllinter/basic-rules')],
};
```

## Usage with `@htmllinter/basic-config`

### Config Installation

```shell
npm install @htmllinter/core @htmllinter/basic-config --save-dev
```

### Config Usage

in your `htmllinter.config.js` file

```js
module.exports = {
  extend: [require('@htmllinter/basic-config')],
};
```

## Rules

### 1. `no-empty-tag`

This rule throws error when there is an empty html tag used.

`example`

```html
<a href="">click here</a>
<p></p>
```

Here, the `p` tag is empty. It will throw error like this.

```
┌────────────────────────────────┬──────────────┐
│ Message                        │ Rule Name    │
├────────────────────────────────┼──────────────┤
│ the tag < p >  has no content. │ no-empty-tag │
└────────────────────────────────┴──────────────┘
```

### 2. `no-duplicate-id`

This rule throws error when there are more than one id of same value being declared.

`example`

```html
<a id="sameID">adMy First Headings</a>
<h3 id="sameID">My First Heading</h3>
```

here, the `sameID` in `h3` is mark as duplicate

```
┌───────────────────────────┬─────────────────┐
│ Message                   │ Rule Name       │
├───────────────────────────┼─────────────────┤
│ duplicate ids sameID @ h3 │ no-duplicate-id │
└───────────────────────────┴─────────────────┘
```

### 3. `no-bool-true-explicit-define`

This rule will throw error when attributes as valued as `true` like this `<a enable=true></a>

`example`

```html
<h3 enable="true">My First Heading</h3>
```

output

```
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────┬──────────────────────────────┐
│ Message                                                                                                 │ Rule Name                    │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────┼──────────────────────────────┤
│ the attribute "enable" seems to be boolean with value "true",please conside using "<h3 enable>...</h3>" │ no-bool-true-explicit-define │
│                                                                                                         │                              │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────┴──────────────────────────────┘
```

## Development status

**More rules will be added soon.**

Please contribute with correcting the existing rules or by adding a new rule

## Steps to add new rule in `@htmllinter/basic-standard`

Please create an issue with Title

`[New Rule][Basic]: <Rule-Name>`

We will discuss about the possibility in that issue and you can be the champion of implement it :tada:

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