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

set allowSingleLine to true for one-line->brace-style conversion #1226

Open
benjaminpjones opened this issue Sep 22, 2021 · 0 comments
Open
Labels
area: incorrect converter Rule converter with incomplete, incorrect, or invalid rule names and/or arguments good first issue Good for newcomers; welcome aboard! status: accepting prs Please, send in a PR to resolve this! ✨

Comments

@benjaminpjones
Copy link

benjaminpjones commented Sep 22, 2021

Overview

TSLint's one-line is more narrow in scope than ESLint's brace-style in the sense that ESLint will error on single line blocks by default.

Example code that errors under brace-style but not one-line

del(this.del_url, obj.id)
    .then(this.refresh)
    .catch((e) => { this.refresh(); errorAlerter(e); });

Actual Behavior

A one-line TSLint rule generates the following eslint rule:

"brace-style": [
    "error",
    "1tbs"
],

Expected Behavior

Given that one-line does not care about single line blocks, I'd expect it to output this ESLint rule:

"brace-style": [
    "error",
    "1tbs",
    { "allowSingleLine" : true }
],

Reproduce

Here is the TSLint rule I was working with:

    "one-line": [
        true,
        "check-catch",
        "check-finally",
        "check-open-brace",
        "check-whitespace"
    ],
@JoshuaKGoldberg JoshuaKGoldberg added area: incorrect converter Rule converter with incomplete, incorrect, or invalid rule names and/or arguments good first issue Good for newcomers; welcome aboard! status: accepting prs Please, send in a PR to resolve this! ✨ labels Oct 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: incorrect converter Rule converter with incomplete, incorrect, or invalid rule names and/or arguments good first issue Good for newcomers; welcome aboard! status: accepting prs Please, send in a PR to resolve this! ✨
Projects
None yet
Development

No branches or pull requests

2 participants