Skip to content

Commit

Permalink
Modify files to match ESLint rules
Browse files Browse the repository at this point in the history
  • Loading branch information
charlykeyko committed Sep 4, 2023
1 parent 734a9e0 commit dc5dce0
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 19 deletions.
13 changes: 10 additions & 3 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
};
2 changes: 1 addition & 1 deletion src/components/BarChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/components/ChartTooltipContent.tsx
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
6 changes: 4 additions & 2 deletions src/components/TimeRangeButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ interface Props {
const TimeRangeButton = ({ tab, setTab, changeTab }: Props) => {
return (
<button
onClick={() => setTab(changeTab)}
onClick={() => {
setTab(changeTab);
}}
className={`text-xs bg-gray-100 px-2 py-1 ${
tab === changeTab &&
"bg-gradient-to-r from-cyan-500 to-blue-500 text-white transition duration-300"
}`}
>
{changeTab + "D"}
{changeTab.toString() + "D"}
</button>
);
};
Expand Down
2 changes: 1 addition & 1 deletion src/components/TotalCount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const TotalCount = ({ data, n, bgColor, title }: Props) => {
return (
<div className="flex items-center text-xs">
<Square bgColor={bgColor} />
{title || "Total count : "}
{title ?? "Total count : "}
{calculateTotalLastNDays(data, n)}
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion src/routes/Blockchain.tsx
Original file line number Diff line number Diff line change
@@ -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 = () => {
Expand Down
2 changes: 1 addition & 1 deletion src/routes/User.tsx
Original file line number Diff line number Diff line change
@@ -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";

Expand Down
12 changes: 5 additions & 7 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,13 @@ export enum SentryDataTypes {
SigningStats = "tx"
}

export type ChartDataResponse = {
[key: string]: Record<string, number>;
};
export type ChartDataResponse = Record<string, Record<string, number>>;

export type BarData = {
export interface BarData {
day: string;
positive: number;
negative: number;
};
}

export enum ChartKey {
Propose = "propose",
Expand All @@ -28,8 +26,8 @@ export enum ChartKey {
Bugs = "bugs"
}

export type GraphData = {
export interface GraphData {
title: ChartKey;
success: Record<string, number>;
failure: Record<string, number>;
};
}
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
@@ -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) => {
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src"],
"include": ["src", "./.eslintrc.cjs"],
"references": [{ "path": "./tsconfig.node.json" }]
}

0 comments on commit dc5dce0

Please sign in to comment.