Skip to content

Commit

Permalink
Add disable rules for older files
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonMHasperhoven committed Sep 10, 2024
1 parent 3ff3855 commit ca29d8d
Show file tree
Hide file tree
Showing 60 changed files with 676 additions and 570 deletions.
32 changes: 16 additions & 16 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import eslintConfig from "configs/eslint";
import { FlatCompat } from "@eslint/eslintrc";
import { fileURLToPath } from "url";
import path from "path";
import tmpExcludes from "./tmp-lint-excludes.js";
import tseslint from "typescript-eslint";
import eslintConfig from 'configs/eslint';
import { FlatCompat } from '@eslint/eslintrc';
import { fileURLToPath } from 'url';
import path from 'path';
import tmpExcludes from './tmp-lint-excludes.js';
import tseslint from 'typescript-eslint';

// mimic CommonJS variables -- not needed if using CommonJS
const __filename = fileURLToPath(import.meta.url);
Expand All @@ -13,22 +13,22 @@ const compat = new FlatCompat({
baseDirectory: __dirname,
});

const excludePlugins = eslintConfig.flatMap((config) =>
Object.keys(config.plugins || {}),
);
const excludePlugins = eslintConfig.flatMap(config => Object.keys(config.plugins || {}));

export default [
...compat
.extends("next/core-web-vitals")
.filter((config) =>
Object.keys(config.plugins || {}).every(
(plugin) => !excludePlugins.includes(plugin),
),
.extends('next/core-web-vitals')
.filter(config =>
Object.keys(config.plugins || {}).every(plugin => !excludePlugins.includes(plugin)),
),

...eslintConfig.filter((config) => config.name !== "custom:turbo-config"),
...eslintConfig.filter(config => config.name !== 'custom:turbo-config'),

{
ignores: tmpExcludes,
name: 'tmp-ignore-ts',
rules: {
'@typescript-eslint/ban-ts-comment': 'off',
},
// ignores: tmpExcludes,
},
];
11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
"build": "next build",
"dev": "next dev",
"start": "next start",
"prelint": "node tsconfig.generator.js",
"pre:typecheck": "node tsconfig.generator.js",
"typecheck": "pnpm pre:typecheck && tsc --noEmit",
"lint": "eslint src",
"lint:fix": "eslint src --fix",
"lint:strict": "pnpm prelint && tsc --noEmit && eslint src --max-warnings 0",
"lint:strict2": "pnpm prelint && tsc --noEmit && eslint src --max-warnings 0"
"lint:strict": "pnpm typecheck && pnpm lint --max-warnings 0",
"lint:strict2": "pnpm typecheck && pnpm lint --max-warnings 0"
},
"dependencies": {
"@bufbuild/protobuf": "^1.10.0",
Expand Down Expand Up @@ -46,6 +47,7 @@
"chartjs-plugin-annotation": "^3.0.1",
"chartjs-plugin-zoom": "^2.0.1",
"configs": "https://github.com/prax-wallet/configs.git#main",
"date-fns": "^3.6.0",
"echarts": "^5.5.1",
"echarts-for-react": "^3.0.2",
"framer-motion": "^11.3.31",
Expand All @@ -67,8 +69,11 @@
"@babel/preset-env": "^7.25.4",
"@babel/preset-react": "^7.24.7",
"@babel/preset-typescript": "^7.24.7",
"@chakra-ui/react-types": "^2.0.6",
"@eslint/js": "^9.10.0",
"@types/date-fns": "^2.6.0",
"@types/lodash": "^4.17.7",
"@types/node": "^22.5.4",
"@types/pg": "^8.11.8",
"@types/react": "^18.3.5",
"@types/react-dom": "^18.3.0",
Expand Down
781 changes: 407 additions & 374 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions scripts/disable-lint-for-tmp-excludes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import fs from 'fs';
import path from 'path';
import tmpExcludes from '../tmp-lint-excludes.js';

// Array of file paths to process
const filePaths = tmpExcludes.map(filepath => filepath);

// The ESLint comment to be added
const eslintComment =
'// @ts-nocheck\n/* eslint-disable -- disabling this file as this was created before our strict rules */\n';

filePaths.forEach(filePath => {
// Read the file
fs.readFile(filePath, 'utf8', (err, data) => {
console.log('TCL: err', err);
console.log('TCL: data', data);
// Check if the first line is already the ESLint comment
const firstLine = data.split('\n')[0].trim();
if (firstLine === eslintComment.trim()) {
return;
}

// Prepend the ESLint comment
const updatedData = eslintComment + data;

// Write the updated file back to the filesystem
fs.writeFile(filePath, updatedData, 'utf8', () => {
// eslint-disable-next-line no-console -- log
console.log(`ESLint comment added to ${filePath}`);
});
});
});
2 changes: 2 additions & 0 deletions src/components/blockTimestamp.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @ts-nocheck
/* eslint-disable -- disabling this file as this was created before our strict rules */
import React, { FC } from "react";
import { HStack , Text } from "@chakra-ui/react";

Expand Down
2 changes: 2 additions & 0 deletions src/components/blocks/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @ts-nocheck
/* eslint-disable -- disabling this file as this was created before our strict rules */
// pages/trades.tsx

import {
Expand Down
2 changes: 2 additions & 0 deletions src/components/charts/buySellChart.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @ts-nocheck
/* eslint-disable -- disabling this file as this was created before our strict rules */
import React, { useRef, useEffect } from "react";
import { Box, HStack, Spacer, Text, VStack } from "@chakra-ui/react";
import { Position } from "@penumbra-zone/protobuf/penumbra/core/component/dex/v1/dex_pb";
Expand Down
2 changes: 2 additions & 0 deletions src/components/charts/depthChart.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @ts-nocheck
/* eslint-disable -- disabling this file as this was created before our strict rules */
// src/components/charts/depthChart.tsx

import React, { useRef, useEffect, useState } from "react";
Expand Down
2 changes: 2 additions & 0 deletions src/components/charts/ohlcChart.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @ts-nocheck
/* eslint-disable -- disabling this file as this was created before our strict rules */
// src/components/charts/ohlcChart.tsx

import React, { useEffect, useState } from "react";
Expand Down
2 changes: 2 additions & 0 deletions src/components/copiedTx.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @ts-nocheck
/* eslint-disable -- disabling this file as this was created before our strict rules */
import React, { FC, useState } from "react";
import { CopyIcon } from "@radix-ui/react-icons";
import { HStack } from "@chakra-ui/react";
Expand Down
2 changes: 2 additions & 0 deletions src/components/executionHistory/blockDetails.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @ts-nocheck
/* eslint-disable -- disabling this file as this was created before our strict rules */
import { BlockSummaryData } from "@/utils/types/block";
import { VStack, Text } from "@chakra-ui/react";

Expand Down
2 changes: 2 additions & 0 deletions src/components/executionHistory/blockSummary.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @ts-nocheck
/* eslint-disable -- disabling this file as this was created before our strict rules */
import { Box, HStack, Flex, Text } from "@chakra-ui/react";
import BlockTimestampView from "../blockTimestamp";
import { BlockDetails } from "./blockDetails";
Expand Down
2 changes: 2 additions & 0 deletions src/components/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @ts-nocheck
/* eslint-disable -- disabling this file as this was created before our strict rules */
// components/Layout.js

import Head from "next/head";
Expand Down
2 changes: 2 additions & 0 deletions src/components/liquidityPositions/closedStatus.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @ts-nocheck
/* eslint-disable -- disabling this file as this was created before our strict rules */
import React from "react";
import {
VStack,
Expand Down
2 changes: 2 additions & 0 deletions src/components/liquidityPositions/currentStatus.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @ts-nocheck
/* eslint-disable -- disabling this file as this was created before our strict rules */
import React, { useEffect, useState } from "react";
import { VStack, Text, Badge, HStack, Image, Avatar } from "@chakra-ui/react";
import {
Expand Down
2 changes: 2 additions & 0 deletions src/components/liquidityPositions/executionEvent.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @ts-nocheck
/* eslint-disable -- disabling this file as this was created before our strict rules */
import React, { useEffect, useState } from "react";
import {
Box,
Expand Down
2 changes: 2 additions & 0 deletions src/components/liquidityPositions/openStatus.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @ts-nocheck
/* eslint-disable -- disabling this file as this was created before our strict rules */
import React, { useEffect, useState } from "react";
import {
Box,
Expand Down
2 changes: 2 additions & 0 deletions src/components/liquidityPositions/timelinePosition.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @ts-nocheck
/* eslint-disable -- disabling this file as this was created before our strict rules */
import React from "react";
import { Box, HStack, Text, VStack } from "@chakra-ui/react";
import { LiquidityPositionEvent } from "@/utils/indexer/types/lps";
Expand Down
2 changes: 2 additions & 0 deletions src/components/liquidityPositions/withdrawnStatus.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @ts-nocheck
/* eslint-disable -- disabling this file as this was created before our strict rules */
import React from "react";
import {
VStack,
Expand Down
2 changes: 2 additions & 0 deletions src/components/lpAssetView.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @ts-nocheck
/* eslint-disable -- disabling this file as this was created before our strict rules */
import React, { FC, useEffect, useState } from "react";
import { CopyIcon } from "@radix-ui/react-icons";
import { Avatar, HStack, VStack , Text } from "@chakra-ui/react";
Expand Down
2 changes: 2 additions & 0 deletions src/components/lpSearchBar.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @ts-nocheck
/* eslint-disable -- disabling this file as this was created before our strict rules */
// components/lpSearchBar.tsx

import React, { useState } from "react";
Expand Down
2 changes: 2 additions & 0 deletions src/components/navbar.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @ts-nocheck
/* eslint-disable -- disabling this file as this was created before our strict rules */
// components/navbar.tsx

import Image from "next/image";
Expand Down
2 changes: 2 additions & 0 deletions src/components/swaps/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @ts-nocheck
/* eslint-disable -- disabling this file as this was created before our strict rules */
import { useEffect, useState } from "react";
import { Price, Trace, TraceType } from "../../pages/block/[block_height]";
import { Box, Heading, HStack, Link, Stack, VStack } from "@chakra-ui/react";
Expand Down
2 changes: 2 additions & 0 deletions src/components/util/loadingSpinner.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @ts-nocheck
/* eslint-disable -- disabling this file as this was created before our strict rules */
import { Center, VStack, Spinner, Text } from "@chakra-ui/react";

export const LoadingSpinner = () => {
Expand Down
2 changes: 2 additions & 0 deletions src/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @ts-nocheck
/* eslint-disable -- disabling this file as this was created before our strict rules */
import type { AppProps } from "next/app";
import React from "react";
import "@/global.css";
Expand Down
51 changes: 24 additions & 27 deletions src/pages/api/arbs/[...params].ts
Original file line number Diff line number Diff line change
@@ -1,39 +1,36 @@
// pages/api/arbs/[...params].ts

import { DexQueryServiceClient } from "@/utils/protos/services/dex/dex-query-service-client";
import { SwapExecutionWithBlockHeight } from "@/utils/protos/types/DexQueryServiceClientInterface";
import { NextApiRequest, NextApiResponse } from "next";
import { DexQueryServiceClient } from '@/utils/protos/services/dex/dex-query-service-client';
import { NextApiRequest, NextApiResponse } from 'next';

const grpcEndpoint = process.env.PENUMBRA_GRPC_ENDPOINT!
const grpcEndpoint = process.env['PENUMBRA_GRPC_ENDPOINT'];
if (!grpcEndpoint) {
throw new Error("PENUMBRA_GRPC_ENDPOINT is not set")
throw new Error('PENUMBRA_GRPC_ENDPOINT is not set');
}

export default async function arbsByBlockRange(req: NextApiRequest, res: NextApiResponse) {
const params = req.query.params as string[];
const params = req.query['params'] as string[];

const startHeight = params[0] || null;
const endHeight = params[1] || null;
const startHeight = params[0] ?? null;
const endHeight = params[1] ?? null;

try {
if (!startHeight || !endHeight) {
res.status(400).json({ error: "Invalid query parameters" }); return;
}
// TODO: validate StartHeight/EndHeight are numbers
const dex_querier = new DexQueryServiceClient({
grpcEndpoint: grpcEndpoint,
});
try {
if (!startHeight || !endHeight) {
res.status(400).json({ error: 'Invalid query parameters' });
return;
}
// TODO: validate StartHeight/EndHeight are numbers
const dex_querier = new DexQueryServiceClient({
grpcEndpoint: grpcEndpoint ?? '',
});

const data = await dex_querier.arbExecutions(
parseInt(startHeight),
parseInt(endHeight)
);
const data = await dex_querier.arbExecutions(parseInt(startHeight), parseInt(endHeight));

res.status(200).json(data as SwapExecutionWithBlockHeight[]);
} catch (error) {
console.error("Error getting liquidty positions by price grpc data:", error);
res.status(500).json({
error: `Error getting liquidty positions by price grpc data: ${error}`,
});
}
res.status(200).json(data ?? null);
} catch (error) {
console.error('Error getting liquidty positions by price grpc data:', error);
res.status(500).json({
error: `Error getting liquidty positions by price grpc data: ${error as string}`,
});
}
}
2 changes: 2 additions & 0 deletions src/pages/api/blockTimestamps/[...params].js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @ts-nocheck
/* eslint-disable -- disabling this file as this was created before our strict rules */
// pages/api/blockTimestamps/[...params].js

import { IndexerQuerier } from "../../../utils/indexer/connector";
Expand Down
2 changes: 2 additions & 0 deletions src/pages/api/blocks/[...params].js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @ts-nocheck
/* eslint-disable -- disabling this file as this was created before our strict rules */
// pages/api/blocks/[...params].js

import { IndexerQuerier } from "../../../utils/indexer/connector";
Expand Down
2 changes: 2 additions & 0 deletions src/pages/api/lp/[lp_nft_id].js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @ts-nocheck
/* eslint-disable -- disabling this file as this was created before our strict rules */
// pages/api/lp/[lp_nft_id].js
import { IndexerQuerier } from "../../../utils/indexer/connector";

Expand Down
2 changes: 2 additions & 0 deletions src/pages/api/lp/[lp_nft_id]/position.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @ts-nocheck
/* eslint-disable -- disabling this file as this was created before our strict rules */
// pages/api/lp/[lp_nft_id]/position.ts
import { DexQueryServiceClient } from "../../../../utils/protos/services/dex/dex-query-service-client";
import {
Expand Down
2 changes: 2 additions & 0 deletions src/pages/api/lp/[lp_nft_id]/trades.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @ts-nocheck
/* eslint-disable -- disabling this file as this was created before our strict rules */
// pages/api/lp/[lp_nft_id]/trades.js
import { IndexerQuerier } from "../../../../utils/indexer/connector";

Expand Down
2 changes: 2 additions & 0 deletions src/pages/api/lp/block/[...params].js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @ts-nocheck
/* eslint-disable -- disabling this file as this was created before our strict rules */
// pages/api/lp/positionsByBlockHeight/[...params].js
import { IndexerQuerier } from "../../../../utils/indexer/connector";

Expand Down
2 changes: 2 additions & 0 deletions src/pages/api/lp/positionsByPrice/[...params].ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @ts-nocheck
/* eslint-disable -- disabling this file as this was created before our strict rules */
// pages/api/lp/positionsByPrice/[...params].ts
import { NextApiRequest, NextApiResponse } from "next";
import { DexQueryServiceClient } from "@/utils/protos/services/dex/dex-query-service-client";
Expand Down
2 changes: 2 additions & 0 deletions src/pages/api/ohlc/[...params].ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @ts-nocheck
/* eslint-disable -- disabling this file as this was created before our strict rules */
// pages/api/ohlc/[...params].ts

import { DexQueryServiceClient } from "@/utils/protos/services/dex/dex-query-service-client";
Expand Down
2 changes: 2 additions & 0 deletions src/pages/api/shieldedPool/[token_inner].ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @ts-nocheck
/* eslint-disable -- disabling this file as this was created before our strict rules */
// pages/api/shieldedPool/[token_inner].ts
import { ShieldedPoolQuerier } from "../../../utils/protos/services/app/shielded-pool";
import { base64ToUint8Array } from "../../../utils/math/base64";
Expand Down
2 changes: 2 additions & 0 deletions src/pages/api/simulations/[...params].ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @ts-nocheck
/* eslint-disable -- disabling this file as this was created before our strict rules */
// pages/api/simulations/[...params].ts
import { SimulationQuerier } from "@/utils/protos/services/dex/simulated-trades";
import { base64ToUint8Array } from "../../../utils/math/base64";
Expand Down
2 changes: 2 additions & 0 deletions src/pages/api/swaps/[...params].ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @ts-nocheck
/* eslint-disable -- disabling this file as this was created before our strict rules */
// pages/api/swaps/[...params].ts

import { DexQueryServiceClient } from "@/utils/protos/services/dex/dex-query-service-client";
Expand Down
2 changes: 2 additions & 0 deletions src/pages/block/[block_height].tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @ts-nocheck
/* eslint-disable -- disabling this file as this was created before our strict rules */
import Layout from "@/components/layout";
import { useRouter } from "next/router";
import {
Expand Down
2 changes: 2 additions & 0 deletions src/pages/explorer/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @ts-nocheck
/* eslint-disable -- disabling this file as this was created before our strict rules */
import { Box, Flex, Text } from "@chakra-ui/react";
import Layout from "../../components/layout";
import { LPSearchBar } from "../../components/lpSearchBar";
Expand Down
2 changes: 2 additions & 0 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @ts-nocheck
/* eslint-disable -- disabling this file as this was created before our strict rules */
import styles from "@/Home.module.css";
import Layout from "../components/layout";
import { useEffect, useState } from "react";
Expand Down
2 changes: 2 additions & 0 deletions src/pages/lp/[lp_nft_id].tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @ts-nocheck
/* eslint-disable -- disabling this file as this was created before our strict rules */
// pages/lp/[lp_nft_id].js

import React, { useEffect, useRef, useState } from "react";
Expand Down
Loading

0 comments on commit ca29d8d

Please sign in to comment.