lib/scss_lint/linter/declaration_order.rb in scss-lint-0.36.0 vs lib/scss_lint/linter/declaration_order.rb in scss-lint-0.36.1
- old
+ new
@@ -32,14 +32,15 @@
def important_node?(node)
DECLARATION_ORDER.include?(node.class)
end
def check_node(node)
- children = node.children.select { |n| important_node?(n) }
- .map { |n| [n, node_declaration_type(n)] }
+ children = node.children.each_with_index
+ .select { |n, _| important_node?(n) }
+ .map { |n, i| [n, node_declaration_type(n), i] }
- sorted_children = children.sort do |(_, a_type), (_, b_type)|
- DECLARATION_ORDER.index(a_type) <=> DECLARATION_ORDER.index(b_type)
+ sorted_children = children.sort do |(_, a_type, i), (_, b_type, j)|
+ [DECLARATION_ORDER.index(a_type), i] <=> [DECLARATION_ORDER.index(b_type), j]
end
check_children_order(sorted_children, children)
end