Skip to content

feat: lint to enforce declaring struct fields #11760

@0xClandestine

Description

@0xClandestine

Component

Forge

Describe the feature you would like

Add a lint that enforces explicit field naming when initializing structs, improving code readability and maintainability by requiring named parameters instead of positional arguments.

struct Person {
    string name;
    uint256 age;
    address wallet;
}

function namedArgs() public {
    Person memory person = Person({
        name: "Alice",
        age: 25,
        wallet: 0x123...
    });
}

function positionalArgs() public {
    Person memory person = Person("Alice", 25, 0x123...);
}

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions