# dot-notation

Prefer dot notation for statically named member access

A string-literal key is static, so bracket notation presents it as computed member access.
Instead, you SHOULD use dot notation for that member access.

- Category: style
- Level: warning
- Fix: automatic
- Scope: module

## Reported

```ds title="main.ds"
function name(user: { name: string }): string {
    return user["name"];
}
```

## Accepted

```ds title="main.ds"
function name(user: { name: string }): string {
    return user.name;
}
```

## Prior art

- [ESLint · dot-notation](https://eslint.org/docs/latest/rules/dot-notation)
- [typescript-eslint · dot-notation](https://typescript-eslint.io/rules/dot-notation)

[language/linter/src/rules/style/dot_notation.rs:8](https://github.com/destack-sh/destack/blob/main/language/linter/src/rules/style/dot_notation.rs#L8)
