Visitar URL original
Docs: add more examples for `no-sequences` rule by snitin315 · Pull Request #14578 · eslint/eslint · GitHub
Skip to content

Docs: add more examples for no-sequences rule - #14578

Merged
aladdin-add merged 1 commit into
eslint:masterfrom
snitin315:docs-no-seq
May 28, 2021
Merged

aladdin-add merged 1 commit into
eslint:masterfrom
snitin315:docs-no-seq

Conversation

@snitin315

Copy link
Copy Markdown
Contributor

Prerequisites checklist

What is the purpose of this pull request? (put an "X" next to an item)

[X] Documentation update
[ ] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofixing to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:

What changes did you make? (Give an overview)

Add more examples.

Fixes #14572

Is there anything you'd like reviewers to focus on?

Nope

@eslint-github-bot eslint-github-bot Bot added the triage An ESLint team member will look at this issue soon label May 8, 2021

@aladdin-add aladdin-add left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks!

@aladdin-add aladdin-add added accepted There is consensus among the team that this change meets the criteria for inclusion documentation Relates to ESLint's documentation rule Relates to ESLint's core rules enhancement This change enhances an existing feature of ESLint and removed triage An ESLint team member will look at this issue soon labels May 12, 2021

@mdjermanovic mdjermanovic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The added examples LGTM, but since we already had a similar example with arrow function (right above the new examples) I think the idea in #14572 (comment) was to add a note. @nzakas ?

@nzakas

nzakas commented May 18, 2021

Copy link
Copy Markdown
Member

Yes, I think we should add a note that explicitly states this exception case as it’s different from anywhere else in the rule.

@nzakas

nzakas commented May 22, 2021

Copy link
Copy Markdown
Member

@snitin315 are you still working on this?

@snitin315

Copy link
Copy Markdown
Contributor Author

Yes, thanks for the ping. I will push an update today.

@snitin315

Copy link
Copy Markdown
Contributor Author

Done ✅

@nzakas nzakas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I was more thinking we should have a specific paragraph in the page saying something like:

Note about arrow function bodies

If an arrow function body is a statement rather than a block, and that statement contains a sequence, you need to use double parentheses around the statement to indicate that the sequence is intentional.

(include examples here)

@nzakas nzakas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Exactly what I was looking for. Thank you!

@aladdin-add
aladdin-add merged commit 958ff4e into eslint:master May 28, 2021
/*eslint no-sequences: "error"*/
const foo = (val) => (console.log('bar'), val);

const foo = () => ((bar = 123), 10));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

These is an extra ) in this example.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch, thanks. I will send a fix.

@snitin315
snitin315 deleted the docs-no-seq branch May 31, 2021 02:18
@snitin315 snitin315 mentioned this pull request May 31, 2021
1 task done
@eslint-github-bot eslint-github-bot Bot locked and limited conversation to collaborators Nov 25, 2021
@eslint-github-bot eslint-github-bot Bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Nov 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion documentation Relates to ESLint's documentation enhancement This change enhances an existing feature of ESLint rule Relates to ESLint's core rules

Projects

None yet

Development

Successfully merging this pull request may close these issues.

no-sequences doesn't work correctly with assignment in arrow function expression

5 participants