Skip to content

arrow-parens converter has incorrect behavior #346

Closed
@Zip753

Description

@Zip753

🐛 Bug Report

  • tslint-to-eslint-config version: 0.5.1
  • ESLint version: 6.8.0
  • Node version: 8.17.0

Actual Behavior

arrow-parens without any arguments is converted into arrow-parens with "as-needed" argument. Also, implementation compares first argument to "always", which isn't a possible value according to the rule: https://palantir.github.io/tslint/rules/arrow-parens/

Expected Behavior

arrow-parens without arguments should be converted into arrow-parens with "always" argument (or none, at it's the default), while arrow-parens with "ban-single-arg-parens" argument should be converted into arrow-parens with "as-needed" argument.

Reproduction

Try any example with arrow function which only has a single argument, for example:

const id = (a) => a;

If tsconfig.json has the following rule enabled

{
	"rules": {
		"arrow-parens": true
	}
}

then the code will pass TSLint. Then it will be converted to smth like

{
	"rules": {
		"arrow-parens": [
			"error",
			"as-needed"
		]
	}
}

which will fail ESLint, because "as-needed" will force you to drop the parentheses around the single argument.

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: accepting prsPlease, send in a PR to resolve this! ✨type: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions