open-index/open-npm huggingface dataset:
npm package: @html-validate/commitlint-config
Description: Commitlint sharable config used by the various HTML-validate packages
Author: David Sveningsson
Latest version: 3.6.10

# @html-validate/commitlint-config

> HTML-Validate sharable commitlint config.

## Install

```
npm install --save-dev @html-validate/commitlint-config
```

## Usage

In your `package.json` file:

```json
{
  "scripts": {
    "prepare": "git config commit.template ./node_modules/@html-validate/commitlint-config/gitmessage"
  },
  "commitlint": {
    "extends": ["@html-validate"]
  }
}
```
npm package: @html-validate/jest-config
Description: Jest sharable preset used by the various HTML-validate packages
Author: David Sveningsson
Latest version: 3.16.0

# @html-validate/jest-config

> HTML-Validate jest preset.

Jest is configured to:

- Run tests from `*.spec.[jt]s`.
- Collect coverage from `.js` and `.ts` in `src` and ignore tests (`**/*.spec.[jt]s`) and index (`**/index.[jt]s`).
- Report results as junit in `temp/jest.xml`.
- Transform typescript with `ts-jest`.
- Transform js with `babel-jest` if babel is detected.
- Ignores spec-files from Cypress.

## Install

```
npm install --save-dev @html-validate/jest-config
```

## Usage

In your `package.json` file:

```json
{
  "jest": {
    "preset": "@html-validate/jest-config"
  }
}
```

### Presets

| Preset                                           | Description                                                                                            |
| ------------------------------------------------ | ------------------------------------------------------------------------------------------------------ |
| @html-validate/jest-config                       | Alias for presets/default                                                                              |
| @html-validate/jest-config/presets/default       | Default preset                                                                                         |
| @html-validate/jest-config/presets/esm           | Experimental ESM support                                                                               |
| @html-validate/jest-config/presets/typestripping | Experimental native typestripping support, bypassing `ts-jest`. Note: requires nodejs v22.13 or later! |

### Transpiling ESM in `node_modules/`

If you need to import and use ESM-only libraries you need to install `@babel/core.
You do not need a `babel.config.js`or`.babelrc`as the preset passes the required configuration directly to`babel-jest`.

```
npm install --save-dev @babel/core
```

When babel is detect the preset sets `transformIgnorePatterns` to transpile everything under `node_modules`.
You can include a more specific list of packages to transform (potential speed gain) by manually setting `transformIgnorePatterns`:

Optionally you can set `transformIgnorePatterns` in `package.json`:

```diff
 {
   "jest": {
     "preset": "@html-validate/jest-config",
+    "transformIgnorePatterns": ["node_modules/(?!(foo|bar|baz)/)"]
   }
 }
```

This will transform only the `foo`, `bar` and `baz` packages.

### Importing HTML as string

Importing `*.html` is supported by jest configuration but requires additional typescript config by creating a declaration:

`shim-html.d.ts`:

```ts
declare module "*.html" {
  const value: string;
  export default value;
}
```

### `tsconfig.json`

This preset searches the project folder for typescript configuration in the following order:

1. `tsconfig.jest.json`
2. `tsconfig.json`
npm package: @html-validate/plugin-utils
Description: Plugin utilities and helpers for writing plugins to HTML-Validate
Author: David Sveningsson
Latest version: 3.0.0

# @html-validate/plugin-utils`

Plugin utilities and helpers for writing plugins to HTML-Validate

## API

```ts
import { Source } from "html-validate";

export interface Position {
  column: number;
  line: number;
}

export function positionFromOffset(text: string, offset: number): [line: number, column: number];

export function positionToOffset(position: Position, data: string): number;

export class TemplateExtractor {
  static fromString(source: string, filename?: string): TemplateExtractor;
  extractObjectProperty(key: string): Source[];
}
```

## Usage

### `TemplateExtractor`

Extracts HTML-snippets from Javascript based files.

```ts
/* javascript with HTML in the "template" property */
const sourceCode = `
  export default {
    template: "<p>lorem ipsum</i>",
  }
`;

/* extract HTML snippets */
const templateExtractor = TemplateExtractor.fromString(sourceCode);
const snippets = templateExtractor.extractObjectProperty("template");
```

Typically used in a transformation plugin to but it could also be validated directly:

