Currently using typescript-eslint, when defining a custom rule, I capture named and default declarations; however, those nodes do not seem to capture instances when I export an interface or export a type via Typescript. Is there any mechanism with typescript eslint to capture the instances when I am exporting either an interface or type? Likewise, the goal of the eslint rule is to count the number of total exports and enforce that it contains at most 1.
export const enforceMaxExportRule = createRule({
create(context) {
return {
ExportDefaultDeclaration(node) {
// do stuff with default export
},
ExportNamedDeclaration(node) {
// do stuff with named export
},
TSInterfaceDeclaration(node) {
// captures interfaces but not no way to tell if this interface ie exported
},
}
},
name: 'example',
meta: {
type: "problem",
messages: {
message1: "example",
},
fixable: "code",
schema: []
},
defaultOptions: [],
});
example file example.ts
export type foo = "bar"
export interface bar {
value: string;
}