Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sass-lint dies when it encounters variables starting with $-- #1248

Open
TheJaredWilcurt opened this issue Jan 8, 2019 · 13 comments
Open

Sass-lint dies when it encounters variables starting with $-- #1248

TheJaredWilcurt opened this issue Jan 8, 2019 · 13 comments
Assignees

Comments

@TheJaredWilcurt
Copy link

Sass-Lint Version: 1.12.1

Code:

$--background-color: #F00

CLI Error:

src/sass/_var.sass

║ Line     │ Column   │ Type     │ Message                                                │ Rule ID              ║
╟──────────┼──────────┼──────────┼────────────────────────────────────────────────────────┼──────────────────────╢
║ 1        │ 1        │ error    │ Please check validity of the block starting from       │ Fatal                ║
║          │          │          │ line #1                                                │                      ║

I think naming your variable this way is ugly and terrible, but I'm just trying to import in the variables file used by ElementUI and that's how they name it, and that causes the linter to crash.

@PurpleBabar
Copy link
Contributor

Hi :)

Just making a guess for the moment but it seems to be a duplicate with #877 since the issue comes from -- and not espacially from $--
Could you just do a test where you try to remove the first $ in your import and tell us if the error moves on to another line or stays on this one ? :)

Thanks :)

@DanPurdy
Copy link
Member

It'll be to do with the AST gonzales-pe, those errors come from that package. It's an old version running off a fork I'd done to fix some.issues as Gonzales hadn't been updated in a while.

@TheJaredWilcurt
Copy link
Author

@PurpleBabar No I can't, because ALL Sass variables begin with a $.

$--red: #F00

body
    background: $--red

@PurpleBabar
Copy link
Contributor

@DanPurdy yup :)
@TheJaredWilcurt i know that vars start with $ :). That was just to confirm that, in your case, the parser broke on -- and not on $--. If you can't test it, just wait for the update of the parser :)

Cheerz :)

@TheJaredWilcurt
Copy link
Author

@webartov
Copy link

webartov commented Mar 22, 2019

@PurpleBabar
The following doesn't call an error on v. 1.12.1 (but maybe I misunderstood the question)

$test: #0f0;
.element {
  --main-bg-color: $test;
}

And this one calls:

$--test: #0f0;
.element {
  color: $--test;
}

Basically it's needed for https://element.eleme.io
By default all variables there come as $--
Please also note that $- or $-var-------------test will not call an error too.
@DanPurdy
Could you please tell if there are any tricks to avoid the error or fix will come soon?
We badly need this for our project and I don't want to switch to scss-lint just because of this.

@webartov
Copy link

webartov commented Mar 22, 2019

Looks like dead to me: tonyganch/gonzales-pe#290 or not tonyganch/gonzales-pe#290 (comment)

@DanPurdy will the patch solve the issue with $-- too?

@webartov
Copy link

Can somebody help apply the fix to the linter?
tonyganch/gonzales-pe#295

@srowhani srowhani self-assigned this Apr 16, 2019
@TheJaredWilcurt
Copy link
Author

So it's been a year. looks like gonzales might have fixed it on their end, but never did a release, and it looks like this project is marked as deprecated. lame

@webartov
Copy link

webartov commented Mar 2, 2020

So it's been a year. looks like gonzales might have fixed it on their end, but never did a release, and it looks like this project is marked as deprecated. lame

I think gonzales fixed only part of the issue. please refer to my comment here for details tonyganch/gonzales-pe#295 (comment)

@TheJaredWilcurt
Copy link
Author

https://www.npmjs.com/package/gonzales-pe

Gonzales-pe v4.3.0 should fix this. Just need to update that dependency and do a new release

@deepexpert-chenkai
Copy link

anything new?

@TheJaredWilcurt
Copy link
Author

@deepexpert-chenkai Would be fixed by #1302 However @DanPurdy has taken a break from maintaining this repo of unspecified length. Sooooo, don't hold your breath.

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

No branches or pull requests

6 participants