Skip to content

tools: enable no-empty ESLint rule#41831

Closed
Trott wants to merge 8 commits intonodejs:masterfrom
Trott:no-empty
Closed

tools: enable no-empty ESLint rule#41831
Trott wants to merge 8 commits intonodejs:masterfrom
Trott:no-empty

Conversation

@Trott
Copy link
Member

@Trott Trott commented Feb 3, 2022

@Trott Trott added request-ci Add this label to start a Jenkins CI on a PR. commit-queue-rebase Add this label to allow the Commit Queue to land a PR in several commits. labels Feb 3, 2022
@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/modules
  • @nodejs/startup

@nodejs-github-bot nodejs-github-bot added lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels Feb 3, 2022
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Feb 3, 2022
@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@GeoffreyBooth
Copy link
Member

What's the motivation for this change? It seems fine; is the goal to gradually align with the recommended rules?

@nodejs-github-bot

This comment was marked as outdated.

@Trott
Copy link
Member Author

Trott commented Feb 3, 2022

What's the motivation for this change? It seems fine; is the goal to gradually align with the recommended rules?

Yes. We have only two rules from the recommended set disabled, and they both seem like things we minimally-can-and-likely-should accommodate.

Copy link
Contributor

@aduh95 aduh95 left a comment

Choose a reason for hiding this comment

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

I'm not sure about this rule, there are a lot of examples in this PR that shows how empty blocks are sometimes useful. To be clear I'm not blocking.

@Trott
Copy link
Member Author

Trott commented Feb 3, 2022

I'm not sure about this rule, there are a lot of examples in this PR that shows how empty blocks are sometimes useful. To be clear I'm not blocking.

Depending how many examples there are, maybe a disable comment for the useful ones would be good?

@aduh95
Copy link
Contributor

aduh95 commented Feb 3, 2022

I'm not sure about this rule, there are a lot of examples in this PR that shows how empty blocks are sometimes useful. To be clear I'm not blocking.

Depending how many examples there are, maybe a disable comment for the useful ones would be good?

Sure that sounds good. Let me know if you need help, I can contribute.

@tniessen
Copy link
Member

tniessen commented Feb 3, 2022

Is there a reason to keep empty loop blocks at all? This PR adds a lot of blocks of the form

while (foo()) {
  // empty
}

I think what I'd prefer is:

while (foo());

@Trott
Copy link
Member Author

Trott commented Feb 4, 2022

Is there a reason to keep empty loop blocks at all? This PR adds a lot of blocks of the form

while (foo()) {
  // empty
}

I think what I'd prefer is:

while (foo());

Whoa, yes, that seems to work.

@Trott Trott force-pushed the no-empty branch 2 times, most recently from 29a1717 to 2416923 Compare February 4, 2022 03:02
@Trott Trott added the request-ci Add this label to start a Jenkins CI on a PR. label Feb 4, 2022
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Feb 4, 2022
@nodejs-github-bot
Copy link
Collaborator

Copy link
Member

@tniessen tniessen left a comment

Choose a reason for hiding this comment

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

LGTM with the changed loop style.

Copy link
Contributor

@aduh95 aduh95 left a comment

Choose a reason for hiding this comment

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

LGTM modulo a few indentation nits.

Trott added a commit to Trott/io.js that referenced this pull request Mar 1, 2022
PR-URL: nodejs#41831
Refs: https://eslint.org/docs/rules/no-empty
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Trott added a commit to Trott/io.js that referenced this pull request Mar 1, 2022
PR-URL: nodejs#41831
Refs: https://eslint.org/docs/rules/no-empty
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Trott added a commit to Trott/io.js that referenced this pull request Mar 1, 2022
PR-URL: nodejs#41831
Refs: https://eslint.org/docs/rules/no-empty
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Trott added a commit to Trott/io.js that referenced this pull request Mar 1, 2022
PR-URL: nodejs#41831
Refs: https://eslint.org/docs/rules/no-empty
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Trott added a commit to Trott/io.js that referenced this pull request Mar 1, 2022
Refs: https://eslint.org/docs/rules/no-empty

PR-URL: nodejs#41831
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
@Trott
Copy link
Member Author

