diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 82e18bc..5a7526e 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -5,12 +5,19 @@ module.exports = { "plugin:@typescript-eslint/recommended", "plugin:react-hooks/recommended", "standard-with-typescript", - "plugin:prettier/recommended", + "plugin:prettier/recommended" ], parser: "@typescript-eslint/parser", - parserOptions: { ecmaVersion: "latest", sourceType: "module", project: "./tsconfig.json" }, + parserOptions: { + ecmaVersion: "latest", + sourceType: "module", + project: "./tsconfig.json" + }, plugins: ["react-refresh"], rules: { - "react-refresh/only-export-components": "warn" + "react-refresh/only-export-components": "warn", + "@typescript-eslint/explicit-function-return-type": "off", + "@typescript-eslint/restrict-template-expressions": "off", + "@typescript-eslint/strict-boolean-expressions": "off" } }; diff --git a/src/components/BarChart.tsx b/src/components/BarChart.tsx index d2c98af..a106e09 100644 --- a/src/components/BarChart.tsx +++ b/src/components/BarChart.tsx @@ -7,7 +7,7 @@ import TotalCount from "./TotalCount"; import TimeRangeButton from "./TimeRangeButton"; import { ChartTooltipContent } from "./ChartTooltipContent"; import { barChartOption } from "../utils"; -import { BarData, GraphData } from "../types"; +import { type BarData, type GraphData } from "../types"; interface Props { graphData: GraphData; diff --git a/src/components/ChartTooltipContent.tsx b/src/components/ChartTooltipContent.tsx index a90075a..4bfb42b 100644 --- a/src/components/ChartTooltipContent.tsx +++ b/src/components/ChartTooltipContent.tsx @@ -1,5 +1,5 @@ import { METRICS_TOOLTIP_INFO } from "../constants"; -import { ChartKey } from "../types"; +import { type ChartKey } from "../types"; import Square from "./Square"; interface Props { diff --git a/src/components/TimeRangeButton.tsx b/src/components/TimeRangeButton.tsx index e74343c..5a444b8 100644 --- a/src/components/TimeRangeButton.tsx +++ b/src/components/TimeRangeButton.tsx @@ -7,13 +7,15 @@ interface Props { const TimeRangeButton = ({ tab, setTab, changeTab }: Props) => { return ( ); }; diff --git a/src/components/TotalCount.tsx b/src/components/TotalCount.tsx index 215facc..09a225f 100644 --- a/src/components/TotalCount.tsx +++ b/src/components/TotalCount.tsx @@ -12,7 +12,7 @@ const TotalCount = ({ data, n, bgColor, title }: Props) => { return (
- {title || "Total count : "} + {title ?? "Total count : "} {calculateTotalLastNDays(data, n)}
); diff --git a/src/routes/Blockchain.tsx b/src/routes/Blockchain.tsx index 46ad0f2..8ce265f 100644 --- a/src/routes/Blockchain.tsx +++ b/src/routes/Blockchain.tsx @@ -1,6 +1,6 @@ import BarChart from "../components/BarChart"; import ChaartSkeletonWrapper from "../components/ChartSkeleton"; -import { GraphData, ChartKey } from "../types"; +import { type GraphData, ChartKey } from "../types"; import useSentryData from "../hooks/useSentryData"; const Blockchain = () => { diff --git a/src/routes/User.tsx b/src/routes/User.tsx index 88e6dc6..dd55cd1 100644 --- a/src/routes/User.tsx +++ b/src/routes/User.tsx @@ -1,5 +1,5 @@ import BarChart from "../components/BarChart"; -import { GraphData, ChartKey } from "../types"; +import { type GraphData, ChartKey } from "../types"; import ChaartSkeletonWrapper from "../components/ChartSkeleton"; import useSentryData from "../hooks/useSentryData"; diff --git a/src/types.ts b/src/types.ts index 93cfa21..4310018 100644 --- a/src/types.ts +++ b/src/types.ts @@ -9,15 +9,13 @@ export enum SentryDataTypes { SigningStats = "tx" } -export type ChartDataResponse = { - [key: string]: Record; -}; +export type ChartDataResponse = Record>; -export type BarData = { +export interface BarData { day: string; positive: number; negative: number; -}; +} export enum ChartKey { Propose = "propose", @@ -28,8 +26,8 @@ export enum ChartKey { Bugs = "bugs" } -export type GraphData = { +export interface GraphData { title: ChartKey; success: Record; failure: Record; -}; +} diff --git a/src/utils.ts b/src/utils.ts index eb1bf97..46c5f84 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,4 +1,4 @@ -import { BarData, SentryDataTypes } from "./types"; +import { type BarData, type SentryDataTypes } from "./types"; import { config } from "./config"; export const formatSentryURL = (period: string, type: SentryDataTypes) => { diff --git a/tsconfig.json b/tsconfig.json index c81ef9f..4e24d38 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -19,6 +19,6 @@ "noUnusedParameters": true, "noFallthroughCasesInSwitch": true }, - "include": ["src"], + "include": ["src", "./.eslintrc.cjs"], "references": [{ "path": "./tsconfig.node.json" }] }