Skip to content

Make path-style "as-needed" parameters not warn for strings with dots or brackets #199

@itamarki

Description

@itamarki

Hi,

Thank you for this great plugin.

Configuration:
"lodash/path-style": ["error", "as-needed"]

consider the following code:

const obj = {
    a: {
        "b.c": {
            d: 3
        }
    }
};

_.get(obj, ['a', 'b.c', 'd']); // -> 3

The rule will mark it as error and suggest to use a string for paths, but
_.get(obj, 'a.b.c.d');
Is not equivalent code and will not work.

My suggestion is that "as-needed" configuration will not warn if the strings in the array contain dots or square brackets.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions