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: improve valid-typeof lint rule #37924

Merged
merged 0 commits into from
Mar 28, 2021
Merged

tools: improve valid-typeof lint rule #37924

merged 0 commits into from
Mar 28, 2021

Conversation

Trott
Copy link
Member

@Trott Trott commented Mar 26, 2021

Require that typeof comparisons be to string literals.

Fix an instance in a test where it was mistakenly being compared to undefined rather than 'undefined'.

@nodejs-github-bot nodejs-github-bot added encoding Issues and PRs related to the TextEncoder and TextDecoder APIs. needs-ci PRs that need a full CI run. tools Issues and PRs related to the tools directory. labels Mar 26, 2021
@nodejs-github-bot
Copy link
Collaborator

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.

+1, although it seems to have broken the assert.CallTracker test.

@Trott
Copy link
Member Author

Trott commented Mar 26, 2021

+1, although it seems to have broken the assert.CallTracker test.

Ha! The test was written wrong, but it "worked" because it made two errors that canceled each other out. It should be exiting if it's not undefined. Will rewrite using assert.strictEqual() so things are more clear.

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

Trott added a commit to Trott/io.js that referenced this pull request Mar 28, 2021
The typeof operator returns a string. Compare to the string 'undefined'
and not the value undefined.

PR-URL: nodejs#37924
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@Trott Trott closed this Mar 28, 2021
@Trott Trott merged commit adcd60e into nodejs:master Mar 28, 2021
@Trott
Copy link
Member Author

Trott commented Mar 28, 2021

Landed in db7df59...adcd60e

@Trott Trott deleted the valid-typeof branch March 28, 2021 15:02
ruyadorno pushed a commit that referenced this pull request Mar 29, 2021
The typeof operator returns a string. Compare to the string 'undefined'
and not the value undefined.

PR-URL: #37924
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
ruyadorno pushed a commit that referenced this pull request Mar 29, 2021
Require that `typeof` comparisons be to string literals.

PR-URL: #37924
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
ruyadorno pushed a commit that referenced this pull request Mar 30, 2021
The typeof operator returns a string. Compare to the string 'undefined'
and not the value undefined.

PR-URL: #37924
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
ruyadorno pushed a commit that referenced this pull request Mar 30, 2021
Require that `typeof` comparisons be to string literals.

PR-URL: #37924
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@ruyadorno ruyadorno mentioned this pull request Mar 30, 2021
targos pushed a commit that referenced this pull request May 1, 2021
The typeof operator returns a string. Compare to the string 'undefined'
and not the value undefined.

PR-URL: #37924
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
targos pushed a commit that referenced this pull request May 1, 2021
Require that `typeof` comparisons be to string literals.

PR-URL: #37924
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@danielleadams danielleadams mentioned this pull request May 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
encoding Issues and PRs related to the TextEncoder and TextDecoder APIs. needs-ci PRs that need a full CI run. tools Issues and PRs related to the tools directory.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants