Create a gist now

Instantly share code, notes, and snippets.

scss-lint with SublimeLinter in ST2
import re
from base_linter import BaseLinter
CONFIG = {
'language': 'SCSS',
'executable': 'scss-lint.sh',
'lint_args': '{filename}'
}
class Linter(BaseLinter):
def parse_errors(self, view, errors, lines, errorUnderlines, violationUnderlines, warningUnderlines, errorMessages, violationMessages, warningMessages):
for line in errors.splitlines():
match = re.match(r'^.+:(?P<line>\d+)\s\[(?P<type>W)\]\s(?P<error>.+)', line)
if match:
error_type, error, line = match.group('type'), match.group('error'), match.group('line')
line = int(line)
error = '[{0}] {1}'.format(error_type[0].upper(), error)
if error_type == 'W':
messages = warningMessages
underlines = warningUnderlines
else:
messages = errorMessages
underlines = errorUnderlines
self.add_message(line, lines, error, messages)
self.underline_range(view, line, 0, underlines)
#!/usr/bin/env bash
echo $(scss-lint -c ~/.scss-lint.yml $*)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment