Skip to content

Commit

Permalink
Ignore currentColor in VariableForProperty
Browse files Browse the repository at this point in the history
Similar to 5a8cac9, this value is somewhat special and shouldn't be
considered as breaking the rules of this linter.

More information on the currentColor keyword can be found at:

  https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#currentColor_keyword

Addresses #426.
  • Loading branch information
lencioni authored and sds committed Apr 21, 2015
1 parent 5a8cac9 commit f42486f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
multi-line comments, such as copyright notices
* Fix bug where control comments could filter out lints from other files
depending on scan order
* Ignore `inherit` and `transparent` values in `VariableForProperty`
* Ignore `currentColor`, `inherit`, and `transparent` values in
`VariableForProperty`

## 0.37.0

Expand Down
4 changes: 2 additions & 2 deletions lib/scss_lint/linter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1486,8 +1486,8 @@ linters:
- font
```
Note that values like `inherit` and `transparent` will not be reported, as they
are special kinds of values that convey additional meaning.
Note that values like `currentColor`, `inherit`, and `transparent` will not be
reported, as they are special kinds of values that convey additional meaning.

Configuration Option | Description
---------------------|---------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion lib/scss_lint/linter/variable_for_property.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module SCSSLint
class Linter::VariableForProperty < Linter
include LinterRegistry

IGNORED_VALUES = %w[inherit transparent]
IGNORED_VALUES = %w[currentColor inherit transparent]

def visit_root(_node)
@properties = Set.new(config['properties'])
Expand Down
10 changes: 10 additions & 0 deletions spec/scss_lint/linter/variable_for_property_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,16 @@
it { should report_lint line: 3 }
end

context 'when property specifies `currentColor`' do
let(:scss) { <<-SCSS }
p {
background-color: currentColor;
}
SCSS

it { should_not report_lint }
end

context 'when property specifies `inherit`' do
let(:scss) { <<-SCSS }
p {
Expand Down

0 comments on commit f42486f

Please sign in to comment.