Tools: `polymer lint` breaks when there is an empy style block

Created on 23 May 2018  路  6Comments  路  Source: Polymer/tools

Create a m-test.html file with the content:

<dom-module id="m-test">
  <template>
    <style></style>
  </template>

  <script>
    class MTest extends Polymer.Element {
      static get is() {
        return 'm-test';
      }
    }
    window.customElements.define(MTest.is, MTeste);
  </script>
</dom-module>

Then run polymer lint --rules polymer-2 --input m-test.html breaks with the following error and exit code 1.

m-test.html(1,1) warning [internal-lint-error] - Internal error during linting: Cannot read property '__location' of undefined

Removing the <style> block or setting some comment e.g. /* */ linter passes

Problem seems introduced in polymer-cli v1.7.x

wontfix

Most helpful comment

Somewhat amazingly it seems this bug can be worked-around by documenting the work-around ...

diff --git a/index.html b/index.html
index 9beb622..ce1795e 100644
--- a/index.html
+++ b/index.html
@@ -19,7 +19,7 @@
                <dom-bind>
                    <template>
                        <custom-style>
-                           <style include="demo-pages-shared-styles"></style>
+                           <style include="demo-pages-shared-styles"><!-- https://github.com/Polymer/tools/issues/408 --></style>
                        </custom-style>

                        <paper-bottom-sheet slide="{{sliding}}" modal="{{modalSheet}}" with-backdrop="[[withBackdrop]]" id="sheet">

All 6 comments

Up

another format around this is to have the style tag span 2 lines

<style>
</style>

A fix to the tool would be appreciative though

Also if it helps debug... I'm working on a Polymer 1 project.

The warning throws in the "rules": ["polymer-2-hybrid"] but not in "rules": ["polymer-1"]

Oh it appears my "empty" style issues are coming from importing style modules...

<dom-module id="new-element">
  <template>
    <style include="my-style-module"></style> <!-- i'm breaking lint -->
  </template>
</dom-module>

Somewhat amazingly it seems this bug can be worked-around by documenting the work-around ...

diff --git a/index.html b/index.html
index 9beb622..ce1795e 100644
--- a/index.html
+++ b/index.html
@@ -19,7 +19,7 @@
                <dom-bind>
                    <template>
                        <custom-style>
-                           <style include="demo-pages-shared-styles"></style>
+                           <style include="demo-pages-shared-styles"><!-- https://github.com/Polymer/tools/issues/408 --></style>
                        </custom-style>

                        <paper-bottom-sheet slide="{{sliding}}" modal="{{modalSheet}}" with-backdrop="[[withBackdrop]]" id="sheet">

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rwatts3 picture rwatts3  路  3Comments

pmaudsley picture pmaudsley  路  3Comments

ronnyroeller picture ronnyroeller  路  4Comments

justinfagnani picture justinfagnani  路  4Comments

NeoLegends picture NeoLegends  路  3Comments