Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't complain about 'export import =' in strict-export-declare-modifiers #966

Merged
merged 3 commits into from
Feb 29, 2024
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 .changeset/quiet-flies-develop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@definitelytyped/eslint-plugin": patch
---

Don't complain about 'export import =' in strict-export-declare-modifiers
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,12 @@ const rule = createRule({
function checkBlock(block: ts.ModuleBlock, autoExportEnabled: boolean): void {
for (const statement of block.statements) {
// Compiler will error for 'declare' here anyway, so just check for 'export'.
if (isExport(statement) && autoExportEnabled && !isDefault(statement)) {
if (
!ts.isImportEqualsDeclaration(statement) &&
isExport(statement) &&
autoExportEnabled &&
!isDefault(statement)
) {
context.report({
loc: getModifierLoc(statement as ts.HasModifiers, ts.SyntaxKind.ExportKeyword),
messageId: "redundantExport",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
No errors

==== types/strict-export-declare-modifiers/good10.d.ts ====

import * as good1 from './good1';

export namespace Foo {
export import C = good1.C;

const foo: number;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import * as good1 from './good1';

export namespace Foo {
export import C = good1.C;

const foo: number;
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"good7.d.ts",
"good8.d.ts",
"good9.d.ts",
"good10.d.ts",
"bad1.d.ts",
"bad2.d.ts",
"bad3.d.ts",
Expand Down
Loading