Skip to main content

no-unnecessary-qualifier

Disallows unnecessary namespace qualifiers.

Attributes

  • Included in configs
    • ✅ Recommended
    • 🔒 Strict
  • Fixable
    • 🔧 Automated Fixer
    • 🛠 Suggestion Fixer
  • 💭 Requires type information

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:

namespace A {
export type B = number;
const x: A.B = 3;
}
namespace A {
export const x = 3;
export const y = A.x;
}
enum A {
B,
C = A.B,
}
namespace A {
export namespace B {
export type T = number;
const x: A.B.T = 3;
}
}

Options

// .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.