Skip to content
This repository was archived by the owner on Sep 6, 2018. It is now read-only.

Missing import imcompatible with unused variable #8

Closed
jbalsas opened this issue Jul 5, 2017 · 5 comments
Closed

Missing import imcompatible with unused variable #8

jbalsas opened this issue Jul 5, 2017 · 5 comments

Comments

@jbalsas
Copy link
Contributor

jbalsas commented Jul 5, 2017

We are currently looking for imports in a componente when a template is used, so if you're using {call Dropdown.render} we're looking (I guess ) for an import Dropdown from... statement.

If not found, we have get the following message:

File - src/main/resources/META-INF/resources/components/configurabledropdown/ConfigurableDropdown.soy

     It looks like the following component calls are missing an import:
     
     Dropdown

This is incompatible with estlint::unused-var rule, so we usually have

import metal-dropdown // avoid declaring Dropdown when not used
@mthadley
Copy link
Collaborator

mthadley commented Jul 6, 2017

@jbalsas It's not very sophisticated. It's just checking for an import statement that contains the namespace in it's path. So something like import "./Dropdown.soy" should be fine.

I think it's case-sensitive, so that is why it's failing with metal-dropdown. I'm guessing if you change it to {call dropdown.render /} is probably doesn't fail.

@jbalsas
Copy link
Contributor Author

jbalsas commented Jul 6, 2017

Yeah, that's what I figured it should be doing... since we can't change the namespace or the import... what do you think would be the quickest fix? Just make the check case-insensitive? 😂

@mthadley
Copy link
Collaborator

mthadley commented Jul 6, 2017

Yea, for the moment I think it's a reasonable improvement. I'll update it soon.

@jbalsas
Copy link
Contributor Author

jbalsas commented Jul 27, 2017

Hey @mthadley, I wanted to apply this to https://github.com/metal/metal-clay-components where we have import 'clay-icon'; and {call ClayIcon.render}.

Do we have a .soycriticrc or maybe soycritic.config.js where we could maybe add config option like jsImportToSoyCallRegex so we could fix this in a general/configurable way?

What do you think?

@mthadley
Copy link
Collaborator

mthadley commented Jul 27, 2017

@jbalsas We don't, however I think it's a great idea. Take a look at #9.

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

No branches or pull requests

2 participants