Disallow the declaration of empty interfaces.
// code-linter.json5
{
"rules": {
"@typescript-eslint/no-empty-interface": "error"
}
} // an interface with any number of members
interface Foo {
name: string;
}
interface Bar {
age: number;
}
// an interface with more than one supertype
// in this case the interface can be used as a replacement of an intersection type.
export interface Baz extends Foo, Bar {} // an empty interface
interface Foo {}
// an interface with only one supertype (Bar === Foo)
export interface Bar extends Foo {}
// an interface with an empty list of supertypes
export interface Baz {} plugin:@typescript-eslint/all
For details about how to configure Code Linter check rules, see Code Linter.