@jimmy.codes/eslint-config
Version:
A simple, modern ESLint config that covers most use cases.
41 lines (39 loc) • 1.04 kB
JavaScript
import { isPackageExists } from "local-pkg";
//#region src/utils/has-dependency.ts
const hasTypescript = () => {
return isPackageExists("typescript");
};
const hasReact = () => {
return isPackageExists("react");
};
const hasVitest = () => {
return isPackageExists("vitest");
};
const hasJest = () => {
return isPackageExists("jest");
};
const hasTestingLibrary = () => {
return ["@testing-library/react"].some((pkg) => {
return isPackageExists(pkg);
});
};
const hasReactQuery = () => {
return isPackageExists("@tanstack/react-query");
};
const hasAstro = () => {
return isPackageExists("astro");
};
const hasPlaywright = () => {
return isPackageExists("@playwright/test");
};
const hasStorybook = () => {
return isPackageExists("storybook");
};
const hasNext = () => {
return isPackageExists("next");
};
const hasVite = () => {
return isPackageExists("vite");
};
//#endregion
export { hasAstro, hasJest, hasNext, hasPlaywright, hasReact, hasReactQuery, hasStorybook, hasTestingLibrary, hasTypescript, hasVite, hasVitest };