question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

urlQuotes throwing warning for LESS variable

See original GitHub issue

Which version of lesshint are you using? 3.1.0

How are you running lesshint? CLI, Node.js API, Grunt/Gulp plugin? Gulp

What’s your .lesshintrc configuration?

{
    "fileExtensions": [".less"],
    "spaceAfterPropertyColon": {
        "enabled": true,
        "style": "one_space" // Comments are allowed
    },
    "propertyOrdering": {
        "enabled": false
    },
    "maxCharPerLine": {
        "enabled": false
    }
}

If you’re reporting a bug, please show us some code that’s failing.

@brand-logo: '/assets/images/logo.svg';

.head-logo {
	background: url(@brand-logo);
}

What did you expect to happen? No warning. The variable evaluates to a properly quoted url.

What’s the actual result? I get this warning: urlQuotes: URLs should be enclosed in quotes

Technically, I could write the background declaration as background: url('@{brand-logo}'); to prevent the warning, but it feels weird to add unnecessary interpolation just to make the linter happy. Thoughts?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
jwilssoncommented, Mar 16, 2017

Thanks for the extra examples!

I agree that a URL without a slash seems unlikely, and we can never be sure of what the variable actually contains. I still think just ignoring variables in url() is fine (FWIW I checked other linters and they do it too).

A PR would be highly appreciated! Let us know if you need anything.

0reactions
jwilssoncommented, Mar 17, 2017

Closed in #366.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is ESLint throwing warning about unused variable that's ...
By "using it", ESLint is referring to actually putting it to some use. Simply putting a value in it does not constitute using...
Read more >
MariaDB User Define Variable throws warning if it is empty
My question is: Is there any possible way to check whether the user-defined variable contains no result, and then directly return "0 results ......
Read more >
Multiple Imputation Warning that model contains more than ...
However, all I get is a table of titled Warnings: The imputation model for [variable] contains more than 100 parameters.
Read more >
Changelog | Stylelint
Fixed: throwing more informative error when all input files are ignored (#5709). ... Fixed: length-zero-no-unit false positives for Less variables (#4405).
Read more >
Throw a warning if we are declaring a variable with const and ...
While defining a variable in #Svelte, make sure to use let/var and not const, otherwise those bindings won't work, as it can't be...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found