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

Fix: one-var autofixing for export (fixes #13834) #13891

Merged
merged 2 commits into from Dec 5, 2020

Conversation

@anikethsaha
Copy link
Member

@anikethsaha anikethsaha commented Nov 29, 2020

Prerequisites checklist

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

[ ] Documentation update
[X] 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
[ ] Other, please explain:

What changes did you make? (Give an overview)

fixes #13834
Added a check for export statement and adding a export accordingly

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

N/A

Copy link
Member

@mdjermanovic mdjermanovic left a comment

The changes look good!

There is also the case of adjacent tokens, where the same should be done:

eslint/lib/rules/one-var.js

Lines 321 to 323 in e460346

if (afterComma.range[0] === tokenAfterDeclarator.range[1]) {
return fixer.replaceText(tokenAfterDeclarator, `; ${declaration.kind} `);
}

/* eslint one-var: ["error", "never"] */

export const foo = 1,bar = 2;

Loading

@anikethsaha anikethsaha requested a review from mdjermanovic Nov 30, 2020
@anikethsaha
Copy link
Member Author

@anikethsaha anikethsaha commented Nov 30, 2020

Thanks for pointing @mdjermanovic

Loading

Copy link
Member

@mdjermanovic mdjermanovic left a comment

LGTM, thanks!

Loading

btmills
btmills approved these changes Dec 5, 2020
Copy link
Member

@btmills btmills left a comment

LGTM. Thanks for fixing this @anikethsaha!

Loading

@btmills btmills merged commit cbc57fb into eslint:master Dec 5, 2020
13 checks passed
Loading
@eslint-github-bot eslint-github-bot bot locked and limited conversation to collaborators Jun 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

3 participants