Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

fix(no-single-declare-module): allow single wildcard module declaration #339

Merged
merged 1 commit into from
Aug 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/rules/noSingleDeclareModuleRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ function walk(ctx: Lint.WalkContext<void>): void {
let moduleDecl: ts.ModuleDeclaration | undefined;
for (const statement of sourceFile.statements) {
if (ts.isModuleDeclaration(statement) && ts.isStringLiteral(statement.name)) {
if (statement.name.text.indexOf('*') !== -1) {
// Ignore wildcard module declarations
return;
}

if (moduleDecl === undefined) {
moduleDecl = statement;
} else {
Expand Down
1 change: 1 addition & 0 deletions test/no-single-declare-module/wildcard.d.ts.lint
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
declare module "*.svg" {}