{"id":19653013,"url":"https://github.com/csstools/stylelint-value-no-unknown-custom-properties","last_synced_at":"2025-10-05T20:01:29.621Z","repository":{"id":38554643,"uuid":"150213276","full_name":"csstools/stylelint-value-no-unknown-custom-properties","owner":"csstools","description":"A stylelint rule to catch usage of unknown custom properties","archived":false,"fork":false,"pushed_at":"2024-12-27T18:28:02.000Z","size":473,"stargazers_count":71,"open_issues_count":3,"forks_count":29,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-05-05T05:39:21.778Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/csstools.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-09-25T05:41:26.000Z","updated_at":"2025-04-25T09:20:06.000Z","dependencies_parsed_at":"2023-02-08T05:55:10.910Z","dependency_job_id":"72204224-b4e6-4f27-9bd3-8765f470e0ab","html_url":"https://github.com/csstools/stylelint-value-no-unknown-custom-properties","commit_stats":{"total_commits":36,"total_committers":16,"mean_commits":2.25,"dds":0.6388888888888888,"last_synced_commit":"8246354216558bd5dd5ddfe9217ffbb04358d5a9"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csstools%2Fstylelint-value-no-unknown-custom-properties","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csstools%2Fstylelint-value-no-unknown-custom-properties/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csstools%2Fstylelint-value-no-unknown-custom-properties/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csstools%2Fstylelint-value-no-unknown-custom-properties/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/csstools","download_url":"https://codeload.github.com/csstools/stylelint-value-no-unknown-custom-properties/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252744658,"owners_count":21797660,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T15:12:54.699Z","updated_at":"2025-10-05T20:01:24.473Z","avatar_url":"https://github.com/csstools.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Stylelint Value No Unknown Custom Properties [\u003cimg src=\"https://jonathantneal.github.io/stylelint-logo.svg\" alt=\"stylelint\" width=\"90\" height=\"90\" align=\"right\"\u003e][stylelint]\n\n[![NPM Version][npm-img]][npm-url]\n[![test][test-badge]][test-url]\n[![Discord][discord-badge]][discord]\n\n[Stylelint Value No Unknown Custom Properties] is a [stylelint] rule to disallow usage of\nunknown custom properties.\n\n## Usage\n\nAdd [stylelint] and [Stylelint Value No Unknown Custom Properties] to your project.\n\n```bash\nnpm install stylelint stylelint-value-no-unknown-custom-properties --save-dev\n```\n\nAdd [Stylelint Value No Unknown Custom Properties] to your [stylelint configuration].\n\n```js\n{\n  \"plugins\": [\n    \"stylelint-value-no-unknown-custom-properties\"\n  ],\n  \"rules\": {\n    \"csstools/value-no-unknown-custom-properties\": true || null\n  }\n}\n```\n\n## Options\n\n### true\n\nIf the first option is `true`, then [Stylelint Value No Unknown Custom Properties]\nrequires all custom properties to be known, and the following patterns are\n_not_ considered violations:\n\n```css\n:root {\n  --brand-blue: #33f;\n}\n\n.example {\n  color: var(--brand-blue);\n}\n```\n\n```css\n.example {\n  color: var(--brand-blue);\n}\n\n.some-other-class {\n  --brand-blue: #33f;\n}\n```\n\n```css\n:root {\n  --brand-blue: #33f;\n  --brand-color: var(--brand-blue);\n}\n```\n\nWhile the following patterns are considered violations:\n\n```css\n.example {\n  color: var(--brand-blue);\n}\n```\n\n```css\n:root {\n  --brand-color: var(--brand-blue);\n}\n```\n\nCustom Properties can be imported using the second option.\n\n### `null`\n\nIf the first option is `null`, then\n[Stylelint Value No Unknown Custom Properties] does nothing.\n\n---\n\n### importFrom\n\nWhen the first option is `true`, then the second option can specify sources\nwhere Custom Properties should be imported from by using an `importFrom` key.\nThese imports might be CSS, JS, and JSON files, functions, and directly passed\nobjects.\n\nThe plugin resolves relative paths from the current working directory\nwhich may not work in monorepos, in which case it is best to pass only absolute\npaths to the plugin.\n\n```js\n// .stylelintrc\n{\n  \"plugins\": [\n    \"stylelint-value-no-unknown-custom-properties\"\n  ],\n  \"rules\": {\n    \"csstools/value-no-unknown-custom-properties\": [true, {\n      \"importFrom\": [\n        \"path/to/file.css\", // =\u003e :root { --brand-blue: #33f; }\n        \"path/to/file.json\" // =\u003e { \"custom-properties\": { \"--brand-blue\": \"#33f\" } }\n      ]\n    }]\n  }\n}\n```\n\n### resolver\n\nUse this option to configure how the rule solve paths of `@import` rules.\n\n```js\n// .stylelintrc\n{\n  \"plugins\": [\n    \"stylelint-value-no-unknown-custom-properties\"\n  ],\n  \"rules\": {\n    \"csstools/value-no-unknown-custom-properties\": [true, {\n      \"resolver\": {\n        \"extensions\": [\".css\"], // =\u003e default to [\".css\"]\n        \"paths\": [\"./assets/css\", \"./static/css\"], // =\u003e paths to look for files, default to []\n        \"moduleDirectories\": [\"node_modules\"] // =\u003e modules folder to look for files, default to [\"node_modules\"]\n      }\n    }]\n  }\n}\n```\n\n[discord]: https://discord.gg/bUadyRwkJS\n[discord-badge]: https://shields.io/badge/Discord-5865F2?logo=discord\u0026logoColor=white\n[test-badge]: https://github.com/csstools/stylelint-value-no-unknown-custom-properties/actions/workflows/test.yml/badge.svg\n[test-url]: https://github.com/csstools/stylelint-value-no-unknown-custom-properties/actions/workflows/test.yml\n[npm-img]: https://img.shields.io/npm/v/stylelint-value-no-unknown-custom-properties.svg\n[npm-url]: https://www.npmjs.com/package/stylelint-value-no-unknown-custom-properties\n\n[stylelint]: https://github.com/stylelint/stylelint\n[stylelint configuration]: https://stylelint.io/user-guide/configure/\n[Stylelint Value No Unknown Custom Properties]: https://github.com/csstools/stylelint-value-no-unknown-custom-properties\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsstools%2Fstylelint-value-no-unknown-custom-properties","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcsstools%2Fstylelint-value-no-unknown-custom-properties","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsstools%2Fstylelint-value-no-unknown-custom-properties/lists"}