Skip to content
New issue

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

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

Already on GitHub? # to your account

feat(eslint-plugin): accept the syntax currently allowed at Agoric #60

Merged
merged 4 commits into from
Aug 10, 2021

Conversation

michaelfig
Copy link
Member

The most major addition to the @jessie.js/eslint-plugin is to enable async functions and properly lint the use of await. The rules allow for:

  1. await expression statements at the top level of an async function (either the topmost block or the only expression, if an arrow function).
  2. SOMETHING = await somethingElse; statements at the function's topmost block or expression.
  3. no other use of await.

The other changes should be fairly self-explanatory. They were determined by examining the Jessica grammars for Jessie, driven by @dckc's Agoric/documentation#540.

@michaelfig michaelfig added the enhancement New feature or request label Aug 10, 2021
@michaelfig michaelfig self-assigned this Aug 10, 2021
Copy link
Contributor

@dckc dckc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, though I haven't tested it.

create(context) {
return {
AwaitExpression: node => {
// As a hint to future readers, I used the following ASTExplorer
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for leaving breadcrumbs :)

selector: `ArrowFunctionExpression[async=true]`,
message: `async functions are ${nono}`,
selector: `FunctionExpression[generator=true]`,
message: `generators are ${nono}`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have library function alternatives to generators?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In progress. It takes some explanation, though, so I'm not sure yet what to put in the linting failure.

@michaelfig michaelfig merged commit 9fe0ed8 into main Aug 10, 2021
@michaelfig michaelfig deleted the mfig-jessie-eslint branch August 10, 2021 18:11
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants