function checkInExternalModule()

in src/rules/strictExportDeclareModifiersRule.ts [41:65]


    function checkInExternalModule(node: ts.Statement, autoExportEnabled: boolean) {
        // Ignore certain node kinds (these can't have 'export' or 'default' modifiers)
        switch (node.kind) {
            case ts.SyntaxKind.ImportDeclaration:
            case ts.SyntaxKind.ImportEqualsDeclaration:
            case ts.SyntaxKind.ExportDeclaration:
            case ts.SyntaxKind.NamespaceExportDeclaration:
                return;
        }

        // `declare global` and `declare module "foo"` OK. `declare namespace N` not OK, should be `export namespace`.
        if (!isDeclareGlobalOrExternalModuleDeclaration(node)) {
            if (isDeclare(node)) {
                fail(mod(node, ts.SyntaxKind.DeclareKeyword), "'declare' keyword is redundant here.");
            }
            if (autoExportEnabled && !isExport(node)) {
                fail(
                    (node as ts.DeclarationStatement).name || node,
                    "All declarations in this module are exported automatically. " +
                    "Prefer to explicitly write 'export' for clarity. " +
                    "If you have a good reason not to export this declaration, " +
                    "add 'export {}' to the module to shut off automatic exporting.");
            }
        }
    }