grouped_property_scss_linter 1.1.3 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.editorconfig +13 -0
- data/.scss-lint.yml +3 -0
- data/LICENSE.txt +1 -1
- data/README.textile +7 -1
- data/data/concentric.yaml +182 -29
- data/data/grouped-smacss.yaml +4 -0
- data/data/personal.yaml +33 -3
- data/data/smacss.yaml +2 -0
- data/grouped_property_scss_linter.gemspec +1 -1
- data/lib/grouped_property_scss_linter/grouped_property_order.rb +65 -37
- data/lib/grouped_property_scss_linter/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f8c803f54317ac3e4374581fcfb3dda569a7fc1
|
4
|
+
data.tar.gz: f00651abd47e49ac7f1cd7cabd85dac18d0ee70d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6cb9ca4609aa14869698619c8395cc4f28b4d9b491ce18c4b65b73967dd031ba4af873426648373e1c9a2158ae3d370f1886b0054bd41606df66caf26c757979
|
7
|
+
data.tar.gz: 52b8291bfb2f463e6336950e9e3d9c754e63a4f5bc0699080f557a1cbb52599d4fe6a1b9de7c47d37e20f29d98cf950062e56f6d8045068f089446ddc3159bdf
|
data/.editorconfig
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# EditorConfig is awesome: http://EditorConfig.org
|
2
|
+
|
3
|
+
# top-most EditorConfig file
|
4
|
+
root = true
|
5
|
+
|
6
|
+
# Defaults for all files
|
7
|
+
[*]
|
8
|
+
end_of_line = lf
|
9
|
+
insert_final_newline = true
|
10
|
+
charset = utf-8
|
11
|
+
indent_style = space
|
12
|
+
indent_size = 2
|
13
|
+
trim_trailing_whitespace = true
|
data/.scss-lint.yml
CHANGED
data/LICENSE.txt
CHANGED
data/README.textile
CHANGED
@@ -90,6 +90,7 @@ h3. Options
|
|
90
90
|
- @enabled@ _(boolean)_ := switches the module on and off (default: on)
|
91
91
|
- @defaults@ _(hash)_ := default linting settings that are applied to all groups (can be overridden per-group)
|
92
92
|
- @style@ _(string, optional)_ := the name of a preconfigured style (see below, defaults to @grouped-smacss@)
|
93
|
+
- @css_variables_first@ _(boolean, optional)_ := whether or not require CSS variables (custom properties) are defined first (default: @true@)
|
93
94
|
- @groups@ _(hash, optional)_ := a hash of configured groups. Note that specifying anything here will override the @style@ option
|
94
95
|
- @extended_hinting@ _(boolean, optional)_ := enables additional group information in hinting output (default @false@)
|
95
96
|
|
@@ -159,7 +160,12 @@ I’ve written a "blog post":https://jonpearse.net/articles/2016/07/on-linting-a
|
|
159
160
|
|
160
161
|
h2. Version History
|
161
162
|
|
162
|
-
h3. 1.
|
163
|
+
h3. 1.2.0 _(May 21st, 2018)_
|
164
|
+
|
165
|
+
* *[FIX]* CSS variables no longer cause an infinite loop (fixes issue #1)
|
166
|
+
* moved stuff around in my ‘personal’ preset
|
167
|
+
|
168
|
+
h3. 1.1.3 _(March 18th, 2017)_
|
163
169
|
|
164
170
|
* eventually pushing this up to RubyGems
|
165
171
|
|
data/data/concentric.yaml
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
# Concentric CSS [ http://rhodesmill.org/brandon/2011/concentric-css/ ]
|
2
2
|
#
|
3
|
-
# This is
|
4
|
-
# [ https://github.com/brigade/scss-lint/blob/master/data/property-sort-orders/concentric.txt ]
|
3
|
+
# This ordering is adapted from Brandon’s guidelines from [ https://github.com/brandon-rhodes/Concentric-CSS/blob/master/style3.css ]
|
5
4
|
groups:
|
6
|
-
|
5
|
+
box-sizing:
|
6
|
+
- box-sizing
|
7
|
+
|
8
|
+
position:
|
7
9
|
- display
|
8
10
|
- position
|
9
11
|
- top
|
@@ -11,72 +13,223 @@ groups:
|
|
11
13
|
- bottom
|
12
14
|
- left
|
13
15
|
|
14
|
-
columns:
|
15
|
-
- columns
|
16
|
-
- column*
|
17
|
-
|
18
16
|
float:
|
19
17
|
- float
|
20
18
|
- clear
|
21
19
|
|
20
|
+
# Inserting grid here because it seems reasonable to have it ‘above’ flex: feel free to disagree =)
|
21
|
+
grid:
|
22
|
+
- grid
|
23
|
+
- grid-*
|
24
|
+
|
25
|
+
align-content:
|
26
|
+
- align-content
|
27
|
+
- align-items
|
28
|
+
- align-self
|
29
|
+
|
30
|
+
flex:
|
31
|
+
- flex
|
32
|
+
- flex-basis
|
33
|
+
- flex-direction
|
34
|
+
- flex-flow
|
35
|
+
- flex-grow
|
36
|
+
- flex-shrink
|
37
|
+
- flex-wrap
|
38
|
+
- justify-content
|
39
|
+
|
40
|
+
order:
|
41
|
+
- order
|
42
|
+
|
43
|
+
columns:
|
44
|
+
columns
|
45
|
+
column-*
|
46
|
+
|
22
47
|
transform:
|
23
|
-
-
|
48
|
+
- backface-visibility
|
49
|
+
- perspective
|
50
|
+
- perspective-origin
|
51
|
+
- transform
|
52
|
+
- transform-origin
|
53
|
+
- transform-style
|
54
|
+
|
55
|
+
|
56
|
+
transitions:
|
24
57
|
- transition
|
25
|
-
-
|
58
|
+
- transition-delay
|
59
|
+
- transition-duration
|
60
|
+
- transition-property
|
61
|
+
- transition-timing-function
|
26
62
|
|
27
63
|
visibility:
|
28
64
|
- visibility
|
29
65
|
- opacity
|
30
66
|
- z-index
|
31
67
|
|
32
|
-
|
33
|
-
- margin
|
68
|
+
margin:
|
69
|
+
- margin
|
70
|
+
- margin-top
|
71
|
+
- margin-right
|
72
|
+
- margin-bottom
|
73
|
+
- margin-left
|
74
|
+
|
75
|
+
outline:
|
34
76
|
- outline
|
77
|
+
- outline-offset
|
78
|
+
- outline-width
|
79
|
+
- outline-style
|
80
|
+
- outline-color
|
81
|
+
|
82
|
+
borders:
|
35
83
|
- border
|
84
|
+
- border-top
|
85
|
+
- border-right
|
86
|
+
- border-bottom
|
87
|
+
- border-left
|
88
|
+
- border-width
|
89
|
+
- border-top-width
|
90
|
+
- border-right-width
|
91
|
+
- border-bottom-width
|
92
|
+
- border-left-width
|
93
|
+
|
94
|
+
border-styles:
|
36
95
|
- border-style
|
37
|
-
- border-
|
96
|
+
- border-top-style
|
97
|
+
- border-right-style
|
98
|
+
- border-bottom-style
|
99
|
+
- border-left-style
|
100
|
+
|
101
|
+
border-radius:
|
38
102
|
- border-radius
|
39
|
-
- border-
|
103
|
+
- border-top-left-radius
|
104
|
+
- border-top-right-radius
|
105
|
+
- border-bottom-left-radius
|
106
|
+
- border-bottom-right-radius
|
107
|
+
|
108
|
+
border-colours:
|
109
|
+
- border-color
|
110
|
+
- border-top-color
|
111
|
+
- border-right-color
|
112
|
+
- border-bottom-color
|
113
|
+
- border-left-color
|
114
|
+
|
115
|
+
border-image:
|
40
116
|
- border-image
|
41
|
-
- border-
|
42
|
-
- border-
|
43
|
-
- border-
|
44
|
-
- border-
|
117
|
+
- border-image-source
|
118
|
+
- border-image-width
|
119
|
+
- border-image-outset
|
120
|
+
- border-image-repeat
|
121
|
+
- border-image-slice
|
122
|
+
|
123
|
+
box-shadow:
|
45
124
|
- box-shadow
|
46
|
-
|
125
|
+
|
126
|
+
background:
|
127
|
+
- background
|
128
|
+
- background-attachment
|
129
|
+
- background-clip
|
130
|
+
- background-color
|
131
|
+
- background-image
|
132
|
+
- background-origin
|
133
|
+
- background-position
|
134
|
+
- background-repeat
|
135
|
+
- background-size
|
136
|
+
|
137
|
+
cursor:
|
47
138
|
- cursor
|
48
|
-
- padding*
|
49
139
|
|
50
|
-
|
140
|
+
padding:
|
141
|
+
- padding
|
142
|
+
- padding-top
|
143
|
+
- padding-right
|
144
|
+
- padding-bottom
|
145
|
+
- padding-left
|
146
|
+
|
147
|
+
width:
|
51
148
|
- width
|
52
149
|
- min-width
|
53
150
|
- max-width
|
151
|
+
|
152
|
+
height:
|
54
153
|
- height
|
55
154
|
- min-height
|
56
155
|
- max-height
|
57
|
-
- overflow*
|
58
156
|
|
59
|
-
|
60
|
-
-
|
157
|
+
overflow:
|
158
|
+
- overflow
|
159
|
+
- overflow-x
|
160
|
+
- overflow-y
|
161
|
+
- resize
|
61
162
|
|
62
|
-
|
163
|
+
list-style:
|
164
|
+
- list-style
|
165
|
+
- list-style-type
|
166
|
+
- list-style-position
|
167
|
+
- list-style-image
|
63
168
|
- caption-side
|
169
|
+
|
170
|
+
tables:
|
64
171
|
- table-layout
|
65
172
|
- border-collapse
|
66
173
|
- border-spacing
|
67
174
|
- empty-cells
|
68
175
|
|
69
|
-
|
176
|
+
animation:
|
177
|
+
- animation
|
178
|
+
- animation-name
|
179
|
+
- animation-duration
|
180
|
+
- animation-timing-function
|
181
|
+
- animation-delay
|
182
|
+
- animation-iteration-count
|
183
|
+
- animation-direction
|
184
|
+
- animation-fill-mode
|
185
|
+
- animation-play-state
|
186
|
+
|
187
|
+
vertical-aligment:
|
70
188
|
- vertical-align
|
71
|
-
|
189
|
+
|
190
|
+
text-alignment-decoration:
|
191
|
+
- direction
|
192
|
+
- tab-size
|
193
|
+
- text-align
|
194
|
+
- text-align-last
|
195
|
+
- text-justify
|
196
|
+
- text-indent
|
197
|
+
- text-transform
|
198
|
+
- text-decoration
|
199
|
+
- text-decoration-color
|
200
|
+
- text-decoration-line
|
201
|
+
- text-decoration-style
|
202
|
+
- text-rendering
|
203
|
+
- text-shadow
|
204
|
+
- text-overflow
|
205
|
+
|
206
|
+
text-spacing:
|
72
207
|
- line-height
|
73
208
|
- word-spacing
|
74
209
|
- letter-spacing
|
75
210
|
- white-space
|
211
|
+
- word-break
|
212
|
+
- word-wrap
|
76
213
|
- color
|
77
|
-
- font*
|
78
214
|
|
79
|
-
|
215
|
+
font:
|
216
|
+
- font
|
217
|
+
- font-family
|
218
|
+
- font-size
|
219
|
+
- font-size-adjust
|
220
|
+
- font-stretch
|
221
|
+
- font-weight
|
222
|
+
- font-smoothing
|
223
|
+
- font-variant
|
224
|
+
- font-style
|
225
|
+
|
226
|
+
content:
|
80
227
|
- content
|
81
228
|
- quotes
|
82
|
-
|
229
|
+
|
230
|
+
counters:
|
231
|
+
- counter-reset
|
232
|
+
- counter-increment
|
233
|
+
|
234
|
+
breaks:
|
235
|
+
- page-break-*
|
data/data/grouped-smacss.yaml
CHANGED
data/data/personal.yaml
CHANGED
@@ -13,6 +13,25 @@ groups:
|
|
13
13
|
- clear
|
14
14
|
- content
|
15
15
|
- box-sizing
|
16
|
+
- object-fit
|
17
|
+
|
18
|
+
grid-parent:
|
19
|
+
properties:
|
20
|
+
- grid
|
21
|
+
- grid-template
|
22
|
+
- grid-template-*
|
23
|
+
- grid-auto-*
|
24
|
+
- grid-gap
|
25
|
+
- grid-row-gap
|
26
|
+
- grid-column-gap
|
27
|
+
|
28
|
+
grid-child:
|
29
|
+
properties:
|
30
|
+
- grid-area
|
31
|
+
- grid-row-start
|
32
|
+
- grid-row-end
|
33
|
+
- grid-column-start
|
34
|
+
- grid-column-end
|
16
35
|
|
17
36
|
flex-parent:
|
18
37
|
properties:
|
@@ -32,6 +51,11 @@ groups:
|
|
32
51
|
- flex-basis
|
33
52
|
- align-self
|
34
53
|
|
54
|
+
columns:
|
55
|
+
properties:
|
56
|
+
- columns
|
57
|
+
- column-*
|
58
|
+
|
35
59
|
tables:
|
36
60
|
max_no_space: 1
|
37
61
|
properties:
|
@@ -55,7 +79,7 @@ groups:
|
|
55
79
|
- margin*
|
56
80
|
- transform
|
57
81
|
|
58
|
-
|
82
|
+
borders:
|
59
83
|
properties:
|
60
84
|
- outline*
|
61
85
|
- border
|
@@ -68,6 +92,9 @@ groups:
|
|
68
92
|
- border-right*
|
69
93
|
- border-bottom*
|
70
94
|
- border-left*
|
95
|
+
|
96
|
+
presentational:
|
97
|
+
properties:
|
71
98
|
- background*
|
72
99
|
- opacity
|
73
100
|
- z-index
|
@@ -92,9 +119,12 @@ groups:
|
|
92
119
|
- text-transform
|
93
120
|
- text-shadow
|
94
121
|
- white-space
|
95
|
-
|
96
|
-
|
122
|
+
|
97
123
|
interaction:
|
98
124
|
properties:
|
99
125
|
- transition
|
100
126
|
- animation
|
127
|
+
|
128
|
+
generated:
|
129
|
+
properties:
|
130
|
+
- content
|
data/data/smacss.yaml
CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
|
|
7
7
|
spec.name = "grouped_property_scss_linter"
|
8
8
|
spec.version = GroupedPropertyScssLinter::VERSION
|
9
9
|
spec.authors = ["Jon Pearse"]
|
10
|
-
spec.email = ["
|
10
|
+
spec.email = ["hello@jonpearse.net"]
|
11
11
|
spec.summary = "SCSS Lint plugin"
|
12
12
|
spec.description = "Plugin for SCSS lint that lints the order of properties based on fuzzy groups"
|
13
13
|
spec.homepage = "https://github.com/jonpearse/grouped_property_scss_linter"
|
@@ -13,11 +13,11 @@ module SCSSLint
|
|
13
13
|
@property_to_group = {}
|
14
14
|
count = 0
|
15
15
|
@configured_groups.each_pair do |name, group|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
16
|
+
|
17
|
+
@groups << name
|
18
|
+
group['properties'].each{ |property| @property_to_group[property] = { name: name, idx: count }}
|
19
|
+
count += 1
|
20
|
+
|
21
21
|
end
|
22
22
|
|
23
23
|
yield
|
@@ -28,9 +28,7 @@ module SCSSLint
|
|
28
28
|
def check_order( node )
|
29
29
|
|
30
30
|
# 1. get a list of properties we can sort
|
31
|
-
sortable_properties = node.children.select
|
32
|
-
child.is_a? Sass::Tree::PropNode
|
33
|
-
end
|
31
|
+
sortable_properties = node.children.select{ |child| child.is_a?( Sass::Tree::PropNode )}
|
34
32
|
|
35
33
|
# 2. group things
|
36
34
|
grouped_properties = {}
|
@@ -40,15 +38,13 @@ module SCSSLint
|
|
40
38
|
name = prop.name.join
|
41
39
|
|
42
40
|
# attempt to match the name
|
43
|
-
group = find_match_for_property name
|
41
|
+
group = find_match_for_property( name )
|
44
42
|
|
45
43
|
# if it didn’t find anything, move on
|
46
44
|
next if group.nil?
|
47
45
|
|
48
46
|
# if there’s no existing group
|
49
|
-
unless grouped_properties.key? group[:name]
|
50
|
-
grouped_properties[group[:name]] = { first: 1.0/0, last: 0, props: [] }
|
51
|
-
end
|
47
|
+
grouped_properties[group[:name]] = { first: 1.0/0, last: 0, props: [] } unless grouped_properties.key?( group[:name] )
|
52
48
|
|
53
49
|
# build a concat
|
54
50
|
concat = { name: name, node: prop, group: group[:name], line: prop.line, group_idx: group[:idx] }
|
@@ -64,9 +60,7 @@ module SCSSLint
|
|
64
60
|
props.compact!
|
65
61
|
|
66
62
|
# 3. call down
|
67
|
-
unless grouped_properties.empty?
|
68
|
-
check_sort_order props, grouped_properties
|
69
|
-
end
|
63
|
+
check_sort_order( props, grouped_properties ) unless grouped_properties.empty?
|
70
64
|
|
71
65
|
# 4. yield so we can process children
|
72
66
|
yield
|
@@ -80,8 +74,10 @@ module SCSSLint
|
|
80
74
|
alias visit_prop check_order
|
81
75
|
|
82
76
|
def visit_if(node, &block)
|
77
|
+
|
83
78
|
check_order(node, &block)
|
84
79
|
visit(node.else) if node.else
|
80
|
+
|
85
81
|
end
|
86
82
|
|
87
83
|
private
|
@@ -100,11 +96,24 @@ module SCSSLint
|
|
100
96
|
# 3. if it failed, bail
|
101
97
|
raise 'No groups configured' if groups.nil?
|
102
98
|
|
103
|
-
#
|
104
|
-
|
99
|
+
# 4. if we’re worrying about CSS variables
|
100
|
+
if config['css_variables_first']
|
101
|
+
|
102
|
+
groups = {
|
103
|
+
'css_vars' => {
|
104
|
+
'properties' => [ '{VARIABLE}' ],
|
105
|
+
'space_around' => true,
|
106
|
+
'max_no_space' => 0
|
107
|
+
}
|
108
|
+
}.merge( groups )
|
109
|
+
|
110
|
+
end
|
111
|
+
|
112
|
+
# 5. munge
|
113
|
+
groups.update( groups ) do |name, group|
|
105
114
|
|
106
115
|
# a. if it’s an array, cast it
|
107
|
-
group = { 'properties' => group } if group.is_a? Array
|
116
|
+
group = { 'properties' => group } if group.is_a?( Array )
|
108
117
|
|
109
118
|
# b. merge in some defaults
|
110
119
|
group['space_around'] = defaults['space_around'] if group['space_around'].nil?
|
@@ -123,22 +132,22 @@ module SCSSLint
|
|
123
132
|
def load_groups_from_style
|
124
133
|
|
125
134
|
# 0. if the style is blank/empty…
|
126
|
-
(raise 'No style specified' and return) if config['style'].empty?
|
135
|
+
( raise 'No style specified' and return ) if config['style'].empty?
|
127
136
|
|
128
137
|
# 1. attempt to find the file
|
129
|
-
data_filename = File.join(GroupedPropertyScssLinter::STYLES_DIR, "#{config['style']}.yaml")
|
138
|
+
data_filename = File.join( GroupedPropertyScssLinter::STYLES_DIR, "#{config['style']}.yaml" )
|
130
139
|
|
131
140
|
# 2. does it exist
|
132
|
-
(raise "No style ‘#{config['style']}’ found" and return) unless File.exists? data_filename
|
141
|
+
( raise "No style ‘#{config['style']}’ found" and return ) unless File.exists?( data_filename )
|
133
142
|
|
134
143
|
# 3. can we read it
|
135
|
-
(raise "Cannot read style ‘#{config['style']}’" and return) unless File.readable? data_filename
|
144
|
+
( raise "Cannot read style ‘#{config['style']}’" and return ) unless File.readable?( data_filename )
|
136
145
|
|
137
146
|
# 4. open
|
138
|
-
style_config = YAML.load_file data_filename
|
147
|
+
style_config = YAML.load_file( data_filename )
|
139
148
|
|
140
149
|
# 5. barf?
|
141
|
-
(raise "Bad style file found for ‘#{config['style']}’" and return) if style_config.nil? or style_config['groups'].nil?
|
150
|
+
( raise "Bad style file found for ‘#{config['style']}’" and return ) if ( style_config.nil? or style_config['groups'].nil? )
|
142
151
|
|
143
152
|
style_config['groups']
|
144
153
|
end
|
@@ -146,8 +155,11 @@ module SCSSLint
|
|
146
155
|
# Finds a matching group for a specified property
|
147
156
|
def find_match_for_property( prop )
|
148
157
|
|
158
|
+
# if it’s a property
|
159
|
+
prop = '{VARIABLE}' if ( prop.start_with?( '--' ))
|
160
|
+
|
149
161
|
# sanitise the name by removing any browser prefixes
|
150
|
-
prop = prop.gsub(/^(-\w+(-osx)?-)?/, '')
|
162
|
+
prop = prop.gsub( /^(-\w+(-osx)?-)?/, '' )
|
151
163
|
|
152
164
|
# iteratively remove hyphens from the property…
|
153
165
|
while prop =~ /\-/
|
@@ -155,18 +167,19 @@ module SCSSLint
|
|
155
167
|
# if we know about this property or its splatted variety…
|
156
168
|
if @property_to_group.key? prop or @property_to_group.key? prop+'*'
|
157
169
|
|
158
|
-
return @property_to_group[prop] || @property_to_group[prop+'*']
|
170
|
+
return ( @property_to_group[prop] || @property_to_group[prop+'*'] )
|
159
171
|
|
160
172
|
end
|
161
173
|
|
162
|
-
|
174
|
+
# strip the leading hyphen and try again
|
175
|
+
prop.gsub!( /\-(\w+)$/, '' )
|
163
176
|
|
164
177
|
end
|
165
178
|
|
166
179
|
# finally…
|
167
180
|
if @property_to_group.key? prop or @property_to_group.key? prop+'*'
|
168
181
|
|
169
|
-
return @property_to_group[prop] || @property_to_group[prop+'*']
|
182
|
+
return ( @property_to_group[prop] || @property_to_group[prop+'*'] )
|
170
183
|
|
171
184
|
end
|
172
185
|
|
@@ -186,7 +199,7 @@ module SCSSLint
|
|
186
199
|
end
|
187
200
|
|
188
201
|
# quick duck-type
|
189
|
-
quick_check_order props, grouped
|
202
|
+
quick_check_order( props, grouped )
|
190
203
|
|
191
204
|
# if we’re checking whitespace, do so
|
192
205
|
check_whitespace( grouped ) unless grouped.length < 2
|
@@ -204,17 +217,28 @@ module SCSSLint
|
|
204
217
|
next if prop[:group] == @groups[current_group]
|
205
218
|
|
206
219
|
# find an index
|
207
|
-
idx = @groups.index prop[:group]
|
220
|
+
idx = @groups.index( prop[:group] )
|
208
221
|
|
209
222
|
# if it’s less-than, error out
|
210
223
|
if idx < current_group
|
211
224
|
|
212
|
-
|
225
|
+
if prop[:name].start_with?( '--' )
|
226
|
+
|
227
|
+
add_lint( prop[:node], "CSS variables should be defined at the beginning of the rule (found #{prop[:name].bold})")
|
228
|
+
|
229
|
+
else
|
213
230
|
|
214
|
-
|
231
|
+
ext = config['extended_hinting'] ? " (assigned group ‘#{prop[:group].bold}’, found group ‘#{@groups[current_group].bold}’)" : ""
|
232
|
+
|
233
|
+
add_lint( prop[:node], "property ‘#{prop[:name].bold}’ should be #{hint_text_for(prop, grouped, props)}#{ext}" )
|
234
|
+
|
235
|
+
end
|
215
236
|
good = false
|
237
|
+
|
216
238
|
else
|
239
|
+
|
217
240
|
current_group = idx
|
241
|
+
|
218
242
|
end
|
219
243
|
|
220
244
|
end
|
@@ -236,10 +260,10 @@ module SCSSLint
|
|
236
260
|
group_conf = @configured_groups[name]
|
237
261
|
|
238
262
|
# if we don’t care about space, bail
|
239
|
-
(curr_idx += 1 and next) unless group_conf['space_around']
|
263
|
+
( curr_idx += 1 and next ) unless group_conf['space_around']
|
240
264
|
|
241
265
|
# similarly, if this group is too small to trigger spacing, bounce
|
242
|
-
(curr_idx += 1 and next)unless current[:props].length > group_conf['max_no_space']
|
266
|
+
( curr_idx += 1 and next ) unless current[:props].length > group_conf['max_no_space']
|
243
267
|
|
244
268
|
# set some easy references
|
245
269
|
next_group = detected_groups.length > curr_idx ? grouped[detected_groups[curr_idx + 1]] : nil
|
@@ -249,17 +273,18 @@ module SCSSLint
|
|
249
273
|
if !next_group.nil? and ((next_group[:first] - current[:last]) < 2)
|
250
274
|
|
251
275
|
# raise a lint error
|
252
|
-
add_lint current[:props].last[:node], "Must be at least one empty line after ‘#{current[:props].last[:name]}’"
|
276
|
+
add_lint( current[:props].last[:node], "Must be at least one empty line after ‘#{current[:props].last[:name]}’" )
|
253
277
|
|
254
278
|
# also, flag the next group so we don’t catch it next time ‘round
|
255
279
|
next_group[:raised] = true
|
280
|
+
|
256
281
|
end
|
257
282
|
|
258
283
|
# if there’s something before us, and there’s no space…
|
259
284
|
if !prev_group.nil? and ((current[:first] - prev_group[:last]) < 2) and current[:raised].nil?
|
260
285
|
|
261
286
|
# raise a lint error
|
262
|
-
add_lint current[:props].first[:node], "Must be at least one empty line before ‘#{current[:props].first[:name]}’"
|
287
|
+
add_lint( current[:props].first[:node], "Must be at least one empty line before ‘#{current[:props].first[:name]}’" )
|
263
288
|
|
264
289
|
end
|
265
290
|
|
@@ -275,13 +300,14 @@ module SCSSLint
|
|
275
300
|
dst_group = prop[:group]
|
276
301
|
|
277
302
|
# if we know about the group…
|
278
|
-
if grouped_props.key? dst_group
|
303
|
+
if grouped_props.key?( dst_group )
|
279
304
|
|
280
305
|
# get the first property of the current group
|
281
306
|
dst_prop = grouped_props[dst_group][:props].first
|
282
307
|
|
283
308
|
# if it’s a different property, return
|
284
309
|
return "after ‘#{dst_prop[:name].bold}’" if dst_prop != prop
|
310
|
+
|
285
311
|
end
|
286
312
|
|
287
313
|
# either our offending property is the sole member of a group, or it’s very lost… so look for a previous marker
|
@@ -300,11 +326,13 @@ module SCSSLint
|
|
300
326
|
|
301
327
|
# and return
|
302
328
|
return "after ‘#{dst_prop[:name].bold}’"
|
329
|
+
|
303
330
|
end
|
304
331
|
end
|
305
332
|
|
306
333
|
# otherwise, it probably belongs right at the start
|
307
334
|
"before ‘#{context.first[:name].bold}’"
|
335
|
+
|
308
336
|
end
|
309
337
|
end
|
310
338
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grouped_property_scss_linter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Pearse
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-05-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -55,11 +55,12 @@ dependencies:
|
|
55
55
|
description: Plugin for SCSS lint that lints the order of properties based on fuzzy
|
56
56
|
groups
|
57
57
|
email:
|
58
|
-
-
|
58
|
+
- hello@jonpearse.net
|
59
59
|
executables: []
|
60
60
|
extensions: []
|
61
61
|
extra_rdoc_files: []
|
62
62
|
files:
|
63
|
+
- ".editorconfig"
|
63
64
|
- ".gitignore"
|
64
65
|
- ".scss-lint.yml"
|
65
66
|
- Gemfile
|
@@ -95,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
96
|
version: '0'
|
96
97
|
requirements: []
|
97
98
|
rubyforge_project:
|
98
|
-
rubygems_version: 2.6.
|
99
|
+
rubygems_version: 2.6.14
|
99
100
|
signing_key:
|
100
101
|
specification_version: 4
|
101
102
|
summary: SCSS Lint plugin
|