question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Stage 4 syntaxes in core rules

See original GitHub issue

acorn, the base of espree, has supported async/await and trailing function commas: Acorn 4.0.0 espree is going to support those, coming soon: https://github.com/eslint/espree/issues/287

Then, I’m starting to modify core rules to support those. In my head, the following rules need some tweaks.

  • 1st
    • #7170 no-dupe-args … Duplicate names in non-simple parameters are illegal syntax. We need to fix our tests since Acorn has enhanced the check. (4 tests are failing now with Acorn 4.0.0)
    • #7170 no-redeclare … Duplicate names in exports are illegal syntax. We need to fix our tests since Acorn has enhanced the check. (2 tests are failing now with Acorn 4.0.0)
  • 2nd
    • #7176 arrow-parens … It has false positive/negative on async functions.
    • #7179 keyword-spacing … It has false positive/negative on async functions.
    • #7178 no-extra-parens … It should handle await expressions also by default.
    • #7175 no-unused-expressions … It should handle await expressions also by default.
    • #7173 prefer-arrow-callback … It has wrong autofix on async functions.
    • #7180 space-before-function-paren … It should handle async arrow functions (as anonymous function?). async(a) => a.
    • #7174 space-unary-ops … It should handle await expressions. It has handled yield expressions already.
  • 3rd
    • #7172 array-callback-return … I think should not warn async functions as callbacks. Promise.all(list.map(async x => { await doSomething(x) }) is legal usage.
    • #7181 comma-dangle … It should check functions also by opt-in.
    • #7182 generator-star-spacing … To make sure, it needs tests for async functions.

Changelog:

  • space-before-function-paren was added.
  • space-unary-ops was added.
  • Sorted by priority.
  • generator-star-spacing was added.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:8
  • Comments:15 (14 by maintainers)

github_iconTop GitHub Comments

3reactions
not-an-aardvarkcommented, Sep 16, 2016

I’ve been working on a few of the issues on this list; see #7172, #7173, #7174, #7175, #7176.

2reactions
mysticateacommented, Sep 10, 2016

Yes, async function foo() {} is valid. But we cannot remove the space between async and function, so keyword-spacing rule ignores it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Part 4. UN/EDIFACT Rules - Chapter 2.2 Syntax Rules | UNECE
SYNTAX LEVELS. This International Standard specifies syntax levels A and B whichare identical in all respects except for the character sets used. ...
Read more >
4 Syntax and basic data types
A CSS style sheet, for any level of CSS, consists of a list of statements (see the grammar above). There are two kinds...
Read more >
Syntax in the English Language: Definition, Examples, and 3 ...
4 Essential Rules of Syntax in the English Language · 1. A complete sentence requires a subject and a verb and expresses a...
Read more >
Skills for Early Reading: Syntax - Evidence Based Early Literacy
Syntax. Reading is the act of processing text in order to derive meaning. To learn to read, children must develop both fluent word...
Read more >
Rules for AWS IoT
Rules give your devices the ability to interact with AWS services. Rules are analyzed and actions are performed based on the MQTT topic...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found