Fake error on <style> tag using sublime-linter csslinter

As a relative newbie for sublime 3, I am trying to set up a sublime-linter plugin to validate HTML and CSS files.

The problem is that by setting HTMLTidy and CSSLint and the corresponding plugins that are in the HTML files, csslint is throwing validation errors for the element in my html pages.

'Unexpected token' <'on line 8, col 1.'

I am using Sublime 3 (Build 3083) on Windows 7 with v0.10.0 csslint and HTML Tidy for Windows version 5.1.9 from HTML5 package

So, for example, if I have a html file like:

<!DOCTYPE html>
<html>
  <head>
    <title>This is a title</title>
    <style>
       h1 {color:red;}
       p {color:blue;}
    </style>
  </head>
  <body>
    <h1>A heading</h1>
    <p>A paragraph.</p>
  </body>
</html>

      

The <style> tag is then expanded and marked as error, just like the closing one.

Using "Toggle Linter" to turn SublimeLinter options on and off, I can see that these errors are only generated when csslint is enabled.

From reading the linters and SublimeLinter notes, I can suppress this behavior by adding a rule to the csslint section of my SublimeLinter settings of the form

         "ignore_match": [
                ".*Unexpected token.*"
            ],

      

This fixes this bug, but has the side effect that a new warning is generated in the first style element - in the example above, the h1 element of the form

The {h1} header must not be qualified

Which one can I only remove by creating a dummy first line in my style element.

My questions:

  • Is there a sane way to prevent the second error, where the CSS element is in the line right after the style tag, without preventing obscure CSS issues from being highlighted?
  • Should I format my HTML differently to avoid these validation errors?
  • Is there a way to avoid the issue with a different set of lint tools that will still provide automatic HTML5 and CSS validation in Sublime?

thank

+3


source to share





All Articles