Trott commented Mar 1, 2022

@danielleadams Backport: #42160

Trott added a commit to Trott/io.js that referenced this pull request Mar 2, 2022
PR-URL: nodejs#41831
Refs: https://eslint.org/docs/rules/no-empty
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Trott added a commit to Trott/io.js that referenced this pull request Mar 2, 2022
PR-URL: nodejs#41831
Refs: https://eslint.org/docs/rules/no-empty
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Trott added a commit to Trott/io.js that referenced this pull request Mar 2, 2022
PR-URL: nodejs#41831
Refs: https://eslint.org/docs/rules/no-empty
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Trott added a commit to Trott/io.js that referenced this pull request Mar 2, 2022
PR-URL: nodejs#41831
Refs: https://eslint.org/docs/rules/no-empty
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Trott added a commit to Trott/io.js that referenced this pull request Mar 2, 2022
PR-URL: nodejs#41831
Refs: https://eslint.org/docs/rules/no-empty
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Trott added a commit to Trott/io.js that referenced this pull request Mar 2, 2022
PR-URL: nodejs#41831
Refs: https://eslint.org/docs/rules/no-empty
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Trott added a commit to Trott/io.js that referenced this pull request Mar 2, 2022
PR-URL: nodejs#41831
Refs: https://eslint.org/docs/rules/no-empty
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Trott added a commit to Trott/io.js that referenced this pull request Mar 2, 2022
Refs: https://eslint.org/docs/rules/no-empty

PR-URL: nodejs#41831
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Trott added a commit to Trott/io.js that referenced this pull request Mar 2, 2022
PR-URL: nodejs#41831
Refs: https://eslint.org/docs/rules/no-empty
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Trott added a commit to Trott/io.js that referenced this pull request Mar 2, 2022
Refs: https://eslint.org/docs/rules/no-empty

PR-URL: nodejs#41831
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
danielleadams pushed a commit that referenced this pull request Mar 3, 2022
PR-URL: #41831
Backport-PR-URL: #42160
Refs: https://eslint.org/docs/rules/no-empty
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
danielleadams pushed a commit that referenced this pull request Mar 3, 2022
PR-URL: #41831
Backport-PR-URL: #42160
Refs: https://eslint.org/docs/rules/no-empty
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
danielleadams pushed a commit that referenced this pull request Mar 3, 2022
PR-URL: #41831
Backport-PR-URL: #42160
Refs: https://eslint.org/docs/rules/no-empty
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
danielleadams pushed a commit that referenced this pull request Mar 3, 2022
PR-URL: #41831
Backport-PR-URL: #42160
Refs: https://eslint.org/docs/rules/no-empty
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
danielleadams pushed a commit that referenced this pull request Mar 3, 2022
PR-URL: #41831
Backport-PR-URL: #42160
Refs: https://eslint.org/docs/rules/no-empty
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
danielleadams pushed a commit that referenced this pull request Mar 3, 2022
PR-URL: #41831
Backport-PR-URL: #42160
Refs: https://eslint.org/docs/rules/no-empty
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
danielleadams pushed a commit that referenced this pull request Mar 3, 2022
PR-URL: #41831
Backport-PR-URL: #42160
Refs: https://eslint.org/docs/rules/no-empty
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
danielleadams pushed a commit that referenced this pull request Mar 3, 2022
Refs: https://eslint.org/docs/rules/no-empty

PR-URL: #41831
Backport-PR-URL: #42160
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
danielleadams pushed a commit that referenced this pull request Mar 3, 2022
PR-URL: #41831
Backport-PR-URL: #42160
Refs: https://eslint.org/docs/rules/no-empty
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
danielleadams pushed a commit that referenced this pull request Mar 3, 2022
PR-URL: #41831
Backport-PR-URL: #42160
Refs: https://eslint.org/docs/rules/no-empty
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
danielleadams pushed a commit that referenced this pull request Mar 3, 2022
PR-URL: #41831
Backport-PR-URL: #42160
Refs: https://eslint.org/docs/rules/no-empty
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commit-queue-rebase Add this label to allow the Commit Queue to land a PR in several commits. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants