typescript-eslint / tslint-to-eslint-config

Converts your TSLint configuration to the closest possible ESLint equivalent. 🚀

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

benjaminpjones opened this issue · comments

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