Skip to content

Commit

Permalink
Merge 65f35d9 into b188e61
Browse files Browse the repository at this point in the history
  • Loading branch information
SterlingVix committed Jul 14, 2021
2 parents b188e61 + 65f35d9 commit 6a133cc
Showing 1 changed file with 21 additions and 17 deletions.
38 changes: 21 additions & 17 deletions src/rules/dollar-variable-pattern/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,34 @@ a { $foo: 1px; }

A string will be translated into a RegExp like so `new RegExp(yourString)` — so be sure to escape properly.

### E.g. `/foo-.+/`
### Examples


The following patterns are considered warnings:

```scss
/* stylelint scss/dollar-variable-pattern: /foo-.+/ */
a { $boo-bar: 0; }
a { $fooBar: 0; }

/* stylelint scss/dollar-variable-pattern: /[a-z][a-zA-Z]+/ */
a { $foo-bar: 0; }
a { $FooBar: 0; }
a { $fooBar-baz: 0; }
```

The following patterns are *not* considered warnings:

```scss
/* stylelint scss/dollar-variable-pattern: /foo-.+/ */
a { $foo-bar: 0; }
a { $foo-bar-baz: 0; }
a { $foo-barBaz: 0; }
a { $boo-foo-bar: 0; }

/* stylelint scss/dollar-variable-pattern: /[a-z][a-zA-Z]+/ */
a { $fooBar: 0; }
a { $fooBarBaz: 0; }
```

## Optional Options
Expand All @@ -36,34 +52,22 @@ a { $foo-bar: 0; }

Makes this rule ignore local variables (variables defined inside a rule/mixin/function, etc.).

For example, with `/^foo-/`:

The following patterns are *not* considered warnings:

```scss
/* stylelint scss/dollar-variable-pattern: [/^foo-/, {"ignore": "local"}] */
$foo-name00: 10px;
```

```scss
a {
$bar-name01: 10px;
}
a { $bar-name01: 10px; }
```

#### `"global"`

Makes this rule ignore global variables (variables defined in the stylesheet root).

For example, with `/^foo-/`:

The following patterns are *not* considered warnings:

```scss
/* stylelint scss/dollar-variable-pattern: [/^foo-/, {"ignore": "global"}] */
$bar-name01: 10px;
```

```scss
a {
$foo-name02: 10px;
}
a { $foo-name02: 10px; }
```

0 comments on commit 6a133cc

Please sign in to comment.