Skip to content

error while specifying variables in CSS3 ; Expected RBRACE. This rule looks for recoverable syntax error #720

Open

Description

@avreddy1996

:root{ --nvctheme-color: #3f1a67; --nvcthemelight-color: #5f259e; }
this is the code I am using to define website theme color as a variable but in CSSlint it is showing error
ERROR: Expected RBRACE at line 17, col 3. This rule looks for recoverable syntax errors. (errors) Browsers: All

Activity

  1. aliceinpalth commented on Nov 23, 2017

    @aliceinpalth

    Experiencing this as well.

  2. adityarao310 commented on Dec 2, 2017

    @adityarao310

    Yup, same here

  3. frvge commented on Dec 29, 2017

    @frvge
    Contributor

    The parser doesn't know how to handle CSS Variables as far as I know.

  4. varunyellina commented on Jan 8, 2018

    @varunyellina

    Happens with me too.

  5. Redmega commented on Feb 19, 2018

    @Redmega

    Support for css variables has landed in all major browsers except ie11. csslint should support it!

  6. vrosu commented on Mar 27, 2018

    @vrosu

    Same issue here. Don't know why, but when trying to use /* csslint ignore:start / and / csslint ignore:end */ I can't get rid of errors inin CodeMirror (uses CSSLint 1.0.4). Has anyone managed to use the ignore to get rid of the css variables errors?

  7. JoniVR commented on Mar 31, 2018

    @JoniVR

    @vrosu Nope, same issue as described above, really annoying. Ignoring doesn't seem to help.

  8. hroger1030 commented on Apr 20, 2018

    @hroger1030

    Ran into this issue this morning, Visual Studio won't publish css with this error, even though the pages run just fine locally.

    This is a 6 month old bug, and it hasn't been addressed. If it is too hard to properly write rules to properly identify this use case, then turn off validation checking for empty rules so you don't break things while you get your logic sorted out.

    Kinda irritated that I have to fight with csslint to get work done, it is costing more time than it is saving...

  9. added a commit that references this issue on Aug 8, 2018
  10. LinearDynamics commented on Sep 5, 2018

    @LinearDynamics

    landed here from a search. Have a WordPress site going and the editor didn't like my variable (expected RBRACE).

  11. bakcxoj commented on Nov 17, 2018

    @bakcxoj

    Is this still an issue?

  12. hroger1030 commented on Nov 20, 2018

    @hroger1030

    yep. Here is lines 1-8 of a css sheet:

    :root
    {
    --accent1: #777777;
    --accent2: #cccccc;
    --Background1: #000000;
    --Background2: #44;
    --Background3: #55;
    }

    gives the following errors:

    Severity Code Description Project File Line Suppression State
    Error empty-rules (CssLint) Rule is empty. Website D:\SourceCode\test\C# - gc\Website\App_Themes\PageStyle.css 1
    Error errors (CssLint) Expected RBRACE at line 3, col 5. Website D:\SourceCode\test\C# - gc\Website\App_Themes\PageStyle.css 3
    Error errors (CssLint) Expected RBRACE at line 4, col 5. Website D:\SourceCode\test\C# - gc\Website\App_Themes\PageStyle.css 4
    Error errors (CssLint) Expected RBRACE at line 5, col 5. Website D:\SourceCode\test\C# - gc\Website\App_Themes\PageStyle.css 5
    Error errors (CssLint) Expected RBRACE at line 6, col 5. Website D:\SourceCode\test\C# - gc\Website\App_Themes\PageStyle.css 6
    Error errors (CssLint) Expected RBRACE at line 7, col 5. Website D:\SourceCode\test\C# - gc\Website\App_Themes\PageStyle.css 7

  13. parak80 commented on Nov 27, 2018

    @parak80

    I have the same problem, it gives no error in appveyor client test but in visual studio where my backend included I see errors like above for my variables.css
    :root{
    --accent-color: #5491db;
    --nav-back-color:#353b44;
    ...
    }
    Anyone can help please?

  14. bakcxoj commented on Nov 28, 2018

    @bakcxoj

    @parak80 There's not really anything you can do. It's an issue with CSSLint. This issue has been open for over a year.

    Speaking of which, are there any Pull Requests addressing this issue?

  15. frvge commented on Dec 9, 2018

    @frvge
    Contributor

    CSSLint/parser-lib#248 got opened a few days ago.

  16. 19 remaining items

  17. circuitsacul commented on May 10, 2021

    @circuitsacul

    2021 and this issue is still an issue?

  18. thenexus00 commented on Jul 14, 2021

    @thenexus00

    2021 and this issue is still an issue?

    Yes, Crazy hey.

  19. GeneralMine commented on Jul 20, 2021

    @GeneralMine

    Can confirm that's still an issue...

  20. DevWeb13 commented on Oct 26, 2021

    @DevWeb13

    26/10/2021 Always the issue in codacy...

  21. tomivm commented on Dec 15, 2021

    @tomivm

    15/12/2021 the issue persists in codacy

  22. S0AndS0 commented on Jan 15, 2022

    @S0AndS0

    For those that land here after a web-search, the following Awk/Bash wrapper script is what I currently use to ignore RBRACE errors related to CSS custom properties;

    #!/usr/bin/env bash
    
    _args=( "${@?No arguments provided}" );
    
    awk 'BEGIN {
      delete buffer;
      after_match = 1;
      header_amount = 5;
    
      pattern_one = "RBRACE";
      pattern_two = ".*--\\w(-|\\w)+:";
    
      matched_one = 0;
      counter = 0;
    }
    {
      ## Print header
      if (NR < header_amount) {
        print $0;
        next;
      }
    
      if (!matched_one) {
        if ($0 ~ pattern_one) {
          # print "## MATCHED PATTERN ONE";
          delete buffer;
          matched_one = 1;
        } else {
          buffer[length(buffer)] = $0;
          if (!length($0)) {
            for (i in buffer) {
              print buffer[i];
            }
            delete buffer;
          }
        }
      } else {
        if ($0 ~ pattern_two) {
          counter++;
        } else if (counter > after_match) {
          counter = 0;
          matched_one = 0;
        }
      }
    }' < <(csslint "${_args[@]}");
  23. chris-oliver-getvisibility commented on Feb 3, 2023

    @chris-oliver-getvisibility

    It's clear that this repository has been abandoned.

    Does anybody know if there is a spiritual successor?

  24. S0AndS0 commented on Mar 26, 2023

    @S0AndS0

    @chris-oliver-getvisibility recently I went on the hunt for alternatives, and it seems stylelint may be able to satisfy the want of CSS (and SCSS) linting... though I've yet to make the time to test it 🤷

  25. chris-oliver-getvisibility commented on Mar 27, 2023

    @chris-oliver-getvisibility

    Thanks @S0AndS0 !

  26. linusjf commented on Feb 9, 2024

    @linusjf

    Any updates on this? CSS variables are breaking csslint.

  27. linusjf commented on Feb 10, 2024

    @linusjf

    Dropped the use of csslint from my project. stylelint seems to be the way forward.

  28. Xmetalfanx commented on Feb 10, 2024

    @Xmetalfanx

    Dropped the use of csslint from my project. stylelint seems to be the way forward.

    i am not even sure (it was at LEAST MONTHS ago or longer) but i think that is what i did here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions