Skip to content

Commit

Permalink
Merge pull request #36 from JosephGasiorekUSDS/jgasiorek-ffs-975
Browse files Browse the repository at this point in the history
FFS-975: Enable Unused import eslint plugin
  • Loading branch information
JosephGasiorekUSDS authored Jun 26, 2024
2 parents 4e4c979 + a7c10f8 commit 1d8c338
Show file tree
Hide file tree
Showing 26 changed files with 78 additions and 44 deletions.
16 changes: 15 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
{
"extends": ["plugin:i18next/recommended", "next/core-web-vitals"]
"extends": ["plugin:i18next/recommended", "next/core-web-vitals"],
"plugins": ["unused-imports"],
"rules": {
"no-unused-vars": "off",
"unused-imports/no-unused-imports": "error",
"unused-imports/no-unused-vars": [
"warn",
{
"vars": "all",
"varsIgnorePattern": "^_",
"args": "after-used",
"argsIgnorePattern": "^_"
}
]
}
}
2 changes: 1 addition & 1 deletion app/StoreProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client'
import { useRef } from "react"
import { Provider, useDispatch } from "react-redux"
import { Provider } from "react-redux"
import { makeStore, AppStore } from '../lib/store'

export default function StoreProvider({
Expand Down
2 changes: 1 addition & 1 deletion app/[locale]/ledger/expense/add/page.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { afterEach, beforeEach, describe, expect, it, test } from 'vitest'
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react'
import { Provider } from 'react-redux'
import Page from './page'
Expand Down
8 changes: 3 additions & 5 deletions app/[locale]/ledger/expense/add/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@
import "@trussworks/react-uswds/lib/uswds.css"
import "@trussworks/react-uswds/lib/index.css"
import { useTranslation } from 'react-i18next'
import { Header, Title, Button, Form, FormGroup, Grid, GridContainer, Alert, Checkbox, DatePicker, ErrorMessage, ComboBox, Label, ValidationChecklist, ValidationItem, RequiredMarker } from '@trussworks/react-uswds'
import { Header, Title, Button, Form, FormGroup, Grid, GridContainer, Alert, Checkbox, DatePicker, ComboBox, Label, ValidationChecklist, ValidationItem, RequiredMarker } from '@trussworks/react-uswds'
import { useAppDispatch } from "@/lib/hooks"
import { ExpenseItem, addExpense, selectExpenseItems } from "@/lib/features/ledger/expenses/expensesSlice"
import { ExpenseItem, addExpense } from "@/lib/features/ledger/expenses/expensesSlice"
import { useRouter } from "next/navigation"
import { FieldErrors, SubmitHandler, useForm, Controller } from "react-hook-form"
import { SubmitHandler, useForm, Controller } from "react-hook-form"
import TextFieldWithValidation from "@/app/components/TextFieldWithValidation"
import { useRef, useImperativeHandle } from "react"
import exp from "constants"
import RequiredFieldDescription from "@/app/components/RequiredFieldDescription"

export default function Page() {
Expand Down
4 changes: 2 additions & 2 deletions app/[locale]/ledger/expense/list/page.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { afterEach, beforeEach, describe, expect, it, test } from 'vitest'
import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react'
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
import { cleanup, render, screen } from '@testing-library/react'
import { Provider } from 'react-redux'
import Page from './page'
import { makeStore } from '@/lib/store'
Expand Down
2 changes: 1 addition & 1 deletion app/[locale]/ledger/expense/list/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import "@trussworks/react-uswds/lib/uswds.css"
import "@trussworks/react-uswds/lib/index.css"
import { Header, Title, Button, ButtonGroup, CardGroup, ModalToggleButton, Modal, ModalHeading, ModalFooter, Card, CardBody, CardHeader, Grid, GridContainer, Label, TextInput, ModalRef } from '@trussworks/react-uswds'
import { Header, Title, Button, ButtonGroup, Grid, GridContainer } from '@trussworks/react-uswds'
import { useTranslation } from 'react-i18next'
import { useRouter } from "next/navigation"
import ExpenseList from "@/app/components/ExpenseList"
Expand Down
4 changes: 2 additions & 2 deletions app/[locale]/ledger/expense/page.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { afterEach, beforeEach, describe, expect, it, test } from 'vitest'
import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react'
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
import { cleanup, render, screen } from '@testing-library/react'
import { Provider } from 'react-redux'
import Page from './page'
import { makeStore } from '@/lib/store'
Expand Down
2 changes: 1 addition & 1 deletion app/[locale]/ledger/expense/snap/page.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { afterEach, beforeEach, describe, expect, it, test } from 'vitest'
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react'
import { Provider } from 'react-redux'
import Page from './page'
Expand Down
5 changes: 1 addition & 4 deletions app/[locale]/ledger/expense/snap/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

import "@trussworks/react-uswds/lib/uswds.css"
import "@trussworks/react-uswds/lib/index.css"
import { Header, Title, Button, HeadingLevel, Grid, GridContainer, Accordion, Radio, Form } from '@trussworks/react-uswds'
import { Header, Title, Button, Grid, GridContainer, Radio, Form } from '@trussworks/react-uswds'
import { useRouter } from "next/navigation"
import Link from 'next/link'
import { useTranslation } from "react-i18next"
import { Controller, SubmitHandler, useForm } from "react-hook-form"

Expand All @@ -19,8 +18,6 @@ export default function Page() {
}

const {
register,
formState: { errors },
handleSubmit,
control
} = useForm<FormData>()
Expand Down
3 changes: 1 addition & 2 deletions app/[locale]/ledger/expense/snap/recommend/page.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { afterEach, beforeEach, describe, expect, it, test } from 'vitest'
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react'
import { Provider } from 'react-redux'
import Page from './page'
import { makeStore } from '@/lib/store'
import { vi } from 'vitest'
Expand Down
2 changes: 1 addition & 1 deletion app/[locale]/ledger/expense/snap/recommend/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default function Page() {
// User should not have been pushed to this screen
return router.push('/ledger/review')
}
}, [])
}, [benefits.snap, reccommendStandardDeduction, router])

