Skip to content

Commit

Permalink
Re-add basic eslint config
Browse files Browse the repository at this point in the history
Biome is fantastic and kept around for additional linting, but ESLint
still has specific plugins which are useful across the ecosystem
  • Loading branch information
venables committed May 20, 2024
1 parent ca78f21 commit 971b449
Show file tree
Hide file tree
Showing 26 changed files with 254 additions and 98 deletions.
167 changes: 167 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
const { resolve } = require("node:path")

const project = resolve(process.cwd(), "tsconfig.json")

/** @type {import("eslint").Linter.Config} */
module.exports = {
root: true,
extends: [
require.resolve("@vercel/style-guide/eslint/browser"),
require.resolve("@vercel/style-guide/eslint/react"),
require.resolve("@vercel/style-guide/eslint/next"),
require.resolve("@vercel/style-guide/eslint/node"),
require.resolve("@vercel/style-guide/eslint/typescript"),
"next/core-web-vitals",
"plugin:tailwindcss/recommended"
],
env: {
node: true,
browser: true
},
parser: "@typescript-eslint/parser",
parserOptions: {
project: true
},
settings: {
"import/resolver": {
typescript: {
project
}
},
tailwindcss: {
callees: ["className", "clsx", "cls", "cva", "cn"]
}
},
ignorePatterns: [
// Ignore dotfiles
".*.js",
"node_modules/",
"dist/"
],
overrides: [
/**
* Config files
*/
{
files: ["*.config.{js,ts}"],
env: {
node: true
},
rules: {
"@typescript-eslint/no-var-requires": "off",
"import/no-default-export": "off"
}
},
/**
* Test Configuration
*/
{
files: ["**/__tests__/**/*.{ts,tsx}", "**/*.test.{ts,tsx}"],
extends: [require.resolve("@vercel/style-guide/eslint/vitest")],
rules: {
/**
* Allow non-null assertions in tests
*/
"@typescript-eslint/no-non-null-assertion": "off",
/**
* Don't require description for disabling eslint here
*/
"eslint-comments/require-description": "off"
}
},
/**
* Next.js configuration / exports
*/
{
files: [
"app/**/page.tsx",
"app/**/layout.tsx",
"app/**/loading.tsx",
"app/**/not-found.tsx",
"app/**/*error.tsx",
"app/sitemap.ts",
"app/robots.ts",
"app/manifest.ts"
],
rules: {
"import/no-default-export": "off",
"import/prefer-default-export": ["error", { target: "any" }]
}
},
/**
* JSX/TSX specific config
*/
{
files: ["**/*.{jsx,tsx}"],
rules: {
"no-nested-ternary": "off"
}
}
],
rules: {
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
"@typescript-eslint/consistent-type-imports": [
"error",
{ prefer: "type-imports", fixStyle: "separate-type-imports" }
],
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-misused-promises": [
"error",
{
checksVoidReturn: {
arguments: false,
attributes: false
}
}
],
"@typescript-eslint/no-unused-vars": [
"warn",
{
argsIgnorePattern: "^_",
caughtErrors: "none",
varsIgnorePattern: "^_"
}
],
"@typescript-eslint/restrict-template-expressions": [
"warn",
{
allowBoolean: true,
allowNumber: true
}
],
"import/order": [
"error",
{
"newlines-between": "never",
groups: [
["builtin", "external", "internal"],
["sibling", "parent"],
"index",
"object"
// "type"
],
alphabetize: {
order: "asc"
}
}
],
"no-console": [
"warn",
{
allow: ["warn", "error"]
}
],
"sort-imports": [
"error",
{
ignoreDeclarationSort: true
}
],
"tailwindcss/no-custom-classname": [
"error",
{
cssFiles: ["app/globals.css"]
}
]
}
}
6 changes: 5 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{
"recommendations": ["biomejs.biome", "bradlc.vscode-tailwindcss"]
"recommendations": [
"dbaeumer.vscode-eslint",
"biomejs.biome",
"bradlc.vscode-tailwindcss"
]
}
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
- [Bun](https://bun.sh) as a package manager!
- [React Server Components](https://nextjs.org/docs/app/building-your-application/rendering/server-components) by default.
- [Drizzle](https://orm.drizzle.team) database ORM, configured for [PostgreSQL](https://www.postgresql.org/) and [Drizzle Kit](https://orm.drizzle.team/kit-docs/overview)
- Insanely fast linting and formatting via [Biome](https://bimoejs.dev) for readable, safe code.
- Strict, recommended [ESLint](https://eslint.org/) config using the [Vercel Style Guide](https://github.com/vercel/style-guide) for readable, safe code.
- Insanely fast formatting via [Biome](https://bimoejs.dev), with additional linting.
- [Contentlayer](https://contentlayer.dev) for Markdown content (using the [active fork](https://github.com/timlrx/contentlayer2))
- [Typescript](https://www.typescriptlang.org/) for a rock-solid codebase
- [TailwindCSS](https://tailwindcss.com/) for utility-first CSS.
Expand Down
5 changes: 2 additions & 3 deletions app/(auth)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { redirect } from "next/navigation"
import type { PropsWithChildren } from "react"

import { auth } from "@/auth"
import { ThemePickerProvider } from "@/components/theme-picker/theme-picker-provider"
import { redirect } from "next/navigation"
import type { PropsWithChildren } from "react"

export const runtime = "edge"

Expand Down
13 changes: 6 additions & 7 deletions app/(auth)/register/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import Link from "next/link"

import { UserAuthForm } from "@/components/auth/user-auth-form"
import { Logo } from "@/components/icons/brand/logo"
import { Button } from "@/components/ui/button"
import { siteConfig } from "@/config/site"
import Link from "next/link"

export const metadata = {
title: "Create an account",
Expand All @@ -16,7 +15,7 @@ export default function RegisterPage() {
<div className="absolute top-4 flex w-full flex-row justify-between px-4 md:top-8">
<Button
asChild
className="z-20 flex items-center bg-transparent font-medium text-lg text-primary transition-colors hover:bg-accent lg:hover:bg-primary-foreground/10 lg:hover:text-primary-foreground lg:text-primary-foreground"
className="z-20 flex items-center bg-transparent text-lg font-medium text-primary transition-colors hover:bg-accent lg:text-primary-foreground lg:hover:bg-primary-foreground/10 lg:hover:text-primary-foreground"
>
<Link href="/">
<Logo className="mr-2 size-6" />
Expand All @@ -29,7 +28,7 @@ export default function RegisterPage() {
</Button>
</div>

<div className="relative hidden h-full flex-col bg-muted p-10 text-primary-foreground lg:flex dark:border-r">
<div className="relative hidden h-full flex-col bg-muted p-10 text-primary-foreground dark:border-r lg:flex">
<div className="absolute inset-0 h-full bg-primary" />

<div className="relative z-20 mt-auto">
Expand All @@ -46,17 +45,17 @@ export default function RegisterPage() {
<div className="lg:p-8">
<div className="mx-auto flex w-full flex-col justify-center space-y-6 sm:w-[350px]">
<div className="flex flex-col space-y-2 text-center">
<h1 className="font-semibold text-2xl tracking-tight">
<h1 className="text-2xl font-semibold tracking-tight">
Create an account
</h1>
<p className="text-muted-foreground text-sm">
<p className="text-sm text-muted-foreground">
Enter your email below to create your account
</p>
</div>

<UserAuthForm />

<p className="px-8 text-center text-muted-foreground text-sm">
<p className="px-8 text-center text-sm text-muted-foreground">
By clicking continue, you agree to our{" "}
<Button
asChild
Expand Down
15 changes: 7 additions & 8 deletions app/(auth)/signin/page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import type { Metadata } from "next"
import Link from "next/link"

import { UserAuthForm } from "@/components/auth/user-auth-form"
import { Logo } from "@/components/icons/brand/logo"
import { Button } from "@/components/ui/button"
import { siteConfig } from "@/config/site"
import type { Metadata } from "next"
import Link from "next/link"

export const metadata: Metadata = {
title: `Sign in to ${siteConfig.name}`,
Expand All @@ -21,7 +20,7 @@ export default function SigninPage() {
<div className="absolute top-4 flex w-full flex-row justify-between px-4 md:top-8">
<Button
asChild
className="z-20 flex items-center bg-transparent font-medium text-lg text-primary transition-colors hover:bg-accent lg:hover:bg-primary-foreground/10 lg:hover:text-primary-foreground lg:text-primary-foreground"
className="z-20 flex items-center bg-transparent text-lg font-medium text-primary transition-colors hover:bg-accent lg:text-primary-foreground lg:hover:bg-primary-foreground/10 lg:hover:text-primary-foreground"
>
<Link href="/">
<Logo className="mr-2 size-6" />
Expand All @@ -34,7 +33,7 @@ export default function SigninPage() {
</Button>
</div>

<div className="relative hidden h-full flex-col bg-muted p-10 text-primary-foreground lg:flex dark:border-r">
<div className="relative hidden h-full flex-col bg-muted p-10 text-primary-foreground dark:border-r lg:flex">
<div className="absolute inset-0 h-full bg-primary" />

<div className="relative z-20 mt-auto">
Expand All @@ -51,17 +50,17 @@ export default function SigninPage() {
<div className="lg:p-8">
<div className="mx-auto flex w-full flex-col justify-center space-y-6 sm:w-[350px]">
<div className="flex flex-col space-y-2 text-center">
<h1 className="font-semibold text-2xl tracking-tight">
<h1 className="text-2xl font-semibold tracking-tight">
Welcome back
</h1>
<p className="text-muted-foreground text-sm">
<p className="text-sm text-muted-foreground">
Enter your email below to sign in to your account
</p>
</div>

<UserAuthForm />

<p className="px-8 text-center text-muted-foreground text-sm">
<p className="px-8 text-center text-sm text-muted-foreground">
Already have an account?{" "}
<Button
asChild
Expand Down
10 changes: 7 additions & 3 deletions app/(marketing)/features.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
"use client"

import { Button } from "@/components/ui/button"
import { cls } from "@/lib/utils/cls"
import { CheckIcon } from "lucide-react"
import Link from "next/link"
import { useMemo } from "react"
import { toast } from "sonner"

import { Button } from "@/components/ui/button"
import { cls } from "@/lib/utils/cls"

export function Features() {
const FEATURES = useMemo(
() => [
Expand All @@ -22,6 +21,11 @@ export function Features() {
{ title: "API Route Handlers" },
{ title: "Authentication (Email + OAuth)" },
{ title: "Typescript (Strict)" },
{
title: "Vercel Style Guide",
href: "https://github.com/vercel/style-guide"
},
{ title: "ESLint" },
{ title: "TailwindCSS", href: "https://tailwindcss.com" },
{ title: "Radix UI", href: "https://www.radix-ui.com" },
{ title: "PostgreSQL" },
Expand Down
22 changes: 10 additions & 12 deletions app/(marketing)/page.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import { Badge } from "@/components/ui/badge"
import { Button } from "@/components/ui/button"
import { siteConfig } from "@/config/site"
import { cls } from "@/lib/utils/cls"
import { GithubIcon } from "lucide-react"
import type { Metadata } from "next"
import { Permanent_Marker as PermanentMarker } from "next/font/google"
import Image from "next/image"
import Link from "next/link"

import { Badge } from "@/components/ui/badge"
import { Button } from "@/components/ui/button"
import { siteConfig } from "@/config/site"
import { cls } from "@/lib/utils/cls"

import { Features } from "./features"

const handwriting = PermanentMarker({ weight: "400", subsets: ["latin"] })
Expand All @@ -32,11 +30,11 @@ export default function Home() {
<Badge className="font-bold sm:text-lg" variant="secondary">
{siteConfig.name}
</Badge>
<h1 className="relative mb-5 text-center font-extrabold text-4xl leading-none tracking-tight md:text-6xl">
<h1 className="relative mb-5 text-center text-4xl font-extrabold leading-none tracking-tight md:text-6xl">
A sane way to start your next{" "}
<Button
asChild
className="p-0 font-extrabold text-4xl text-muted-foreground leading-none tracking-tight md:text-6xl"
className="p-0 text-4xl font-extrabold leading-none tracking-tight text-muted-foreground md:text-6xl"
variant="ghost"
>
<Link href="https://nextjs.org/" rel="noreferrer" target="_blank">
Expand All @@ -47,22 +45,22 @@ export default function Home() {
<span
className={cls(
handwriting.className,
"-mb-6 -rotate-6 bottom-0 block text-2xl text-red-500 md:absolute md:right-0 md:text-4xl"
"bottom-0 -mb-6 block -rotate-6 text-2xl text-red-500 md:absolute md:right-0 md:text-4xl"
)}
>
^ on the edge
</span>
</h1>

<h2 className="mt-6 pt-2 pb-6">
<h2 className="mt-6 pb-6 pt-2">
Clean, understandable code. The latest best practices. Best-in-class
open source libraries.{" "}
<span className="font-bold">And 100% on the edge.</span>
</h2>

<Button
asChild
className="font-semibold text-lg tracking-tighter"
className="text-lg font-semibold tracking-tighter"
size="lg"
variant="secondary"
>
Expand Down Expand Up @@ -95,7 +93,7 @@ export default function Home() {
</section>

<section className="mt-12 flex h-full grow flex-col items-center justify-center space-y-12 px-4 sm:px-0">
<h2 className="font-bold text-3xl">What&apos;s included</h2>
<h2 className="text-3xl font-bold">What&apos;s included</h2>
<Features />

<div className="flex flex-col items-center justify-center space-y-2">
Expand Down
Loading

0 comments on commit 971b449

Please sign in to comment.