# stylelint-value-no-unknown-custom-properties

> A stylelint rule to disallow usage of unknown custom properties

Latest version **6.1.1** (published 2026-01-21) · CC0-1.0 license · 0 weekly downloads

## Install

```sh
npm install stylelint-value-no-unknown-custom-properties
pnpm add stylelint-value-no-unknown-custom-properties
yarn add stylelint-value-no-unknown-custom-properties
bun add stylelint-value-no-unknown-custom-properties
```

## Health

**Score 55/100 (C)** — status: stable.

Positive: esm support; no vulnerabilities; high maintenance score.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 6.1.1 |
| Published | 2026-01-21 |
| First published | 2018-09-25 |
| Weekly downloads | 0 |
| License | CC0-1.0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=18.12.0 |
| Dependencies | 2 |
| Unpacked size | 23.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 76 |
| Author | Jonathan Neal |
| Maintainers | jonathantneal, alaguna, romainmenke |
| Keywords | stylelint, stylelint-plugin, css, custom, properties, property, variables, variable, vars, var, csswg, w3c, unknown |

## Links

- npm: https://www.npmjs.com/package/stylelint-value-no-unknown-custom-properties
- Repository: https://github.com/csstools/stylelint-value-no-unknown-custom-properties
- Homepage: https://github.com/csstools/stylelint-value-no-unknown-custom-properties#readme
- Issues: https://github.com/csstools/stylelint-value-no-unknown-custom-properties/issues
- npm.io page: https://npm.io/package/stylelint-value-no-unknown-custom-properties

## Dependencies (2)

- [resolve](https://npm.io/package/resolve.md) ^1.22.8
- [postcss-value-parser](https://npm.io/package/postcss-value-parser.md) ^4.2.0

## Alternatives

- [style-dictionary](https://npm.io/package/style-dictionary.md) — 2.0M weekly downloads
- [postcss-merge-idents](https://npm.io/package/postcss-merge-idents.md) — 1.7M weekly downloads
- [@fontsource/noto-sans](https://npm.io/package/@fontsource/noto-sans.md) — 93.0K weekly downloads
- [uglifycss](https://npm.io/package/uglifycss.md) — 71.6K weekly downloads
- [mat4-interpolate](https://npm.io/package/mat4-interpolate.md) — 23.3K weekly downloads

## Recent versions

- 6.1.1 (latest) — 2026-01-21
- 6.1.0 — 2025-12-20
- 6.0.1 — 2023-12-28
- 6.0.0 — 2023-12-28
- 5.0.0 — 2023-11-06
- 4.0.0 — 2022-03-26
- 3.0.0 — 2020-05-12
- 2.0.0 — 2018-09-26
- 1.0.0 — 2018-09-25

## README

# Stylelint Value No Unknown Custom Properties [<img src="https://jonathantneal.github.io/stylelint-logo.svg" alt="stylelint" width="90" height="90" align="right">][stylelint]

[![NPM Version][npm-img]][npm-url]
[![test][test-badge]][test-url]
[![Discord][discord-badge]][discord]

[Stylelint Value No Unknown Custom Properties] is a [stylelint] rule to disallow usage of
unknown custom properties.

## Usage

Add [stylelint] and [Stylelint Value No Unknown Custom Properties] to your project.

```bash
npm install stylelint stylelint-value-no-unknown-custom-properties --save-dev
```

Add [Stylelint Value No Unknown Custom Properties] to your [stylelint configuration].

```js
{
  "plugins": [
    "stylelint-value-no-unknown-custom-properties"
  ],
  "rules": {
    "csstools/value-no-unknown-custom-properties": true || null
  }
}
```

## Options

### true

If the first option is `true`, then [Stylelint Value No Unknown Custom Properties]
requires all custom properties to be known, and the following patterns are
_not_ considered violations:

```css
:root {
  --brand-blue: #33f;
}

.example {
  color: var(--brand-blue);
}
```

```css
.example {
  color: var(--brand-blue);
}

.some-other-class {
  --brand-blue: #33f;
}
```

```css
:root {
  --brand-blue: #33f;
  --brand-color: var(--brand-blue);
}
```

While the following patterns are considered violations:

```css
.example {
  color: var(--brand-blue);
}
```

```css
:root {
  --brand-color: var(--brand-blue);
}
```

Custom Properties can be imported using the second option.

### `null`

If the first option is `null`, then
[Stylelint Value No Unknown Custom Properties] does nothing.

---

### importFrom

When the first option is `true`, then the second option can specify sources
where Custom Properties should be imported from by using an `importFrom` key.
These imports might be CSS, JS, and JSON files, functions, and directly passed
objects.

The plugin resolves relative paths from the current working directory
which may not work in monorepos, in which case it is best to pass only absolute
paths to the plugin.

```js
// .stylelintrc
{
  "plugins": [
    "stylelint-value-no-unknown-custom-properties"
  ],
  "rules": {
    "csstools/value-no-unknown-custom-properties": [true, {
      "importFrom": [
        "path/to/file.css", // => :root { --brand-blue: #33f; }
        "path/to/file.json" // => { "custom-properties": { "--brand-blue": "#33f" } }
      ]
    }]
  }
}
```

### resolver

Use this option to configure how the rule solve paths of `@import` rules.

```js
// .stylelintrc
{
  "plugins": [
    "stylelint-value-no-unknown-custom-properties"
  ],
  "rules": {
    "csstools/value-no-unknown-custom-properties": [true, {
      "resolver": {
        "extensions": [".css"], // => default to [".css"]
        "paths": ["./assets/css", "./static/css"], // => paths to look for files, default to []
        "moduleDirectories": ["node_modules"] // => modules folder to look for files, default to ["node_modules"]
      }
    }]
  }
}
```

[discord]: https://discord.gg/bUadyRwkJS
[discord-badge]: https://shields.io/badge/Discord-5865F2?logo=discord&logoColor=white
[test-badge]: https://github.com/csstools/stylelint-value-no-unknown-custom-properties/actions/workflows/test.yml/badge.svg
[test-url]: https://github.com/csstools/stylelint-value-no-unknown-custom-properties/actions/workflows/test.yml
[npm-img]: https://img.shields.io/npm/v/stylelint-value-no-unknown-custom-properties.svg
[npm-url]: https://www.npmjs.com/package/stylelint-value-no-unknown-custom-properties

[stylelint]: https://github.com/stylelint/stylelint
[stylelint configuration]: https://stylelint.io/user-guide/configure/
[Stylelint Value No Unknown Custom Properties]: https://github.com/csstools/stylelint-value-no-unknown-custom-properties

---
_Source: https://npm.io/package/stylelint-value-no-unknown-custom-properties · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
