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

Chore: remove unused code in max-lines-per-function #12659

Merged
merged 1 commit into from Dec 23, 2019
Merged

Chore: remove unused code in max-lines-per-function #12659

merged 1 commit into from Dec 23, 2019

Conversation

yeonjuan
Copy link
Member

@yeonjuan yeonjuan commented Dec 12, 2019

What is the purpose of this pull request? (put an "X" next to item)

[ ] Documentation update
[ ] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofixing to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ x ] Other, please explain:

What changes did you make? (Give an overview)

remove unused code in max-lines-per-function.

if (!comments) {
return map;
}

Because the return value from sourceCode.getAllComments() is always truthy, checking falsy is useless.

  • in other rules, they didn't check whether the return value is falsy or not.
    const comments = sourceCode.getAllComments();
    comments.filter(token => token.type === "Line").forEach(node => {
    if (applyDefaultIgnorePatterns && (defaultIgnoreRegExp.test(node.value) || fallThroughRegExp.test(node.value))) {
    return;

    const comments = sourceCode.getAllComments();
    comments.filter(token => token.type !== "Shebang").forEach(processComment);

Is there anything you'd like reviewers to focus on?

@eslint-deprecated eslint-deprecated bot added the triage An ESLint team member will look at this issue soon label Dec 12, 2019
@kaicataldo kaicataldo added accepted There is consensus among the team that this change meets the criteria for inclusion chore This change is not user-facing and removed triage An ESLint team member will look at this issue soon labels Dec 21, 2019
@kaicataldo kaicataldo merged commit 4744397 into eslint:master Dec 23, 2019
@kaicataldo
Copy link
Member

Thanks for contributing!

@yeonjuan yeonjuan deleted the refactor-max-line-per-func branch January 3, 2020 14:50
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Jun 22, 2020
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Jun 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion chore This change is not user-facing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants