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.

eslint + flow support

See original GitHub issue

my project uses eslint + flow

importing images generally works because they can be found on the file system, but when adding query params, this throws off both eslint and flow.

my workaround right now is to update .flowconfig to strip the query

[ignore]

[include]

[libs]

[lints]

[options]
module.name_mapper='^\(.+\.\(png\|gif\|jpg\|webp\)\)\?\(url\|original\|include\|inline\|webp\|sprite\)$' -> '\1'

[strict]

and to add // eslint-disable-line import/no-unresolved on the import line when i do use a query.

not sure what the best way to fix this. either some extra settings for eslint-plugin-import or to have a different api for how to trigger special actions that don’t involve changing up the import line.

either way, this might not be a bug for this repo, but filing it here, in case others run into this. feel free to close.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
iam4xcommented, Jun 29, 2018

Thanks 👍

I needed the SVG as well, here is a more complete regex:

module.name_mapper='^\(.+\.\(svg\|png\|gif\|jpg\|webp\)\)\?\(url\|original\|include\|inline\|webp\|sprite\)$' -> '\1'
0reactions
lededjecommented, Mar 23, 2020

The answer is a little out of date now. There is a resize option that includes an additional param of size, for example: ?resize&size=960

This is the regular expression I ended up using, but it is very loose at the end; you might want to tighten it up by limiting the options you can pass to it.

module.name_mapper='^\(.+\.\(svg\|png\|gif\|jpg\|webp\)\)\?\(url\|original\|include\|inline\|webp\|resize\|sprite\).+' -> '\1'
Read more comments on GitHub >

github_iconTop Results From Across the Web

gajus/eslint-plugin-flowtype: Flow type linting rules for ... - GitHub
They are simpler to construct, test, and use; They help to avoid temporal coupling; Their usage is side-effect free (no defensive copies); Identity...
Read more >
ESLint | Flow
Learn how to use Flow with ESLint. ... ESLint is a static analysis tool which can help you quickly find and fix bugs...
Read more >
eslint-plugin-flow - npm
Flowtype linting rules for ESLint.. Latest version: 2.29.1, last published: 6 years ago. Start using eslint-plugin-flow in your project by ...
Read more >
eslint-plugin-flowtype-errors - npm package - Snyk
Lower barrier: Any editor that has ESLint support now supports Flow · Less editor configuration: No need to change your entire workflow to...
Read more >
eslint-plugin-flowtype | Yarn - Package Manager
Flow type linting rules for ESLint. eslint-plugin-flowtype. Installation; Configuration. Shareable configurations; Community maintained configurations.
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