Skip to content

Commit

Permalink
Linting!
Browse files Browse the repository at this point in the history
  • Loading branch information
oBusk committed Mar 10, 2024
1 parent 793b15e commit 35a0aff
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 29 deletions.
3 changes: 1 addition & 2 deletions src/app/[...parts]/_page/NpmDiff/NpmDiff.skeleton.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { forwardRef, Suspense } from "react";
import { Suspense } from "react";
import Skeleton from "^/components/ui/Skeleton";
import Stack from "^/components/ui/Stack";
import { DiffFilesSkeleton } from "./DiffFiles";
import { type NpmDiffProps } from "./NpmDiff";
import ViewTypeSwitch from "./ViewTypeSwitch";

const NpmDiffSkeleton = () => (
Expand Down
1 change: 0 additions & 1 deletion src/app/[...parts]/_page/SizeComparison/SizeComparison.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { type FunctionComponent, type ReactNode } from "react";
import ExternalLink, {
type ExternalLinkProps,
} from "^/components/ExternalLink";
import Heading from "^/components/ui/Heading";
import { cx } from "^/lib/cva";
import { type Service, type ServiceName, Services } from "^/lib/Services";
import type SimplePackageSpec from "^/lib/SimplePackageSpec";
Expand Down
2 changes: 0 additions & 2 deletions src/app/[...parts]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { redirect } from "next/navigation";
import { Suspense } from "react";
import { type ViewType } from "react-diff-view";
import { createSimplePackageSpec } from "^/lib/createSimplePackageSpec";
import { DEFAULT_DIFF_FILES_GLOB } from "^/lib/default-diff-files";
Expand All @@ -12,7 +11,6 @@ import splitParts from "^/lib/utils/splitParts";
import BundlephobiaDiff from "./_page/BundlephobiaDiff";
import DiffIntro from "./_page/DiffIntro";
import NpmDiff from "./_page/NpmDiff";
import NpmDiffSkeleton from "./_page/NpmDiff/NpmDiff.skeleton";
import PackagephobiaDiff from "./_page/PackagephobiaDiff";
import { type DIFF_TYPE_PARAM_NAME } from "./_page/paramNames";

Expand Down
2 changes: 1 addition & 1 deletion src/components/ExternalLink.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** @jest-environment jsdom */
// @jest-environment jsdom

import { render, screen } from "@testing-library/react";
import ExternalLink from "./ExternalLink";
Expand Down
9 changes: 3 additions & 6 deletions src/components/ui/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,13 @@ import {
} from "react";
import { cx } from "^/lib/cva";

const TooltipProvider = forwardRef<
ElementRef<typeof Primitive.Provider>,
ComponentPropsWithoutRef<typeof Primitive.Provider>
>((props: ComponentProps<typeof Primitive.Provider>, ref) => (
const TooltipProvider = (props: ComponentProps<typeof Primitive.Provider>) => (
<Primitive.Provider
delayDuration={250}
skipDelayDuration={100}
{...props}
/>
));
);
TooltipProvider.displayName = Primitive.Provider.displayName;

const TooltipRoot = Primitive.Root;
Expand Down Expand Up @@ -69,4 +66,4 @@ const Tooltip = forwardRef<ElementRef<typeof TooltipTrigger>, TooltipProps>(
Tooltip.displayName = "Tooltip";

export default Tooltip;
export { TooltipRoot, TooltipTrigger, TooltipContent, TooltipProvider };
export { TooltipContent, TooltipProvider, TooltipRoot, TooltipTrigger };
2 changes: 1 addition & 1 deletion src/lib/api/npm/getVersionData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ async function getVersionDataInner(

const versionData: VersionMap = {};

for (const [version, data] of Object.entries(versions)) {
for (const [version] of Object.entries(versions)) {
versionData[version] = { time: time[version] };
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib/api/npm/packument.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const defaultOpts = {
};

// https://github.com/npm/npm-registry-fetch/blob/9cd725786b1362df268afda7b6e2a6c3db8ab05e/index.js#L175-L189
function pickRegistry(specStr: string, opts: any = {}) {
function pickRegistry(specStr: string, _opts: any = {}) {
// // All of this code relies on `npa()` being available, which it isn't on the edge
//
// const spec = npa(specStr);
Expand Down
14 changes: 7 additions & 7 deletions src/lib/destination/canonicalSpec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,16 @@ async function handleNpaResult(result: npa.Result): Promise<string> {
* An "canonical" registry specifier is a registry specifer that will always
* return the same package.
*
* * Takes registry specifier of type `version` and returns it instantly, it is already canonical.
* * Takes registry specifier of type `tag` or `range` and returns with version.
* * Takes registry specifier of type `git`, `remote` and returns with commit.
* * Takes registry specifier of type `alias` and resolves sub spec.
* * Throws on specifier of type `directory` or `file`.
* - Takes registry specifier of type `version` and returns it instantly, it is already canonical.
* - Takes registry specifier of type `tag` or `range` and returns with version.
* - Takes registry specifier of type `git`, `remote` and returns with commit.
* - Takes registry specifier of type `alias` and resolves sub spec.
* - Throws on specifier of type `directory` or `file`.
*
* # Read More
*
* * https://github.com/npm/npm-package-arg#result-object
* * https://docs.npmjs.com/cli/v7/commands/npm-install
* - https://github.com/npm/npm-package-arg#result-object
* - https://docs.npmjs.com/cli/v7/commands/npm-install
*/
const canonicalSpec = unstable_cache(
async function _canonicalSpecs(spec: string): Promise<string> {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/query/parseQuery/trimUndefined.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ export default function trimUndefined<T extends Record<string, unknown>>(
obj: T,
): T {
return Object.fromEntries(
Object.entries(obj).filter(([key, value]) => value !== undefined),
Object.entries(obj).filter(([, value]) => value !== undefined),
) as T;
}
1 change: 0 additions & 1 deletion src/lib/utils/splitParts.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import exp from "constants";
import splitParts from "./splitParts";

describe("splitParts", () => {
Expand Down
8 changes: 2 additions & 6 deletions src/lib/utils/splitParts.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
function isTupleOfTwo<T>(t: T[]): t is [T, T] {
return t.length === 2;
}

/**
* Takes the weird "parts" that we get from the next.js query does necessary
* merging and returns a tuple with two specs/versions.
*
* @examples
*
* @example
* `package...1.0.0` ➡ `['package', '1.0.0']`
*
* @example
* `['@types', 'package@^1...@types', 'package@^2']` ➡ `['@types/package@^1', '@types/package@^2']`
*/
function splitParts(parts?: string | string[]): [string] | [string, string] {
Expand Down

0 comments on commit 35a0aff

Please sign in to comment.