-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Description
The import/order
rule gives false positives for imports inside TypeScript module declarations.
Practical example:
declare module 'monaco-editor/esm/vs/base/common/cancellation' {
export enum CancellationToken {
None,
}
}
declare module 'monaco-editor/esm/vs/editor/contrib/documentSymbols/documentSymbols' {
import { ITextModel, languages } from 'monaco-editor';
import { CancellationToken } from 'monaco-editor/esm/vs/base/common/cancellation';
export function getDocumentSymbols(
model: ITextModel,
flat: boolean,
token: CancellationToken,
): Promise<languages.DocumentSymbol[]>;
}
declare module 'monaco-editor/esm/vs/editor/editor.worker' {
import { worker } from 'monaco-editor/esm/vs/editor/editor.api';
export function initialize(
fn: (ctx: worker.IWorkerContext, createData: unknown) => unknown,
): void;
}
This is happening, because import/order
collects all import statements and assumes they are in the program body.
I would expect the import/order
rule to be applied to each body separately. Currently these are the Program
body and the TSModuleBlock
body, but who knows what the future holds.
Alternatively the rule could be applied to imports which are direct children Program
body only.