eslint-plugin-esm
Version:
ESLint plugin for linting ESM (import/export syntax)
31 lines • 1.43 kB
TypeScript
import type { Rule } from "eslint";
import type { JSONSchema4 } from "json-schema";
import type { GetNode } from "./utils.ts";
type ExportAllDeclaration = GetNode<"ExportAllDeclaration">;
type ExportNamedDeclaration = GetNode<"ExportNamedDeclaration">;
type ImportDeclaration = GetNode<"ImportDeclaration">;
type ImportExpression = GetNode<"ImportExpression">;
export declare const DEFAULT_MESSAGE_ID = "default";
export declare function createRule({ name, message, schema, fixable, type, create: createFn, }: {
name: string;
message: string;
schema?: JSONSchema4[];
fixable?: Rule.RuleMetaData["fixable"];
type?: Rule.RuleMetaData["type"];
create: (context: Rule.RuleContext) => Rule.RuleListener;
}): {
name: string;
rule: Rule.RuleModule;
};
export declare function getRuleName(importMetaUrl: string): string;
export type ImportationNode = ImportDeclaration | ImportExpression | ExportAllDeclaration | ExportNamedDeclaration;
/**
* Create ESLint RuleListener to check string importation source.
* @param context ESLint RuleContext
* @param check the check logic
* @returns ESLint RuleListener
*/
export declare function create(context: Rule.RuleContext, check: (filename: string, source: string, node: ImportationNode) => boolean): Rule.RuleListener;
export declare function getSourceType(source: string): "local" | "builtin" | "module";
export {};
//# sourceMappingURL=common.d.ts.map