return (
<div>
Expand Down
5 changes: 1 addition & 4 deletions app/[locale]/ledger/income/add/page.test.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import { afterEach, beforeEach, describe, expect, it, test } from 'vitest'
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react'
import Page from './page'
import { makeStore } from '@/lib/store'
import { vi } from 'vitest'
import { EnhancedStore } from '@reduxjs/toolkit'
import mockRouter from 'next-router-mock'
import TestWrapper from '@/app/TestWrapper'

describe('Add Income To Ledger Page', async () => {
let store: EnhancedStore
beforeEach(() => {
vi.mock('next/navigation', () => require('next-router-mock'))
mockRouter.push('/ledger/income/add')
Expand Down
2 changes: 1 addition & 1 deletion app/[locale]/ledger/income/add/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useTranslation } from 'react-i18next'
import { useAppDispatch } from "@/lib/hooks"
import { addIncome, IncomeItem } from "@/lib/features/ledger/income/incomeSlice"
import { useRouter } from "next/navigation"
import { FieldErrors, SubmitHandler, useForm, Controller } from "react-hook-form"
import { FieldErrors, SubmitHandler, useForm } from "react-hook-form"
import TextFieldWithValidation from "@/app/components/TextFieldWithValidation"
import TextAreaWithValidation from "@/app/components/TextAreaWithValidation"
import RequiredFieldDescription from "@/app/components/RequiredFieldDescription"
Expand Down
3 changes: 1 addition & 2 deletions app/[locale]/ledger/income/list/page.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { afterEach, beforeEach, describe, expect, it, test } from 'vitest'
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react'
import { Provider } from 'react-redux'
import Page from './page'
Expand All @@ -15,7 +15,6 @@ describe('List Income in Ledger Page', async () => {
vi.mock('next/navigation', () => require('next-router-mock'))
mockRouter.push('/ledger/income/add')
store = makeStore()
// render (<Provider store={store}><Page /></Provider>)
})
afterEach(cleanup)

Expand Down
4 changes: 2 additions & 2 deletions app/[locale]/ledger/review/LedgerReviewHeader.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { afterEach, beforeEach, describe, expect, it, test } from 'vitest'
import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react'
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
import { cleanup, render, screen } from '@testing-library/react'
import LedgerReviewHeader from './LedgerReviewHeader'
import { BenefitsState } from '@/lib/features/benefits/benefitsSlice'
import TestWrapper from '@/app/TestWrapper'
Expand Down
4 changes: 2 additions & 2 deletions app/[locale]/ledger/review/SnapExpenses.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { afterEach, beforeEach, describe, expect, it, test } from 'vitest'
import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react'
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
import { cleanup, render, screen, waitFor } from '@testing-library/react'
import { Provider } from 'react-redux'
import { makeStore } from '@/lib/store'
import { EnhancedStore } from '@reduxjs/toolkit'
Expand Down
2 changes: 1 addition & 1 deletion app/[locale]/ledger/review/page.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { afterEach, beforeEach, describe, expect, it, test } from 'vitest'
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react'
import { Provider } from 'react-redux'
import Page from './page'
Expand Down
2 changes: 1 addition & 1 deletion app/[locale]/page.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { afterEach, beforeEach, describe, expect, it, test } from 'vitest'
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react'
import { Provider } from 'react-redux'
import Page from './page'
Expand Down
5 changes: 1 addition & 4 deletions app/[locale]/statement/confirmation/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,14 @@ import "@trussworks/react-uswds/lib/uswds.css"
import "@trussworks/react-uswds/lib/index.css"
import { Header, Title, Button, Grid, GridContainer } from '@trussworks/react-uswds'
import { useTranslation } from 'react-i18next'
import { useAppDispatch, useAppSelector } from "@/lib/hooks"
import { useRouter } from "next/navigation"
import { useAppSelector } from "@/lib/hooks"
import { selectSignedStatement } from "@/lib/features/statement/statementSlice"
import Link from "next/link"
import Image from "next/image"
import ledgerImage from './ledger.png'

export default function Page() {
const { t } = useTranslation()
const dispatch = useAppDispatch()
const router = useRouter()
const signedStatement = useAppSelector((state) => selectSignedStatement(state))

return (
Expand Down
3 changes: 1 addition & 2 deletions app/[locale]/statement/set/page.test.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { afterEach, beforeEach, describe, expect, it, test } from 'vitest'
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react'
import { Provider } from 'react-redux'
import Page from './page'
import { makeStore } from '@/lib/store'
import { vi } from 'vitest'
import { EnhancedStore } from '@reduxjs/toolkit'
import mockRouter from 'next-router-mock'
import { selectSignedStatement } from '@/lib/features/statement/statementSlice'

describe('Set Signed Statment', async () => {
let store: EnhancedStore
Expand Down
2 changes: 1 addition & 1 deletion app/components/TextFieldWithValidation.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ErrorMessage, Label, RequiredMarker, TextInput } from "@trussworks/react-uswds"
import { ErrorMessage, Label, TextInput } from "@trussworks/react-uswds"
import React, { FocusEventHandler } from "react"

type Args = {
Expand Down
2 changes: 1 addition & 1 deletion lib/actions.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { Action, createAction } from "@reduxjs/toolkit";
import { createAction } from "@reduxjs/toolkit";

export const setInitialStateAction = createAction<{}>('SET_INITIAL_STATE')
2 changes: 1 addition & 1 deletion lib/hooks.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useDispatch, useSelector, useStore } from "react-redux"
import { useDispatch, useSelector } from "react-redux"
import type { AppDispatch, RootState } from './store'

export const useAppDispatch = useDispatch.withTypes<AppDispatch>()
Expand Down
2 changes: 1 addition & 1 deletion lib/store.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Action, ConfigureStoreOptions, Store, combineReducers, configureStore } from "@reduxjs/toolkit";
import { Action, combineReducers, configureStore } from "@reduxjs/toolkit";
import incomeReducer, { selectIncomeTotal } from './features/ledger/income/incomeSlice'
import expenseReducer, { selectExpenseTotal } from './features/ledger/expenses/expensesSlice'
import statementReducer from './features/statement/statementSlice'
Expand Down
33 changes: 33 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"eslint": "^8",
"eslint-config-next": "14.2.3",
"eslint-plugin-i18next": "^6.0.3",
"eslint-plugin-unused-imports": "^3.2.0",
"jsdom": "^24.1.0",
"pa11y-ci": "^3.1.0",
"typescript": "^5",
Expand Down

0 comments on commit 1d8c338

Please sign in to comment.