Skip to content

Commit ea90380

Browse files
committed
fix linting errors
1 parent 7b44e76 commit ea90380

16 files changed

+282
-247
lines changed

.babelrc

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"presets": ["next/babel"],
3+
"plugins": ["jotai/babel/plugin-react-refresh"]
4+
}

.eslintrc.cjs

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module.exports = {
2+
root: true,
3+
env: { browser: true, es2020: true },
4+
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:react-hooks/recommended"],
5+
ignorePatterns: ["dist", ".eslintrc.cjs"],
6+
parser: "@typescript-eslint/parser",
7+
plugins: ["react-refresh"],
8+
rules: {
9+
"@typescript-eslint/no-explicit-any": ["off"],
10+
"react-refresh/only-export-components": ["warn", { allowConstantExport: true }],
11+
},
12+
};

.gitattributes

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto

package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@
3939
"@typescript-eslint/parser": "^6.14.0",
4040
"@vitejs/plugin-react": "^4.2.1",
4141
"babel-plugin-macros": "^3.1.0",
42-
"eslint": "^9.0.0",
43-
"eslint-plugin-react-hooks": "^4.6.0",
44-
"eslint-plugin-react-refresh": "^0.4.6",
42+
"eslint": "^8.56.0",
43+
"eslint-plugin-react-hooks": "^4.6.2",
44+
"eslint-plugin-react-refresh": "^0.4.7",
4545
"sass": "^1.74.1",
46-
"tsx": "^4.7.2",
47-
"typescript": "^5.4.4",
46+
"tsx": "^4.16.0",
47+
"typescript": "^5.5.2",
4848
"vite": "^5.2.8"
4949
}
5050
}

src/app.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ const App = () => {
5252
useEffect(() => {
5353
setOrganizations();
5454
}, []);
55+
5556
// Watch for organization changes
5657
useEffect(() => {
5758
if (!find(organizations, { id: organizationId })) {

src/atoms.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ export const invoiceAtom = atom(
177177
async (get, set, newValues: any) => {
178178
const invoiceId = get(invoiceIdAtom);
179179

180-
let invoice = omit(newValues, "lineItems");
181-
let lineItems = newValues.lineItems;
180+
const invoice = omit(newValues, "lineItems");
181+
const lineItems = newValues.lineItems;
182182

183183
if (!invoiceId) {
184184
// Insert

src/components/invoices/pdf.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ const styles = StyleSheet.create({
8080
/* Table */
8181
table: {
8282
// TODO: Check if can be removed
83-
// @ts-ignore
83+
// @ts-expect-error - "table" is not a valid display value
8484
display: "table",
8585
width: "auto",
8686
// TODO: Check if can be removed
87-
// @ts-ignore
87+
// @ts-expect-error - "none" is not a valid border style
8888
borderStyle: "none",
8989
},
9090
tableRow: {
@@ -164,6 +164,7 @@ const InvoicePDF = ({
164164
}) => {
165165
// TODO: Check if taxRates are needed
166166
if (taxRates) {
167+
console.log("taxRates", taxRates);
167168
}
168169

169170
return (

src/components/invoices/state-select.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const InvoiceStateSelect = ({ invoice }: { invoice: any }) => {
5555
},
5656
}}
5757
>
58-
{/* @ts-ignore */}
58+
{/* @ts-expect-error - TODO: stateColor ts definition */}
5959
<Tag color={stateColor[invoice.state]} style={{ marginInlineEnd: 0, cursor: "pointer" }}>
6060
<Space size={4} style={{ fontSize: 12 }}>
6161
{capitalize(invoice.state)}

src/layouts/base.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export default function BaseLayout() {
3131
const { i18n } = useLingui();
3232
const navigate = useNavigate();
3333

34-
const [_messageApi, contextHolder] = message.useMessage();
34+
const [, contextHolder] = message.useMessage();
3535
const {
3636
token: { colorBgContainer, borderRadiusLG },
3737
} = theme.useToken();

src/routes/clients.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const Clients = () => {
1717
const location = useLocation();
1818
const clients = useAtomValue(clientsAtom);
1919
const setClients = useSetAtom(setClientsAtom);
20-
const [_search, setSearch] = useAtom(searchAtom);
20+
const [, setSearch] = useAtom(searchAtom);
2121

2222
useEffect(() => {
2323
if (location.pathname === "/clients") {

src/routes/invoices/details.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ const InvoiceDetails: React.FC = () => {
7777
const setClients = useSetAtom(setClientsAtom);
7878
const taxRates = useAtomValue(taxRatesAtom);
7979
const setTaxRates = useSetAtom(setTaxRatesAtom);
80-
const [_submitting, setSubmitting] = useState(false);
80+
const [, setSubmitting] = useState(false);
8181

8282
const isNew = id === "new";
8383

@@ -537,7 +537,7 @@ const InvoiceDetails: React.FC = () => {
537537
</Col>
538538
</Row>
539539
</Footer>,
540-
// @ts-ignore
540+
// @ts-expect-error - Footer can be null
541541
document.getElementById("footer")
542542
)}
543543
</Form>

src/routes/invoices/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const Invoices = () => {
4040
const organization = useAtomValue(organizationAtom);
4141
const invoices = useAtomValue(invoicesAtom);
4242
const setInvoices = useSetAtom(setInvoicesAtom);
43-
const [_search, setSearch] = useAtom(searchAtom);
43+
const [, setSearch] = useAtom(searchAtom);
4444

4545
useEffect(() => {
4646
if (location.pathname === "/invoices") {

src/routes/invoices/preview.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ const InvoicePreview: React.FC = () => {
197197
</Col>
198198
</Row>
199199
</Footer>,
200-
// @ts-ignore
200+
// @ts-expect-error - Footer can be null
201201
document.getElementById("footer")
202202
)}
203203
</Col>

src/routes/settings/invoice.tsx

-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { useEffect, useState } from "react";
21
import { Button, Col, Form, Input, InputNumber, Select, Space, Typography, Row, Upload } from "antd";
32
import { atom, useAtom, useSetAtom } from "jotai";
43
import { FileTextOutlined, PictureOutlined, UploadOutlined } from "@ant-design/icons";
@@ -12,7 +11,6 @@ const { Option } = Select;
1211

1312
import { organizationAtom, setOrganizationsAtom } from "src/atoms";
1413
import { currencies, getCurrencySymbol } from "src/utils/currencies";
15-
import { set } from "lodash";
1614

1715
const submittingAtom = atom(false);
1816

@@ -22,8 +20,6 @@ function SettingsInvoice() {
2220
const [organization, setOrganization] = useAtom(organizationAtom);
2321
const [submitting, setSubmitting] = useAtom(submittingAtom);
2422

25-
const [logo, setLogo] = useState(null);
26-
2723
const onSubmit = async (values: object) => {
2824
setSubmitting(true);
2925
setOrganization(values);

src/utils/currencies.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import isNumber from "lodash/isNumber";
22

3-
// @ts-ignore
3+
// @ts-expect-error - Intl supportedValuesOf support?
44
export const currencies = Intl.supportedValuesOf("currency");
55

66
export const getCurrencySymbol = (locale: string, currency: string) => {

0 commit comments

Comments
 (0)