Polymer / atom-plugin

Provides autocompletion, linting, and more for web components.
Other
32 stars 8 forks source link

'Undefined-elements' error using "app-drawer-template"-like app structure #72

Closed derhuebiii closed 6 years ago

derhuebiii commented 6 years ago

Hi,

I managed to install atom-plugin (polymer-ide 0.4) and am getting the inline comments on my code (Polymer 1).

Anyway it does not recognize any of the elements that I have imported when they are not imported directly in the header of the sub-elements (e.g. my-site1.html).

My app structure is:

Questions:

  1. Is this behavior correct? If I import the elements inside the html file I am using them, the error doesn't appear.
  2. If it is desired behavior, is the app-drawer-template structure not best practice? Do I need to do the element imports in each my-app-element files?

Also my polymer.json entry seems to be ignored, as even with this it is still showing the undefined error.

"lint": {
    "rules": ["polymer-1"],
    "ignoreWarnings": ["undefined-elements", "undefinedElements", "undefined"]
  }

Thanks for your help! Tim

rictic commented 6 years ago

Yes, to use an element you should either import it from your file, or import a file that imports it. Depending on the file that imports your file also importing other files is fragile and hard for both humans and robots to read and reason about. Where's the app-drawer-template that recommends this? We should probably start a conversation there about this too.

The ignoreWarnings part is fixed and tested at master.

derhuebiii commented 6 years ago

Thanks!

Just for sake of completeness: I was refering to the now called polymer-starter-kit. https://github.com/PolymerElements/polymer-starter-kit/tree/master/src But actually I think it was more my interpretation, because in the my-view1, 2, 3... no polymer elements are used and polymer itself gets imported in each.

As it is a starter-kit, a comment in the templates might help stating that each my-view needs to import itself. I will comment there so we can discuss.