Skip to content

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

Open
@benjaminpjones

Description

@benjaminpjones

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"
    ],

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: incorrect converterRule converter with incomplete, incorrect, or invalid rule names and/or argumentsgood first issueGood for newcomers; welcome aboard!status: accepting prsPlease, send in a PR to resolve this! ✨

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions