Coder Social home page Coder Social logo

Indentation control error about tslint HOT 5 CLOSED

palantir avatar palantir commented on July 24, 2024
Indentation control error

from tslint.

Comments (5)

ashwinr avatar ashwinr commented on July 24, 2024

yeah, we've ourselves hit a few "nicely formatted" code causing errors. Do you actually find this rule useful in other cases? Wondering if we should just remove it altogether or not.

from tslint.

osimicek avatar osimicek commented on July 24, 2024

Thanks for fast response.
I think the indent control of function call parameters should be set off. It shouldn´t control format of inner arrays, dictionaries or funtion definitions.

I tried following construction and that works fine. The problem is only in function calls in the first post.

arr = [ "item1",
        "item2",
        "item3",
        (data) => {
            console.log(data);
        },
        {
            "key1": 1,
            "key2": 2
        }
    ];

dict = {"key1"  : 1,
        "key2"  : 2,
        "key3"  : 3,
        "funct" : (data) => {
                        console.log(data);
                    },
        "arr"   : [
                    "key1",
                    "key2"
                    ]
    };

from tslint.

ashwinr avatar ashwinr commented on July 24, 2024

fair enough, I can remove that. A case we hit in particular was when objects were nested within arrays like so (note the positioning of the opening brace on line 6). I'm going to account for that use-case as well.

var x = [
    {
        a: 1,
        b: 2,
        c: 3
    }, {
        b: 4,
        a: 2
    }
];

from tslint.

osimicek avatar osimicek commented on July 24, 2024

Sorry but I´m confused by your last post.
I only need in my code write function calls as follows:

registerController('baseCtrl',
                    BaseCtrl,
                    [
                        "$scope",
                        "$compile",
                        "$http",
                        "$routeParams"
                    ]);

from tslint.

ashwinr avatar ashwinr commented on July 24, 2024

Yeah, I know. The problem I think is that this rule is too restrictive sometimes, even with other code like the one I showed before. I'm going to take a look later, and see if we need to check for indentation at all for arrays and objects. It's probably easier to remove those checks altogether.

from tslint.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.