Skip to content

Commit

Permalink
ts eslint rules on unused vars -- especially for imports
Browse files Browse the repository at this point in the history
  • Loading branch information
goodeats committed Aug 27, 2024
1 parent 04b00a1 commit 81f13aa
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
8 changes: 1 addition & 7 deletions app/routes/_auth+/signup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,12 @@ import {
type ActionFunctionArgs,
type MetaFunction,
} from '@remix-run/node'
import { Form, useActionData, useSearchParams } from '@remix-run/react'
import { Form, useActionData } from '@remix-run/react'
import { HoneypotInputs } from 'remix-utils/honeypot/react'
import { z } from 'zod'
import { GeneralErrorBoundary } from '#app/components/error-boundary.tsx'
import { ErrorList, Field } from '#app/components/forms.tsx'
import { StatusButton } from '#app/components/ui/status-button.tsx'
import {
ProviderConnectionForm,
providerNames,
} from '#app/utils/connections.tsx'
import { prisma } from '#app/utils/db.server.ts'
import { sendEmail } from '#app/utils/email.server.ts'
import { checkHoneypot } from '#app/utils/honeypot.server.ts'
Expand Down Expand Up @@ -123,8 +119,6 @@ export const meta: MetaFunction = () => {
export default function SignupRoute() {
const actionData = useActionData<typeof action>()
const isPending = useIsPending()
const [searchParams] = useSearchParams()
const redirectTo = searchParams.get('redirectTo')

const [form, fields] = useForm({
id: 'signup-form',
Expand Down
21 changes: 21 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,28 @@
import { default as defaultConfig } from '@epic-web/config/eslint'

const ERROR = 'error'

/** @type {import("eslint").Linter.Config} */
export default [
...defaultConfig,
// add custom config objects here:
// https://github.com/epicweb-dev/config/blob/main/docs/decisions/008-new-ts-eslint-rules.md
// I agree with not needing a lint rule to yell at you about using `any` in a type
{
plugins: {
'@typescript-eslint': (await import('typescript-eslint')).plugin,
},
rules: {
// I prefer error over warn from the default config
'@typescript-eslint/no-unused-vars': [
ERROR,
{
args: 'after-used',
argsIgnorePattern: '^_',
ignoreRestSiblings: true,
varsIgnorePattern: '^ignored',
},
],
},
},
]

0 comments on commit 81f13aa

Please sign in to comment.