# confusing-alias

**Summary**: Confusing alias of existing import

**Category**: Imports

**Avoid**

```
package policy# both 'users' and 'employees' point to the same imported resourceimport data.resources.usersimport data.resources.users as employees
```

**Prefer**

```
package policy# a single import for any given resourceimport data.resources.users
```

**or**

```
package policy# a single aliased import for any given resourceimport data.resources.users as employees
```

## Rationale

Using an alias for an import occasionally helps improve intent and readability by using a name that's relevant to the context in which the import is used. But an aliased import should never be used for a reference also imported **without** an alias, as that's just confusing. Either use and alias or don't, but stick to one convention for any given import.

Using two different aliases for the same import is also likely a mistake, and is similarly flagged by this rule.

## Configuration Options

This linter rule provides the following configuration options:

```
rules:  imports:    confusing-alias:      # one of "error", "warning", "ignore"      level: error
```

## Related Resources

*   GitHub: [Source Code](https://github.com/open-policy-agent/regal/blob/main/bundle/regal/rules/imports/confusing-alias/confusing_alias.rego)