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

no-unused-var rule creates invalid code (2) #57

Open
laurent22 opened this issue Jul 29, 2019 · 3 comments
Open

no-unused-var rule creates invalid code (2) #57

laurent22 opened this issue Jul 29, 2019 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@laurent22
Copy link

Tell us about your environment

  • eslint version: 6.1.0
  • eslint-plugin-autofix version: 0.0.8
  • eslint config:

It changes this:

sqliteErrorToJsError(error, sql = null, params = null) {
	return error;
}

to this:

sqliteErrorToJsError(error, , ) {
	return error;
}
@laurent22 laurent22 added the bug Something isn't working label Jul 29, 2019
@Nantris
Copy link

Nantris commented May 27, 2021

Also creates invalid code like:

From:

const someFunc = debounce(arg => {...})

To:

const someFunc = debounce( => {...})

Should change to:

const someFunc = debounce(() => {...})

@Nantris
Copy link

Nantris commented May 27, 2021

Also the super mysterious case of a used var being left alone, but needlessly having the comma afterward removed.

From:

const { x, y, width, height } = this.state;
const newX = parseInt((x / prevWindow.width) * winWidth);

To:

const { x y, width, height } = this.state;
const newX = parseInt((x / prevWindow.width) * winWidth);

Edit: Actually, this happens a lot... Doesn't seem to handle destructuring assignments whatsoever.

@Nantris
Copy link

Nantris commented May 28, 2021

There are a lot more edge cases too... like at least 4 more issues. They all seem to be variations on what is perhaps the same underlying bug in the rule's logic though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants