Skip to content
This repository has been archived by the owner on Jan 19, 2019. It is now read-only.

Latest commit

 

History

History
65 lines (42 loc) · 1.28 KB

interface-name-prefix.md

File metadata and controls

65 lines (42 loc) · 1.28 KB

Require that interface names be prefixed with I (interface-name-prefix)

It can be hard to differentiate between classes and interfaces. Prefixing interfaces with "I" can help telling them apart at a glance.

Rule Details

This rule enforces consistency of interface naming prefix conventions.

Options

This rule has a string option.

  • "never" (default) disallows all interfaces being prefixed with "I"
  • "always" requires all interfaces be prefixed with "I"

never

TypeScript suggests never prefixing interfaces with "I".

The following patterns are considered warnings:

interface IAnimal {
    name: string;
}

The following patterns are not warnings:

interface Animal {
    name: string;
}

always

The following patterns are considered warnings:

interface Animal {
    name: string;
}

The following patterns are not warnings:

interface IAnimal {
    name: string;
}

When Not To Use It

If you do not want to enforce interface name prefixing.

Further Reading

TypeScript Interfaces

Compatibility

TSLint: interface-name