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-redundant-flow fix ("remove flow") results in parser error due to trailing comma #222

Closed
OliverJAsh opened this issue Dec 8, 2021 · 0 comments · Fixed by #224
Closed

Comments

@OliverJAsh
Copy link
Contributor

OliverJAsh commented Dec 8, 2021

Given:

flow(
  fn,
);

When I run the fix for no-redundant-flow ("remove flow") I get this:

  fn,
;

The trailing comma is a parsing error.

I think the code for the fix could be improved to manipulate the AST rather than characters: pull out the parameter AST node from the call expression AST node.

fix(fixer) {
return [
fixer.removeRange([
node.callee.range[0],
node.callee.range[1] + 1,
]),
fixer.removeRange([node.range[1] - 1, node.range[1]]),
];
},

@OliverJAsh OliverJAsh changed the title no-redundant-flow fix ("remove flow") may result in syntax/parser error no-redundant-flow fix ("remove flow") results in parser error due to trailing comma Dec 11, 2021
OliverJAsh added a commit to OliverJAsh/eslint-plugin-fp-ts that referenced this issue Dec 11, 2021
OliverJAsh added a commit to OliverJAsh/eslint-plugin-fp-ts that referenced this issue Dec 11, 2021
OliverJAsh added a commit to OliverJAsh/eslint-plugin-fp-ts that referenced this issue Dec 11, 2021
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 a pull request may close this issue.

1 participant