Skip to content

Commit

Permalink
Merge pull request #256 from kristerkari/feature/no-duplicate-dollar-…
Browse files Browse the repository at this point in the history
…variables-ignore-options

Add ignore options to no-duplicate-dollar-variables
  • Loading branch information
kristerkari committed Jul 21, 2018
2 parents 0b18082 + 3a691a5 commit 860d730
Show file tree
Hide file tree
Showing 3 changed files with 853 additions and 8 deletions.
97 changes: 96 additions & 1 deletion src/rules/no-duplicate-dollar-variables/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,23 @@ $a: 1;
}
```

The following patterns are *not* considered violations:
```scss
$a: 1;
.b {
.c {
$a: 1;
}
}
```

```scss
$a: 1;
@mixin b {
$a: 1;
}
```

The following patterns are _not_ considered violations:

```scss
$a: 1;
Expand All @@ -46,3 +62,82 @@ $a: 1;
$b: 2;
}
```

### `ignoreInside: ["at-rule", "nested-at-rule"]`

#### `"at-rule"`

Ignores dollar variables that are inside both nested and non-nested at-rules (`@media`, `@mixin`, etc.).

Given:

```json
{ "ignoreInside": ["at-rule"] }
```

The following patterns are _not_ considered warnings:

```scss
$a: 1;
@mixin c {
$a: 1;
}
```

```scss
$a: 1;
.b {
@mixin c {
$a: 1;
}
}
```

#### `"nested-at-rule"`

Ignores dollar variables that are inside nested at-rules (`@media`, `@mixin`, etc.).

Given:

```json
{ "ignoreInside": ["nested-at-rule"] }
```

The following patterns are _not_ considered warnings:

```scss
$a: 1;
.b {
@mixin c {
$a: 1;
}
}
```

### `ignoreInsideAtRules: ["array", "of", "at-rules"]`

Ignores all variables that are inside specified at-rules.

Given:

```json
{ "ignoreInsideAtRules": ["if", "mixin"] }
```

The following patterns are _not_ considered warnings:

```scss
$a: 1;

@mixin b {
$a: 2;
}
```

```scss
$a: 1;

@if (true) {
$a: 2;
}
```

0 comments on commit 860d730

Please sign in to comment.