Skip to content

tools: enable no-unused-expressions lint rule - #36248

Closed
targos wants to merge 1 commit into
nodejs:masterfrom
targos:no-unused-expressions
Closed

tools: enable no-unused-expressions lint rule#36248
targos wants to merge 1 commit into
nodejs:masterfrom
targos:no-unused-expressions

Conversation

@targos

@targostargos commented Nov 24, 2020

Copy link
Copy Markdown
Member

Fixes: #36246

There are many places where I needed to disable the rule but I think it's still worth to have it. A few real mistakes are fixed thanks to it.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

@nodejs-github-botnodejs-github-bot added the lib / src Issues and PRs related to general changes in the lib or src directory. label Nov 24, 2020
Comment threadlib/internal/errors.js Outdated

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.

can this be wrapped inside a noop or would it significantly affect the benchmark?

+function noop() {+ return;+}
...
- nodeTiming.idleTime; // eslint-disable-line no-unused-expressions+ noop(nodeTiming.idleTime);

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

I think it's better to explicitly disable a rule when necessary instead of working around it.

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.

ok i agree - gives more eyeballs to scrutinize these weird pieces of code.
maybe adding a comment justifying naked-property-access could help catch more bugs in the pr (like whether they're actually needed or not)?

+ // benchmark getter() idleTime
nodeTiming.idleTime; // eslint-disable-line no-unused-expressions

@targos
targosforce-pushed the no-unused-expressions branch from a1a77c1 to 2a0e98eCompareDecember 6, 2020 15:34
@targostargos added the request-ci Add this label to start a Jenkins CI on a PR. label Dec 6, 2020
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Dec 6, 2020
@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

targos added a commit that referenced this pull request Dec 7, 2020
Fixes: #36246
PR-URL: #36248
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@targos

Copy link
Copy Markdown
MemberAuthor

Landed in bf31d3c

@targostargos closed this Dec 7, 2020
@targos
targos deleted the no-unused-expressions branch December 7, 2020 19:37
targos added a commit that referenced this pull request Dec 21, 2020
Fixes: #36246
PR-URL: #36248
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@targostargos mentioned this pull request Dec 22, 2020
targos added a commit that referenced this pull request May 16, 2021
Fixes: #36246
PR-URL: #36248
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@targostargos mentioned this pull request Jun 6, 2021
targos added a commit that referenced this pull request Jun 11, 2021
Fixes: #36246
PR-URL: #36248
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lib / srcIssues and PRs related to general changes in the lib or src directory.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

There is no linter warning for an async function that is not called

11 participants

@targos@nodejs-github-bot@kaizhu256@jasnell@Trott@lpinca@cjihrig@joyeecheung@aduh95@ZYSzys@whiteslack