Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cant lint angular template wrapped in Script tag #5

Open
achintverma opened this issue Sep 14, 2017 · 4 comments
Open

Cant lint angular template wrapped in Script tag #5

achintverma opened this issue Sep 14, 2017 · 4 comments

Comments

@achintverma
Copy link

achintverma commented Sep 14, 2017

It's not working with code like

<script type='ng-template'>
<h1>Heading Here</h1>
<a href='/about' title='About Us'>About</a>
</script>
@achintverma
Copy link
Author

When I tried with --ignore-tags 'script' option then it shows weird output

@jwarby
Copy link
Owner

jwarby commented Sep 15, 2017

Hi @achintverma, script tags are ignored anyway by default, but in your case you actually want it to process script tags. However, the output will not be correct because the HTML parser will treat the script's content as text, not HTML. This is the output I get if I run without ignoring any tags (--ignore-tags "") on your provided sample:


  /tmp/test.html
     2 | <h1>Heading Here</h1>
         ^ Hardcoded <script> tag
     3 | <a href='/about' title='About Us'>About</a>
         ^ Hardcoded <script> tag (continued)

Although it looks like it's kind of working from the above output, I think it will actually report a problem for any tags it sees inside the script block.

To fix this, you would have to make it parse the script contents as HTML and run the linter over it - if you'd like to have a go at creating a pull request for this, please feel free to :) It's unlikely I will have any time to look at this for a while. Thanks!

@achintverma
Copy link
Author

Thanks for the swift reply. I saw the similar output when I ignored script tags. Your explanation makes sense, can see why the output was like that. I'll Work on the solution and will submit PR in coming weeks. Thanks again!!

@jwarby
Copy link
Owner

jwarby commented Sep 15, 2017

@achintverma that would be awesome, thank you! 👍

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

No branches or pull requests

2 participants