Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Spit out verbose warnings/errors generated by polymer #36

Open
nevir opened this issue Aug 14, 2014 · 10 comments
Open

Spit out verbose warnings/errors generated by polymer #36

nevir opened this issue Aug 14, 2014 · 10 comments

Comments

@nevir
Copy link
Contributor

nevir commented Aug 14, 2014

No description provided.

@nevir nevir self-assigned this Aug 14, 2014
@robdodson
Copy link

  • Missing outer template when trying to use a conditional or repeating template
  • Trying to override a native property like title
  • Placing content inside the <shadow> element (people assume this will render, it won't)
  • Using <template> inside of <select>, <table>, or other parser specific elements (http://www.polymer-project.org/resources/faq.html#option-tr)
  • Attempting to use automatic node finding with generated DOM
  • Placing paper-input inside of form
  • Missing aria-label on your elements
  • Setting width or height on an element that is inline by default
  • Misspelled attribute name not running changed watcher
  • Doing things before polymer-ready has fired

@robdodson
Copy link

@sorvell @addyosmani @ebidel @arthurevans are there other common mistakes you see developers making that we could warn about? I'm just writing down everything that pops into my head, we can turn these into individual issues to make it easier to manage

@sachinhosmani
Copy link
Contributor

I was thinking of a warning about objects getting unexpectedly shared across multiple instances of an element.

Also, I wonder how many of all these are doable.

@mckoss
Copy link

mckoss commented Aug 21, 2014

Instance of element setting an attribute that is NOT defined as a published attribute of the element (probably a typo).

@mckoss
Copy link

mckoss commented Aug 21, 2014

Optional trace log of attributes and instance properties observed change events.

@robdodson
Copy link

@mckoss also suggested we could create our own static analysis tool like jshint. That may be a better solution for these warnings instead of doing it all in the polymer extension at runtime

@mckoss
Copy link

mckoss commented Aug 21, 2014

<polymer-element> with child nodes NOT one of <template> or <script>. We had a bug where we put a <style> node as a direct child of (rather than as a child of a element). This was identical to a top-level style definition - which is definitely NOT the intention:

<polymer-element ...>
  <style>   <!-- THIS IS IN THE WRONG PLACE -->
 ...
  </style>
  <template>
  ...
  </template> 
</polymer-element>

@addyosmani
Copy link
Contributor

Some more thoughts after yesterday's eng meeting:

We've explored logging hints about code smells / linting errors to developers in the past as part of the DevTools, in particular around CSS. Warnings like this are useful but need to be done in a way that they can be switched off or easily filtered otherwise we'll end up annoying users who might otherwise find the rest of our features useful. So, if we do this - let's make it opt-in by default but something you can switch off. The setting can be easily persisted in localStorage along with other DevTools settings.

@addyosmani
Copy link
Contributor

We could also warn about:

We can also provide a link to the compatibility notes for workarounds. Where possible, we should consider whether we opt for short useful messages with a link to docs vs. longer messages without links imo.

@robdodson
Copy link

Are there any examples of running an AST from the devtools to lint code?

@nevir nevir removed their assignment Sep 9, 2014
@ebidel ebidel closed this as completed Sep 24, 2014
@ebidel ebidel reopened this Sep 24, 2014
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

6 participants