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

Add no-typeof-undefined rule #1966

Merged
merged 14 commits into from Nov 20, 2022
Merged

Conversation

fisker
Copy link
Collaborator

@fisker fisker commented Nov 17, 2022

Fixes #1492

const tokenBefore = sourceCode.getTokenBefore(binaryExpression);
if (needsSemicolon(tokenBefore, sourceCode, secondToken.value)) {
yield fixer.insertTextBefore(binaryExpression, ';');
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Same as

const {test, parent} = node;
, but I'm not going to make a reusable function in this PR, will do later.

@fisker fisker marked this pull request as ready for review November 17, 2022 08:16
docs/rules/no-typeof-undefined.md Outdated Show resolved Hide resolved
docs/rules/no-typeof-undefined.md Outdated Show resolved Hide resolved
docs/rules/no-typeof-undefined.md Outdated Show resolved Hide resolved
rules/no-typeof-undefined.js Outdated Show resolved Hide resolved
fisker and others added 3 commits November 20, 2022 23:29
Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
@sindresorhus sindresorhus merged commit d7f7341 into sindresorhus:main Nov 20, 2022
@fisker fisker deleted the no-typeof-undefined branch November 20, 2022 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rule proposal: no-typeof-undefined
2 participants