Polymer / tools

Polymer Tools Monorepo
BSD 3-Clause "New" or "Revised" License
430 stars 200 forks source link

Linter can't tell that a js file is imported by an unopened html file #1410

Open nomego opened 8 years ago

nomego commented 8 years ago

If you choose to split up Polymer component markup and JavaScript (as we do), you end up with a my-element.html with a <script src="my-element.js"></script> reference, completing the component.

However, when then developing said component's JavaScript file, with (for example) https://github.com/nomego/SublimeLinter-contrib-polylint, polylint will not know where to find the actual dom-module specification.

It would therefore be nice to have some way of declaring this relationship from both files, and the proposed way of doing that (by @garlicnation in a Slack chat from October) is by some "JSDoc trickery" such as @importedBy my-element.html in the JavaScript file.

Useful suggestion for default value approaches for @importedBy (enabled by a flag somewhere?) would be to:

  1. Search for an HTML file named as the JS file - if Hydrolysis runs on my-element.js and finds a Polymer({ is: 'x' }) call, it could look for a file called my-element.html
  2. Search for an HTML file named as the component - if Hydrolysis runs on my-element.js and finds a Polymer({ is: 'x' }) call, it could look for a file called x.html
  3. The combination of above - if file is named component.js, assume component.html
rictic commented 7 years ago

Still an issue in 2.0, and one that we intend to solve.

nomego commented 7 years ago

Great! Anyone working on it, anything that can be done to help?

nomego commented 7 years ago

Any update on this @rictic ?

nomego commented 7 years ago

Related to #509

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.