Skip to content

Commit

Permalink
Fix eslint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
RileyAbr committed Nov 8, 2024
1 parent 7d3887b commit 5655931
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 69 deletions.
4 changes: 2 additions & 2 deletions wally-registry-frontend/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"extends": [
"next/core-web-vitals",
"next/typescript",
"plugin:jsx-a11y/strict "
"plugin:jsx-a11y/strict"
],
"rules": {
"no-constant-condition": ["error", { "checkLoops": "all" }],
"no-constant-condition": ["error", { "checkLoops": true }],
"no-unused-vars": 0,
"no-console": 2
}
Expand Down
1 change: 1 addition & 0 deletions wally-registry-frontend/next.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import createMDX from "@next/mdx"
import type { NextConfig } from "next"

const nextConfig: NextConfig = {
output: "export",
pageExtensions: ["js", "jsx", "md", "mdx", "ts", "tsx"],
compiler: {
styledComponents: true,
Expand Down
5 changes: 0 additions & 5 deletions wally-registry-frontend/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,6 @@ const iosevka = localFont({
fallback: ["Hack", "Consolas", "monospace"],
})

const iconFont = localFont({
src: "./fonts/icons.woff2",
display: "block",
})

export default function RootLayout({
children,
}: Readonly<{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,10 @@ const MetaItem = ({
}

const DependencyLink = ({ packageInfo }: { packageInfo: string }) => {
let packageMatch = packageInfo.match(/(.+\/.+)@[^\d]+([\d.]+)/)
const packageMatch = packageInfo.match(/(.+\/.+)@[^\d]+([\d.]+)/)
if (packageMatch != null) {
let name = packageMatch[1]
let version = packageMatch[2]
const name = packageMatch[1]
const version = packageMatch[2]
return (
<DependencyLinkWrapper>
<DependencyLinkItem href={`/package/${name}?version=${version}`}>
Expand Down Expand Up @@ -305,6 +305,7 @@ export default function Package() {

useEffect(() => {
loadPackageData(packageScope, packageName)
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [packageScope, packageName])

if (!isLoaded) {
Expand Down Expand Up @@ -338,8 +339,8 @@ export default function Package() {
<Heading>{packageName}</Heading>

<Paragraph>
Couldn't find {capitalize(packageName)} version {packageVersion}.
Are you sure that's a valid version?
Couldn&apos;t find {capitalize(packageName)} version{" "}
{packageVersion}. Are you sure that&apos;s a valid version?
</Paragraph>

<Button
Expand Down
5 changes: 4 additions & 1 deletion wally-registry-frontend/src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ const StyledNav = styled.nav`
}
`

const StyledNavLink = styled<any>(Link)`
const StyledNavLink = styled(Link)<{ $active: boolean }>`
color: ${(props) => (props.$active ? "var(--wally-red)" : "inherit")};
&:hover {
Expand Down Expand Up @@ -261,6 +261,7 @@ const MobilePushDown = styled.div`
}
`

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const reactSelectSearchTheme = (theme: any) => ({
...theme,
colors: {
Expand All @@ -271,6 +272,7 @@ const reactSelectSearchTheme = (theme: any) => ({
})

const reactSelectSearchStyles = {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
container: (provided: any) => ({
...provided,
flexGrow: 2,
Expand All @@ -279,6 +281,7 @@ const reactSelectSearchStyles = {
margin: "0 0.5rem 0.5rem",
},
}),
// eslint-disable-next-line @typescript-eslint/no-explicit-any
control: (provided: any) => ({
...provided,
borderRadius: "var(--radius-small)",
Expand Down
40 changes: 0 additions & 40 deletions wally-registry-frontend/src/components/Img.tsx

This file was deleted.

3 changes: 3 additions & 0 deletions wally-registry-frontend/src/components/PackageTag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ const BottomRow = styled.div`
margin: 0.2rem 0.5rem 0.3rem 0.5rem;
`

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const Author = styled.span`
color: rgba(255, 255, 255, 0.7);
font-size: 0.8rem;
Expand All @@ -156,6 +157,7 @@ export default function PackageBlip({
children,
title,
version,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
uniqueId,
className,
linkTo,
Expand All @@ -173,6 +175,7 @@ export default function PackageBlip({
linkTo?: string
inset?: boolean
}) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const Component: React.FC<any> = linkTo ? LinkBlip : StyledBlip

return (
Expand Down
14 changes: 2 additions & 12 deletions wally-registry-frontend/src/lib/registry.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,9 @@
"use client"

import isPropValid from "@emotion/is-prop-valid"
import { useServerInsertedHTML } from "next/navigation"
import React, { useState } from "react"
import { ServerStyleSheet, StyleSheetManager } from "styled-components"

// This implements the default behavior from styled-components v5
function shouldForwardProp(propName: string, target: any) {
if (typeof target === "string") {
// For HTML elements, forward the prop if it is a valid HTML attribute
return isPropValid(propName)
}
// For other elements, forward all props
return true
}

export default function StyledComponentsRegistry({
children,
}: {
Expand All @@ -35,7 +24,8 @@ export default function StyledComponentsRegistry({
return (
<StyleSheetManager
sheet={styledComponentsStyleSheet.instance}
// shouldForwardProp={shouldForwardProp}
// shouldForwardProp={shouldForwardProp} If there are many styled-components collision issues, a shouldForwardProp function can be added to solve some v5 migration problems.
// https://styled-components.com/docs/api#shouldforwardprop
>
{children}
</StyleSheetManager>
Expand Down
12 changes: 8 additions & 4 deletions wally-registry-frontend/src/services/wally.api.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { WallyPackageBrief, WallyPackageMetadata } from "../types/wally"

const wallyApiBaseUrl = `${process.env.NEXT_PUBLIC_WALLY_API_URL}/v1`
// API/v1/package-search?query=<query>
const wallyApiSearchUrl = `${wallyApiBaseUrl}/package-search`
Expand Down Expand Up @@ -28,7 +26,10 @@ export async function getWallyPackages(searchQuery: string | null) {
return response.json()
})
.then((data) => data)
.catch((error) => {})
.catch((error) => {
// eslint-disable-next-line no-console
console.error(error)
})
} else {
return []
}
Expand All @@ -52,7 +53,10 @@ export async function getWallyPackageMetadata(
return response.json()
})
.then((data) => data)
.catch((error) => {})
.catch((error) => {
// eslint-disable-next-line no-console
console.error(error)
})
}

/**
Expand Down

0 comments on commit 5655931

Please sign in to comment.