New issue
Advanced search Search tips

Issue 912999 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Dec 8
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug



Sign in to add a comment

Issue report for ESLint (parsing error when encountering async)

Project Member Reported by benjhayden@google.com, Dec 7

Issue description

https://tricium-dev.appspot.com/run/5639486859902976

Parsing error: Unexpected token onClick_
To disable, add: // eslint-disable-line

The line in question is an async method:
async onClick_() {

Two issues:
1. Eslint should support ES9 features that are supported by Chrome such as async/await. This might help: "parserOptions": {"ecmaVersion": 2018,}
2. "eslint-disable-line" does not ignore parsing errors. Maybe replace the "To disable" message with a message about how to configure parserOptions for parsing errors?

 
Cc: -qyears...@chromium.org
Labels: -Pri-3 Pri-2
Owner: qyears...@chromium.org
Status: Started (was: Untriaged)
Summary: Issue report for ESLint (parsing error when encountering async) (was: Issue report for ESLint/error/)
Thanks for reporting, good suggestions.

1. Setting ecmaVersion in parserOptions does seem like what we want :-)

2. Currently the eslint parser doesn't read local eslintrc files in the repo being analyzed, it only uses a default eslintrc file (at https://cs.chromium.org/chromium/infra/go/src/infra/tricium/functions/eslint/.eslintrc.json) - so the "to disable" message is clearly not useful in this case, but in the case of parsing errors right now, probably the best thing to do is to just file a bug like this.

CL: https://chromium-review.googlesource.com/c/infra/infra/+/1368000
Project Member

Comment 2 by bugdroid1@chromium.org, Dec 7

The following revision refers to this bug:
  https://chromium.googlesource.com/infra/infra/+/95f8844c37469059e9efb3e484d6bdb214cacf83

commit 95f8844c37469059e9efb3e484d6bdb214cacf83
Author: Quinten Yearsley <qyearsley@chromium.org>
Date: Fri Dec 07 23:31:47 2018

[tricium eslint] Add parser option to support async; adjust message text

In this CL:
 - Stop adding "To disable" message if there's no rule name
 - Add ecmaVersion 2018 to parser options in the default rcfile
 - Add something to the example file to verify that async is okay
 - Minor refactoring/comment change

Bug:  912999 
Change-Id: I6b5c109526d5aa2efdf51f4cae88b87414970845
Reviewed-on: https://chromium-review.googlesource.com/c/1368000
Reviewed-by: Marc-Antoine Ruel <maruel@chromium.org>
Commit-Queue: Quinten Yearsley <qyearsley@chromium.org>
Cr-Commit-Position: refs/heads/master@{#19431}
[modify] https://crrev.com/95f8844c37469059e9efb3e484d6bdb214cacf83/go/src/infra/tricium/functions/eslint/eslint_parser_test.go
[modify] https://crrev.com/95f8844c37469059e9efb3e484d6bdb214cacf83/go/src/infra/tricium/functions/eslint/test/example.js
[modify] https://crrev.com/95f8844c37469059e9efb3e484d6bdb214cacf83/go/src/infra/tricium/functions/eslint/eslint_parser.go
[modify] https://crrev.com/95f8844c37469059e9efb3e484d6bdb214cacf83/go/src/infra/tricium/functions/eslint/.eslintrc.json

Status: Fixed (was: Started)

Sign in to add a comment