SublimeLinter-contrib-stylelint icon indicating copy to clipboard operation
SublimeLinter-contrib-stylelint copied to clipboard

Issue with inline Sass double slash comments

Open chris-pearce opened this issue 8 years ago • 6 comments

Not sure if this related to your Sublime plug-in but when I have Sass comments like this:

display: flex; // [2]

It throws this error in the console:

SublimeLinter: stylelint output:
CssSyntaxError: /var/folders/5k/l6bx7lys5mlcznbq3zj3q2_cp_csgm/T/SublimeLinter3-chrisp/form-input-with-label.css:50:20: Unknown word
    at Input.error (/Users/chrisp/workspace/campaign-monitor/workflowbuildercontext.uiservice/WorkflowBuilderContext.UIService/node_modules/postcss/lib/input.js:61:22)
    at Parser.unknownWord (/Users/chrisp/workspace/campaign-monitor/workflowbuildercontext.uiservice/WorkflowBuilderContext.UIService/node_modules/postcss/lib/parser.js:457:26)
    at Parser.word (/Users/chrisp/workspace/campaign-monitor/workflowbuildercontext.uiservice/WorkflowBuilderContext.UIService/node_modules/postcss/lib/parser.js:174:14)
    at Parser.loop (/Users/chrisp/workspace/campaign-monitor/workflowbuildercontext.uiservice/WorkflowBuilderContext.UIService/node_modules/postcss/lib/parser.js:60:26)
    at parse (/Users/chrisp/workspace/campaign-monitor/workflowbuildercontext.uiservice/WorkflowBuilderContext.UIService/node_modules/postcss/lib/parse.js:26:12)
    at new LazyResult (/Users/chrisp/workspace/campaign-monitor/workflowbuildercontext.uiservice/WorkflowBuilderContext.UIService/node_modules/postcss/lib/lazy-result.js:61:24)
    at Processor.process (/Users/chrisp/workspace/campaign-monitor/workflowbuildercontext.uiservice/WorkflowBuilderContext.UIService/node_modules/postcss/lib/processor.js:34:16)
    at lintString (/Users/chrisp/workspace/campaign-monitor/workflowbuildercontext.uiservice/WorkflowBuilderContext.UIService/node_modules/stylelint/dist/standalone.js:88:9)
    at /Users/chrisp/workspace/campaign-monitor/workflowbuildercontext.uiservice/WorkflowBuilderContext.UIService/node_modules/stylelint/dist/standalone.js:70:14 

Removing the comments and it goes back to working.

chris-pearce avatar Feb 19 '16 07:02 chris-pearce

I think this occurs when the syntax is set to CSS instead of SCSS. I was working around this here: https://github.com/kungfusheep/SublimeLinter-contrib-stylelint/issues/15

However, it would probably make sense for the linter to asses the syntax automatically instead of having to define it in the config.

backflip avatar Feb 19 '16 11:02 backflip

No joy with that I'm afraid, here's the contents of my SublimeLinter-sublime-settings—User file with "args": ["--syntax", "scss"] added:

{
    "user": {
        "debug": true,
        "delay": 0.25,
        "error_color": "D02000",
        "gutter_theme": "Packages/SublimeLinter/gutter-themes/Default/Default.gutter-theme",
        "gutter_theme_excludes": [],
        "lint_mode": "background",
        "linters": {
            "eslint": {
                "@disable": false,
                "args": [],
                "chdir": "${project}",
                "excludes": []
            },
            "scss": {
                "@disable": false,
                "args": [],
                "chdir": "${project}",
                "exclude-linter": "",
                "excludes": [],
                "include-linter": ""
            },
            "stylelint": {
                "@disable": false,
                "args": ["--syntax", "scss"],
                "chdir": "${project}",
                "excludes": []
            }
        },
        "mark_style": "fill",
        "no_column_highlights_line": false,
        "passive_warnings": false,
        "paths": {
            "linux": [],
            "osx": [],
            "windows": []
        },
        "python_paths": {
            "linux": [],
            "osx": [],
            "windows": []
        },
        "rc_search_limit": 3,
        "shell_timeout": 10,
        "show_errors_on_save": false,
        "show_marks_in_minimap": true,
        "syntax_map": {
            "html (django)": "html",
            "html (rails)": "html",
            "html 5": "html",
            "php": "html",
            "python django": "python"
        },
        "warning_color": "DDB700",
        "wrap_find": true
    }
}

chris-pearce avatar Feb 21 '16 12:02 chris-pearce

Any ideas on this?

chris-pearce avatar Mar 14 '16 04:03 chris-pearce

See

chris-pearce avatar Mar 18 '16 03:03 chris-pearce

I'm experiencing the same issue, and have tried some of the adjustments listed here without much luck. I just noticed this though, and thought I'd share:

// Passes
.black {
  // color: #000;
}

// Fails 
// .black {
//   color: #000;
// }

pjconnors avatar Jun 14 '16 19:06 pjconnors

Any updates on this issue? It's kind of a roadblock.

ivancuric avatar Jun 15 '16 10:06 ivancuric