# Getting Started

> How to set up HTMLHint in your project by adding it as a dev dependency and configuring it.

1\. Use npm or yarn to install HTMLHint:

* npm

  `npm install --save-dev htmlhint`

* yarn

  `yarn add --dev htmlhint`

2\. Create a `.htmlhintrc` configuration file in the root of your project with `htmlhint --init`. This will create a file with default rules. You can customize it as needed. For example, you can use the following configuration to enforce some common best practices:

```json
{
  "alt-require": true,
  "attr-lowercase": true,
  "attr-no-duplication": true,
  "attr-value-double-quotes": true,
  "attr-value-no-duplication": true,
  "button-type-require": true,
  "doctype-first": true,
  "doctype-html5": true,
  "frame-title-require": true,
  "h1-require": true,
  "html-lang-require": true,
  "id-unique": true,
  "input-requires-label": true,
  "main-require": true,
  "meta-charset-require": true,
  "meta-description-require": true,
  "meta-viewport-require": true,
  "spec-char-escape": true,
  "src-not-empty": true,
  "tag-no-obsolete": true,
  "tag-pair": true,
  "tagname-lowercase": true,
  "title-require": true
}
```

3\. Run HTMLHint on, for example, all the HTML files in your project:

```shell
npx htmlhint "**/*.html"
```