google / closure-linter

Automatically exported from code.google.com/p/closure-linter
Apache License 2.0
109 stars 37 forks source link

Added recognition of template strings. #104

Closed yarrouye closed 7 years ago

yarrouye commented 7 years ago

Hi,

As I was working on some changes in Chromium, I kept being tripped by the presubmit complaining about a missing semicolon at the end of line in a template string.

Chromium uses gjslint, so I thought I would give a try at adding recognition of these strings so that the Chromium presubmits eventually stop complaining about valid code. This is my attempt at doing so.

Cheers, YA

rumpeltux commented 7 years ago

Cool, thanks for working on this. Could you also add a few test-cases please?

yarrouye commented 7 years ago

I had a quick look re: tests, and:

  1. I have no idea how to run tests, so I can use some help there.
  2. It seems like all the test cases are "we can lint this is an issue." My patch removes false positives, I am not sure that you have anything setup to test that? (Of course, it was a quick look, so I may have missed that.)

Let me know how to run tests and I can see what I can do.

rumpeltux commented 7 years ago

You can run a test e.g. as follows:

python -m closure_linter.full_test

(I just saw that the jsdoc test is failing :/ so never mind this one) Probably adding an example template string in closure_linter/testdata/tokenizer.js is enough. The test should fail without your patch and pass with yours.

Thanks!

yarrouye commented 7 years ago

Alright, test added as a regression test.

rumpeltux commented 7 years ago

Thanks again, much appreciated!

yarrouye commented 7 years ago

Anytime, especially if it gets in the way of me submitting code in Chromium :).