eslint-plugin-sonarjs
Version:
47 lines (46 loc) • 1.64 kB
TypeScript
import { Minimatch } from 'minimatch';
import type { NormalizedAbsolutePath } from '../../files.js';
import type { Filesystem } from '../../find-up/find-minimatch.js';
import type { PackageJson } from 'type-fest';
type ImportMap = Record<string, unknown>;
export type DependenciesList = Map<string | Minimatch, string | undefined>;
export type ModuleType = 'module' | 'commonjs';
export declare const DEFINITELY_TYPED = "@types/";
type PackageJsonManifest = {
type: 'package-json';
manifest: PackageJson;
};
export type DenoJson = {
imports?: ImportMap;
workspace?: string[] | {
members?: string[];
};
};
type DenoManifest = {
type: 'deno';
manifest: DenoJson;
};
export type DependencyManifest = (PackageJsonManifest | DenoManifest) & {
readonly dependencies: DependenciesList;
readonly moduleType: ModuleType | undefined;
};
/**
* Strategy interface for resolving dependency manifests of a specific type from a single
* directory. Implement this interface and register it in {@link MANIFEST_RESOLVERS} to add
* support for a new package manager or manifest format (e.g., Bun).
*/
export interface ManifestResolver {
resolve(dir: NormalizedAbsolutePath, topDir: NormalizedAbsolutePath, fileSystem?: Filesystem): DependencyManifest[];
}
type Catalog = Record<string, string>;
export type CatalogSource = {
catalog?: Catalog;
catalogs?: Record<string, Catalog>;
};
export type Workspace = CatalogSource & {
packages?: string[];
};
export type ExtendedPackageJson = PackageJson & CatalogSource & {
workspaces?: PackageJson.WorkspacePattern[] | Workspace;
};
export {};