Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

tools: enable no-empty ESLint rule #41831

Closed
wants to merge 8 commits into from
Closed

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.

benchmark/es/foreach-bench.js Outdated Show resolved Hide resolved
benchmark/fs/bench-statSync-failure.js Outdated Show resolved Hide resolved
test/node-api/test_fatal/test_threads.js Outdated Show resolved Hide resolved
@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());

doc/api/worker_threads.md Outdated Show resolved Hide resolved
lib/events.js Outdated Show resolved Hide resolved
@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.

test/pummel/test-policy-integrity-parent-module.js Outdated Show resolved Hide resolved
test/pummel/test-policy-integrity-worker-commonjs.js Outdated Show resolved Hide resolved
test/pummel/test-policy-integrity-worker-module.js Outdated Show resolved Hide resolved
test/parallel/test-fs-realpath.js Outdated Show resolved Hide resolved
test/parallel/test-fs-realpath.js Outdated Show resolved Hide resolved
test/parallel/test-fs-realpath.js Outdated Show resolved Hide resolved
test/parallel/test-fs-realpath.js Outdated Show resolved Hide resolved
test/parallel/test-file-write-stream2.js Outdated Show resolved Hide resolved
danielleadams pushed a commit to danielleadams/node that referenced this pull request Mar 4, 2022
PR-URL: nodejs#41831
Backport-PR-URL: nodejs#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 to danielleadams/node that referenced this pull request Mar 4, 2022
PR-URL: nodejs#41831
Backport-PR-URL: nodejs#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 to danielleadams/node that referenced this pull request Mar 4, 2022
PR-URL: nodejs#41831
Backport-PR-URL: nodejs#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 to danielleadams/node that referenced this pull request Mar 4, 2022
PR-URL: nodejs#41831
Backport-PR-URL: nodejs#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 to danielleadams/node that referenced this pull request Mar 4, 2022
PR-URL: nodejs#41831
Backport-PR-URL: nodejs#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 to danielleadams/node that referenced this pull request Mar 4, 2022
PR-URL: nodejs#41831
Backport-PR-URL: nodejs#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 to danielleadams/node that referenced this pull request Mar 4, 2022
Refs: https://eslint.org/docs/rules/no-empty

PR-URL: nodejs#41831
Backport-PR-URL: nodejs#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 8, 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 8, 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 8, 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 8, 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 8, 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 8, 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 8, 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 8, 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 14, 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 14, 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 14, 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 14, 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 14, 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 14, 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 14, 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 14, 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>
codebytere added a commit to electron/electron that referenced this pull request Mar 16, 2022
codebytere added a commit to electron/electron that referenced this pull request Mar 17, 2022
jkleinsc pushed a commit to electron/electron that referenced this pull request Mar 23, 2022
* chore: bump node in DEPS to v16.14.0

* src: add flags for controlling process behavior

nodejs/node#40339

* src: add x509.fingerprint512 to crypto module

nodejs/node#39809

* deps: upgrade to libuv 1.43.0

nodejs/node#41398

* chore: fixup patch indices

* chore: add missing filenames

nodejs/node#39283
nodejs/node#40665

* crypto: trim input for NETSCAPE_SPKI_b64_decode

nodejs/node#40757

* chore: update patches

* chore: bump node in DEPS to v16.14.1

* tools: enable no-empty ESLint rule

nodejs/node#41831

* chore: update patches

* chore: update patches

* chore: bump node in DEPS to v16.14.2

* chore: update patches

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
bavulapati pushed a commit to bavulapati/electron that referenced this pull request Apr 29, 2022
* chore: bump node in DEPS to v16.14.0

* src: add flags for controlling process behavior

nodejs/node#40339

* src: add x509.fingerprint512 to crypto module

nodejs/node#39809

* deps: upgrade to libuv 1.43.0

nodejs/node#41398

* chore: fixup patch indices

* chore: add missing filenames

nodejs/node#39283
nodejs/node#40665

* crypto: trim input for NETSCAPE_SPKI_b64_decode

nodejs/node#40757

* chore: update patches

* chore: bump node in DEPS to v16.14.1

* tools: enable no-empty ESLint rule

nodejs/node#41831

* chore: update patches

* chore: update patches

* chore: bump node in DEPS to v16.14.2

* chore: update patches

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
khalwa pushed a commit to solarwindscloud/electron that referenced this pull request Feb 22, 2023
* chore: bump node in DEPS to v16.14.0

* src: add flags for controlling process behavior

nodejs/node#40339

* src: add x509.fingerprint512 to crypto module

nodejs/node#39809

* deps: upgrade to libuv 1.43.0

nodejs/node#41398

* chore: fixup patch indices

* chore: add missing filenames

nodejs/node#39283
nodejs/node#40665

* crypto: trim input for NETSCAPE_SPKI_b64_decode

nodejs/node#40757

* chore: update patches

* chore: bump node in DEPS to v16.14.1

* tools: enable no-empty ESLint rule

nodejs/node#41831

* chore: update patches

* chore: update patches

* chore: bump node in DEPS to v16.14.2

* chore: update patches

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.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.

None yet

8 participants