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.

Data URI is not included in ignoreUrls option of max-len

See original GitHub issue

What version of ESLint are you using?

3.0.1

What parser (default, Babel-ESLint, etc.) are you using?

default

Please show your full configuration:

max-len: [2, 100, 2, { ignoreUrls: true, ignoreComments: false }]

What did you do? Please include the actual source code causing the issue.

const throbber = 'data:image/gif;base64,R0lGODlhEAAQAOMIAAAAABoaGjMzM0xMTGZmZoCAgJmZmbKysv///////////////////////////////yH/C05FVFNDQVBFMi4wAwEAAAAh+QQBCgAIACwAAAAAEAAQAAAESBDJiQCgmFqbZwjVhhwH9n3hSJbeSa1sm5GUIHSTYSC2jeu63q0D3PlwCB1lMMgUChgmk/J8LqUIAgFRhV6z2q0VF94iJ9pOBAAh+QQBCgAPACwAAAAAEAAQAAAESPDJ+UKgmFqbpxDV9gAA9n3hSJbeSa1sm5HUMHTTcTy2jeu63q0D3PlwDx2FQMgYDBgmk/J8LqWPQuFRhV6z2q0VF94iJ9pOBAAh+QQBCgAPACwAAAAAEAAQAAAESPDJ+YSgmFqb5xjV9gQB9n3hSJbeSa1sm5EUQXQTADy2jeu63q0D3PlwDx2lUMgcDhgmk/J8LqUPg+FRhV6z2q0VF94iJ9pOBAAh+QQBCgAPACwAAAAAEAAQAAAESPDJ+cagmFqbJyHV9ggC9n3hSJbeSa1sm5FUUXRTEDy2jeu63q0D3PlwDx3FYMgAABgmk/J8LqWPw+FRhV6z2q0VF94iJ9pOBAAh+QQBCgAPACwAAAAAEAAQAAAESPDJ+QihmFqbZynV9gwD9n3hSJbeSa1sm5GUYXSTIDy2jeu63q0D3PlwDx3lcMgEAhgmk/J8LqUPAOBRhV6z2q0VF94iJ9pOBAAh+QQBCgAPACwAAAAAEAAQAAAESPDJ+UqhmFqbpzHV9hAE9n3hSJbeSa1sm5HUcXTTMDy2jeu63q0D3PlwDx0FAMgIBBgmk/J8LqWPQOBRhV6z2q0VF94iJ9pOBAAh+QQBCgAPACwAAAAAEAAQAAAESPDJ+YyhmFqb5znV9hQF9n3hSJbeSa1sm5EUAHQTQTy2jeu63q0D3PlwDx0lEMgMBhgmk/J8LqUPgeBRhV6z2q0VF94iJ9pOBAAh+QQBCgAPACwAAAAAEAAQAAAESPDJ+c6hmFqbJwDV9hgG9n3hSJbeSa1sm5FUEHRTUTy2jeu63q0D3PlwDx1FIMgQCBgmk/J8LqWPweBRhV6z2q0VF94iJ9pOBAA7';

What did you expect to happen?

No warning for Data URI

What actually happened? Please include the actual, raw output from ESLint.

N:1 error Line N exceeds the maximum line length of 100 max-len

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
vitorbalcommented, Jul 9, 2016

hi @vsemozhetbyt, thanks for the issue!

It looks like according to this section of the code the regex that matches URLs doesn’t match all URIs on purpose to avoid false positives. I’m guessing we would need a separate regex that checks for data URIs specifically.

Also, since the name of the option is ignoreUr*L*s and not ignoreUr*i*s I don’t think we should consider this a bug, but a rule enhancement. Maybe as a separate ignoreDataUris option?

I think you could also use the ignorePattern to achieve this, but in my opinion, this seems like a potentially worthwhile addition.

We can accept this issue once someone on the ESLint team champions it and three other people endorse the change (with no one voting against it). Would you be willing to work on a PR for this if it gets accepted?

0reactions
vsemozhetbytcommented, Jul 13, 2016

Well, it seems we have “against” votes, so I can close it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

data-uri function does not respect the "paths" parameter when ...
The data-uri() function, by contrast, appears to ignore the paths option - all file paths are resolved relative to the working directory of ......
Read more >
Data URLs - HTTP - MDN Web Docs - Mozilla
Data URLs, URLs prefixed with the data: scheme, allow content creators to embed small files inline in documents. They were formerly known as ......
Read more >
Why use data URI scheme? - Stack Overflow
Disadvantages: Data URIs are not separately cached from their containing documents (e.g. CSS or HTML files) so data is downloaded every time the ......
Read more >
max-len - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
Data URIs | CSS-Tricks
Setting long expires on CSS files should help. Data URIs are not limited to images, they could literally be anything.
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