Search code examples
sasssublimetext3sublimetextsublimelinter

How to ignore specific rules in Sublime Linter SCSS (Sass)?


I'm trying to learn how to silence a rule in SublimeLinter-scss-lint (specifically EmptyLineBetweenBlocks).

For SublimeLinter-csslint, I can run scss-lint --list-rules in Terminal, locate the rule I don't like in the output, and add it to the ignore array in SublimeLinter.sublime-settings (as below).

{
    "user": {
        // ...
        "linters": {
            "csslint": {
                // ...
                "ignore": [
                    // Following rules will be ignored.
                    "adjoining-classes",
                    "box-model",
                    "box-sizing",
                    "fallback-colors",
                    "ids",
                    "universal-selector"
                ],
                // ...
            },
            // ...
        }
    }
}

For SCSS, there doesn't appear to be a similar way to find rule names in Terminal, and there's no scss-lint object in Sublime Linter settings. So…how is this done?

Thank you.


Solution

  • Here's a way I found to make it work.

    • I created a file in my Home directory (~/) named .scss-lint.yml.
    • In it, I copy–pasted rules I wanted to modify from the default.yml file located in/Library/Ruby/Gems/2.0.0/gems/scss_lint-0.39.0/config/, preserving indentation.
    • Close and re-open any SCSS files in Sublime to see the changes.

    Example:

    linters:
    
      EmptyLineBetweenBlocks:
        enabled: false
    
      LeadingZero:
        enabled: true
        style: include_zero
    
      MergeableSelector:
        force_nesting: false