Skip to content

Commit

Permalink
Merge pull request #70 from primer/mkt/fix-css-var-scan
Browse files Browse the repository at this point in the history
Allow CSS variables with fallback values in no-undefined-vars
  • Loading branch information
Michelle Tilley authored Oct 29, 2020
2 parents 0e07d72 + 4ec12d6 commit bf6099f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions __tests__/no-undefined-vars.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ testRule({

accept: [
{code: '.x { color: var(--color-text-primary); }'},
{code: '.x { color: var(--color-text-primary, #000000); }'},
{code: '.x { background-color: var(--color-counter-bg); }'},
{code: '.x { margin: var(--spacing-spacer-1); }'}
],
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "stylelint-config-primer",
"version": "9.2.2",
"version": "9.2.3",
"description": "Sharable stylelint config used by GitHub's CSS",
"homepage": "http://primer.style/css/tools/linting",
"author": "GitHub, Inc.",
Expand Down
2 changes: 1 addition & 1 deletion plugins/no-undefined-vars.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const variableDefinitionRegex = /(--[\w|-]*):/g

// Match CSS variable references (e.g var(--color-text-primary))
// eslint-disable-next-line no-useless-escape
const variableReferenceRegex = /var\(([^\)]*)\)/g
const variableReferenceRegex = /var\(([^\),]*)\)/g

module.exports = stylelint.createPlugin(ruleName, (enabled, options = {}) => {
if (!enabled) {
Expand Down

0 comments on commit bf6099f

Please sign in to comment.