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.

Handle imports used only in expressions properly

See original GitHub issue

Import statement must not be marked as unused in following example

image

It happens because ES6UnusedImportsHelper#isUnusedSpecifier -> ES6UnusedImportsHelper#getLocalReferencesQuery creates LocalSearchScope containing only script tag, it should be containingFile in case of Svelte.

My first dumb idea is to copy whole ES6UnusedImportsInspection and change necessary lines, but this will be hard to maintain.

@anstarovoyt I’d appreciate your input here, thanks.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
tomblachutcommented, Sep 5, 2020

@unlocomqx this is related to directives support, they’re not references yet, so import mechanism can’t find them

1reaction
tomblachutcommented, Aug 23, 2020

@anstarovoyt Your suggestion with custom SvelteJSReferenceExpression works great, I just need to refine types evaluation. I’m gonna break my code into 2 PRs and redo #146 because as you’ve said weird reference search is no longer needed.

Bonus points for fixed rename refactoring and ‘$’ not being treated as part of reference

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python import: Advanced Techniques and Tips
In this tutorial, you'll learn how to: Use modules, packages, and namespace packages; Handle resources and data files inside your packages; Import modules ......
Read more >
import - JavaScript - MDN Web Docs - Mozilla
The static import declaration is used to import read-only live bindings which are exported by another module. The imported bindings are ...
Read more >
Import Statements in TypeScript: Which Syntax to Use
TypeScript has multiple syntaxes for imports. When should you use which? It depends. In this blog, Jessica Kerr shares her thoughts, ...
Read more >
5. The import system — Python 3.11.1 documentation
The import statement is the most common way of invoking the import machinery, but it is not the only way. Functions such as...
Read more >
Understanding Modules and Import and Export Statements in ...
In this tutorial, you will learn what a JavaScript module is and how to use import and export to organize your code.
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