feat(custom-properties): Warn in development on invalid theme keys #2080
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #1728 by warning (in non-production environments) when invalid CSS custom properties are being generated, including a test.
I wrote a simplified validator based on the spec that checks for the right characters but does not check for "cannot start with a digit, two hyphens, or a hyphen followed by a digit", but figured this should cover the bulk of cases.
📦 Published PR as canary version:
0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0
✨ Test out this PR locally via:
npm install @theme-ui/color-modes@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 npm install @theme-ui/color@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 npm install @theme-ui/components@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 npm install @theme-ui/core@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 npm install @theme-ui/css@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 npm install @theme-ui/custom-properties@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 npm install @theme-ui/editor@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 npm install gatsby-plugin-theme-ui@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 npm install gatsby-theme-style-guide@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 npm install gatsby-theme-ui-layout@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 npm install @theme-ui/match-media@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 npm install @theme-ui/mdx@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 npm install @theme-ui/parse-props@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 npm install @theme-ui/preset-base@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 npm install @theme-ui/preset-bootstrap@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 npm install @theme-ui/preset-bulma@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 npm install @theme-ui/preset-dark@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 npm install @theme-ui/preset-deep@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 npm install @theme-ui/preset-funk@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 npm install @theme-ui/preset-future@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 npm install @theme-ui/preset-polaris@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 npm install @theme-ui/preset-roboto@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 npm install @theme-ui/preset-sketchy@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 npm install @theme-ui/preset-swiss@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 npm install @theme-ui/preset-system@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 npm install @theme-ui/preset-tailwind@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 npm install @theme-ui/preset-tosh@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 npm install @theme-ui/presets@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 npm install @theme-ui/prism@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 npm install @theme-ui/sidenav@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 npm install @theme-ui/style-guide@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 npm install @theme-ui/tailwind@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 npm install @theme-ui/theme-provider@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 npm install theme-ui@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 npm install @theme-ui/typography@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 # or yarn add @theme-ui/color-modes@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 yarn add @theme-ui/color@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 yarn add @theme-ui/components@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 yarn add @theme-ui/core@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 yarn add @theme-ui/css@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 yarn add @theme-ui/custom-properties@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 yarn add @theme-ui/editor@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 yarn add gatsby-plugin-theme-ui@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 yarn add gatsby-theme-style-guide@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 yarn add gatsby-theme-ui-layout@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 yarn add @theme-ui/match-media@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 yarn add @theme-ui/mdx@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 yarn add @theme-ui/parse-props@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 yarn add @theme-ui/preset-base@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 yarn add @theme-ui/preset-bootstrap@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 yarn add @theme-ui/preset-bulma@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 yarn add @theme-ui/preset-dark@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 yarn add @theme-ui/preset-deep@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 yarn add @theme-ui/preset-funk@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 yarn add @theme-ui/preset-future@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 yarn add @theme-ui/preset-polaris@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 yarn add @theme-ui/preset-roboto@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 yarn add @theme-ui/preset-sketchy@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 yarn add @theme-ui/preset-swiss@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 yarn add @theme-ui/preset-system@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 yarn add @theme-ui/preset-tailwind@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 yarn add @theme-ui/preset-tosh@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 yarn add @theme-ui/presets@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 yarn add @theme-ui/prism@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 yarn add @theme-ui/sidenav@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 yarn add @theme-ui/style-guide@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 yarn add @theme-ui/tailwind@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 yarn add @theme-ui/theme-provider@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 yarn add theme-ui@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0 yarn add @theme-ui/typography@0.14.0--canary.2080.bedf631c6c5280d5dc457bd4e2c38896a99bde38.0
Version
Published prerelease version:
v0.14.0-develop.7
Changelog
🎉 This release contains work from a new contributor! 🎉
Thank you, Brage (@braaar), for all your work!
🚀 Enhancement
@theme-ui/custom-properties
@theme-ui/color-modes
theme-ui
🐛 Bug Fix
@theme-ui/sidenav
@theme-ui/components
👨💻 Minor changes
🏠 Internal
@theme-ui/sidenav
Authors: 3