Urara-Blog/node_modules/.pnpm-store/v3/files/f1/6abb8a3e5cf93430970ef8024d4ebf25bc9a256dd82e981c28e0c81a1280dd8914190f6d389da75157c175b7bf07d0e0d23b8ef1e77d36ea1ce0774f20f347
2022-08-14 01:14:53 +08:00

98 lines
1.3 KiB
Text

---
description: 'Disallow unnecessary namespace qualifiers.'
---
> 🛑 This file is source code, not the primary documentation location! 🛑
>
> See **https://typescript-eslint.io/rules/no-unnecessary-qualifier** for documentation.
## Rule Details
This rule aims to let users know when a namespace or enum qualifier is unnecessary,
whether used for a type or for a value.
Examples of code for this rule:
<!--tabs-->
### ❌ Incorrect
```ts
namespace A {
export type B = number;
const x: A.B = 3;
}
```
```ts
namespace A {
export const x = 3;
export const y = A.x;
}
```
```ts
enum A {
B,
C = A.B,
}
```
```ts
namespace A {
export namespace B {
export type T = number;
const x: A.B.T = 3;
}
}
```
### ✅ Correct
```ts
namespace X {
export type T = number;
}
namespace Y {
export const x: X.T = 3;
}
```
```ts
enum A {
X,
Y,
}
enum B {
Z = A.X,
}
```
```ts
namespace X {
export type T = number;
namespace Y {
type T = string;
const x: X.T = 0;
}
}
```
## Options
```jsonc
// .eslintrc.json
{
"rules": {
"@typescript-eslint/no-unnecessary-qualifier": "warn"
}
}
```
This rule is not configurable.
## When Not To Use It
If you don't care about having unneeded namespace or enum qualifiers, then you don't need to use this rule.