google / closure-linter

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

Parse error related to Arrow function #106

Closed tomykaira closed 7 years ago

tomykaira commented 7 years ago

The following is valid ES6 code, but gjslint reports parse error. Could you fix this problem?

----- FILE  :  /Users/me/gcc_test/lint_error.js -----
Line 5, E:-002: Error parsing file at token "<JavaScriptToken: 5, }, "}", {}, MetaData(None)>". Unable to check the rest of file.
Error "None"
Found 1 error, including 0 new errors, in 1 file (0 files OK).
class Foo {
  bar() {
    let c = () => { console.log('foo'); };
    c();
  }
}
new Foo().bar();
rumpeltux commented 7 years ago

The closure linter should work well for ES5 code. Unfortunately ES6 is not supported and we have no plans to do so. For ES6 code, you can use the closure compiler with the --jscomp_warnings=lintChecks flag. See also https://developers.google.com/closure/utilities/