forked from sds/scss-lint
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module SCSSLint | ||
# Checks for spaces following the name of a variable and before the colon | ||
# separating the variables's name from its value. | ||
class SpaceAfterVariableName < Linter | ||
include LinterRegistry | ||
|
||
def visit_variable(node) | ||
return unless spaces_before_colon?(node) | ||
add_lint(node, 'Variable names should be followed immediately by a colon') | ||
end | ||
|
||
private | ||
|
||
def spaces_before_colon?(node) | ||
source_from_range(node.source_range) =~ /\s+:/ | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
require 'spec_helper' | ||
|
||
describe SCSSLint::SpaceAfterVariableName do | ||
let(:scss) { <<-SCSS } | ||
$none: #fff; | ||
$one : #fff; | ||
$two : #fff; | ||
SCSS | ||
|
||
it { should_not report_lint line: 1 } | ||
it { should report_lint line: 2 } | ||
it { should report_lint line: 3 } | ||
end |