```ts
for (const snippet of snippets) {
  const result = htmlvalidate.validateSource(snippet);
  console.log(result);
}
```
npm package: @html-validate/prettier-config
Description: Prettier sharable config used by the various HTML-validate packages
Author: David Sveningsson
Latest version: 3.1.16

# @html-validate/prettier-config

> HTML-Validate prettier config.

## Install

```
npm install --save-dev @html-validate/prettier-config
```

## Usage

```
npm pkg set prettier="@html-validate/prettier-config"
npm pkg set scripts.prettier:check="prettier --check ."
npm pkg set scripts.prettier:write="prettier --write ."
```

Or manually edit `package.json`:

```json
{
  "scripts": {
    "prettier:check": "prettier --check .",
    "prettier:write": "prettier --write ."
  },
  "prettier": "@html-validate/prettier-config"
}
```

Prettier does not need to be installed separately, this package includes `prettier` and its binary.

## lint-staged

To use lint-staged (included) configure the `pre-commit` hook to run husky with the `--config` flag:

```bash
#!/bin/sh

configfile=$(node -p 'require.resolve("@html-validate/prettier-config/lint-staged")')
exec npm exec lint-staged -- --config "${configfile}"
```

Lint-staged does not need to be installed separately, this package includes `lint-staged` and its binary.
npm package: @html-validate/release-scripts
Description: Various script used by release toolchain
Author: David Sveningsson
Latest version: 7.1.19

# @html-validate/release-scripts

Various scripts used by release toolchain.

## `release-pre{pack,publish}` and `release-post{pack,publish}`

`package.json`:

```json
{
  "scripts": {
    "prepack": "release-prepack",
    "postpack": "release-postpack",
    "prepublishOnly": "release-prepublish",
    "postpublish": "release-postpublish"
  }
}
```

If the library or CLI tool bundles all dependencies use `release-prepack --bundle`.
Dependencies can also be filtered by marking dependencies as external using `--bundle --external:foo --external:bar` or listing them in the non-standard `externalDependencies` field `"externalDependencies": ["foo", "bar"]`.

```json
{
  "scripts": {
    "prepack": "release-prepack --bundle --external:foo --external:bar",
    "postpack": "release-postpack",
    "prepublishOnly": "release-prepublish --bundle --external:foo --external:bar",
    "postpublish": "release-postpublish"
  }
}
```

or

```json
{
  "scripts": {
    "prepack": "release-prepack --bundle",
    "postpack": "release-postpack",
    "prepublishOnly": "release-prepublish --bundle",
    "postpublish": "release-postpublish"
  },
  "externalDependencies": ["foo", "bar"]
}
```

### Usage

    release-prepack [FILENAME] [OPTIONS..]
    release-postpack [FILENAME]
    release-prepublish [FILENAME] [OPTIONS..]
    release-postpublish [FILENAME]

If `FILENAME` is set it is the filename to use instead of the default `package.json`.

### Options

#### `--bundle`

By default the `dependencies` field in `package.json` is intact but if your package bundles its dependencies the `--bundle` flag can be used to strip out dependencies as well.

#### `--external:${NAME}`

When using in conjunction with `--bundle` it marks a dependency which should still be intact.
For instance, using `--external:foobar` all packages in `dependencies` except `foobar` will be stripped.
This flag can be used multiple times.

#### `--retain-scripts`

By default the `scripts` field is stripped but with this flag enabled the scripts will be intact.
npm package: @html-validate/renovate-config
Description: Renovate sharable config used by the various HTML-validate packages
Author: David Sveningsson
Latest version: 2.0.2

# @html-validate/renovate-config

Sharable config for Renovate

- Automerges patches and minor updates
- Raises pull requests for major or failed updates
- Semantic commits:
  - `devDependencies` -> `chore(deps)`
  - `dependencies` -> `fix(deps)`
  - `peerDependencies` -> `fix(deps)`

## Usage

Regular libraries can use `default` preset by adding this to their `package.json`:

```json
{
  "renovate": {
    "extends": ["@html-validate"]
  }
}
```

## Proxy packages (e.g. sharable configurations with dependencies)

For packages with sharable configurations there is a `proxy` preset which mimics the dependencies:

```json
{
  "renovate": {
    "extends": ["@html-validate:proxy"]
  }
}
```

Under this preset the semantic commits for non-devDependencies are:

- major -> `fix(deps)!`
- minor -> `fix(deps)`
- patch -> `fix(deps)`