-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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: remove conditional assignment in custom ESLint rule #41325
Conversation
This one is a bit cosmetic, so I should explain my eventual goal: I'd like to be able to enable ESLint's recommended rule set (disabling a few rules as necessary) and this file is flagged for the conditional assignment. I don't feel strongly that this version is a big improvement so if others don't see it that way, oh well, we can close it. But I don't think it makes the code worse either. |
@nodejs/linting |
555b6f5
to
596c45b
Compare
I think it's possible to silence the eslint error by wrapping the assignment in parentheses |
Yes, that is correct. I considered that, but |
@targos Do you have opinions as to which options are preferable and which should be avoided?
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Commit Queue failed- Loading data for nodejs/node/pull/41325 ✔ Done loading data for nodejs/node/pull/41325 ----------------------------------- PR info ------------------------------------ Title tools: remove conditional assignment in custom ESLint rule (#41325) Author Rich Trott (@Trott) Branch Trott:no-cond-assign -> nodejs:master Labels tools, author ready Commits 1 - tools: remove conditional assignment in custom ESLint rule Committers 1 - Rich Trott PR-URL: https://github.com/nodejs/node/pull/41325 Reviewed-By: Michaël Zasso ------------------------------ Generated metadata ------------------------------ PR-URL: https://github.com/nodejs/node/pull/41325 Reviewed-By: Michaël Zasso -------------------------------------------------------------------------------- ℹ This PR was created on Sun, 26 Dec 2021 03:55:17 GMT ✔ Approvals: 1 ✔ - Michaël Zasso (@targos) (TSC): https://github.com/nodejs/node/pull/41325#pullrequestreview-842514715 ✖ GitHub CI is still running ℹ Green GitHub CI is sufficient -------------------------------------------------------------------------------- ✔ Aborted `git node land` session in /home/runner/work/node/node/.ncuhttps://github.com/nodejs/node/actions/runs/1657795258 |
Commit Queue failed- Loading data for nodejs/node/pull/41325 ✔ Done loading data for nodejs/node/pull/41325 ----------------------------------- PR info ------------------------------------ Title tools: remove conditional assignment in custom ESLint rule (#41325) Author Rich Trott (@Trott) Branch Trott:no-cond-assign -> nodejs:master Labels tools, author ready Commits 1 - tools: remove conditional assignment in custom ESLint rule Committers 1 - Rich Trott PR-URL: https://github.com/nodejs/node/pull/41325 Reviewed-By: Michaël Zasso ------------------------------ Generated metadata ------------------------------ PR-URL: https://github.com/nodejs/node/pull/41325 Reviewed-By: Michaël Zasso -------------------------------------------------------------------------------- ℹ This PR was created on Sun, 26 Dec 2021 03:55:17 GMT ✔ Approvals: 1 ✔ - Michaël Zasso (@targos) (TSC): https://github.com/nodejs/node/pull/41325#pullrequestreview-842514715 ✖ GitHub CI is still running ℹ Green GitHub CI is sufficient -------------------------------------------------------------------------------- ✔ Aborted `git node land` session in /home/runner/work/node/node/.ncuhttps://github.com/nodejs/node/actions/runs/1658007831 |
These changes no-duplicate-require.js so that it doesn't use an assignment in a conditional, which can be easy to misread as a comparison rather than an assignment. It also means we change a do/while (which we don't use much in our code) to the much more common while construct. PR-URL: nodejs#41325 Reviewed-By: Michaël Zasso <targos@protonmail.com>
Landed in e7d4e6b |
These changes no-duplicate-require.js so that it doesn't use an assignment in a conditional, which can be easy to misread as a comparison rather than an assignment. It also means we change a do/while (which we don't use much in our code) to the much more common while construct. PR-URL: #41325 Reviewed-By: Michaël Zasso <targos@protonmail.com>
These changes no-duplicate-require.js so that it doesn't use an assignment in a conditional, which can be easy to misread as a comparison rather than an assignment. It also means we change a do/while (which we don't use much in our code) to the much more common while construct. PR-URL: #41325 Reviewed-By: Michaël Zasso <targos@protonmail.com>
These changes no-duplicate-require.js so that it doesn't use an assignment in a conditional, which can be easy to misread as a comparison rather than an assignment. It also means we change a do/while (which we don't use much in our code) to the much more common while construct. PR-URL: nodejs#41325 Reviewed-By: Michaël Zasso <targos@protonmail.com>
These changes no-duplicate-require.js so that it doesn't use an assignment in a conditional, which can be easy to misread as a comparison rather than an assignment. It also means we change a do/while (which we don't use much in our code) to the much more common while construct. PR-URL: #41325 Reviewed-By: Michaël Zasso <targos@protonmail.com>
These changes no-duplicate-require.js so that it doesn't use an
assignment in a conditional, which can be easy to misread as a
comparison rather than an assignment. It also means we change a do/while
(which we don't use much in our code) to the much more common while
construct.