@jimmy.codes/eslint-config
Version:
A simple, modern ESLint config that covers most use cases.
40 lines (39 loc) • 1.09 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 { hasReact as a, hasTestingLibrary as c, hasVitest as d, hasPlaywright as i, hasTypescript as l, hasJest as n, hasReactQuery as o, hasNext as r, hasStorybook as s, hasAstro as t, hasVite as u };