Skip to content

Commit

Permalink
Fix eslint crashing
Browse files Browse the repository at this point in the history
  • Loading branch information
Corantin committed Jul 11, 2024
1 parent 75ba6eb commit 270af11
Show file tree
Hide file tree
Showing 13 changed files with 352 additions and 42 deletions.
9 changes: 2 additions & 7 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
module.exports = {
root: true,
// This tells ESLint to load the config from the package `eslint-config-custom`
root: true, // This tells ESLint to load the config from the package `eslint-config-custom`
extends: ["custom"],
settings: {
next: {
rootDir: ["apps/*/"],
},
},
settings: { next: { rootDir: ["apps/*/"] } },
};
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@
"editor.formatOnSave": true
},
"solidity.formatter": "forge",
}
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
49 changes: 44 additions & 5 deletions apps/web/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,54 @@
* @type {import('eslint').Linter.Config}
*/
module.exports = {
extends: ["next/core-web-vitals", "turbo", "prettier"],
extends: ["next/core-web-vitals", "turbo", "prettier", "eslint:recommended","plugin:@typescript-eslint/recommended"],
ignorePatterns: ["node_modules", "dist"],
parser: '@typescript-eslint/parser',
parserOptions: {
babelOptions: {
presets: [require.resolve("next/babel")],
},
project: "./tsconfig.json",
},
rules: {
"react-hooks/exhaustive-deps": "off",
"no-html-link-for-pages": "off",
"@next/next/no-html-link-for-pages": "off",
"@typescript-eslint/no-unused-vars": [
"warn",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_",
},
],
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@next/next/no-page-custom-font": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/prefer-nullish-coalescing": "error",
"react/self-closing-comp": [
"error",
{
component: true,
html: true,
},
],
"no-unreachable": "warn",
"no-console": ["warn", {
allow: ["warn", "error", "info", "debug"],
}],
"prefer-const": "off",
"@typescript-eslint/consistent-type-definitions": "off",
"import/order": [
"error",
{
groups: [
"external",
"builtin",
"internal",
"sibling",
"parent",
"index",
],
},
],
curly: "error",
},
};
9 changes: 9 additions & 0 deletions apps/web/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"solidity.packageDefaultDependenciesContractsDirectory": "pkg/contracts/src",
"solidity.packageDefaultDependenciesDirectory": "lib",
"[solidity]": {
"editor.defaultFormatter": "NomicFoundation.hardhat-solidity",
"editor.formatOnSave": true
},
"solidity.formatter": "forge",
}
14 changes: 7 additions & 7 deletions apps/web/app/(app)/gardens/[chain]/[garden]/[community]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
"use client";

import { commImg, groupFlowers } from "@/assets";
import React, { useEffect, useState } from "react";
import { commImg, groupFlowers } from "@/assets";
import Image from "next/image";
import {
Button,
DisplayNumber,
EthAddress,
Statistic,
IncreasePower,
PoolCard,
RegisterMember,
DisplayNumber,
IncreasePower,
Button,
Statistic,
} from "@/components";
import { Address } from "viem";
import {
Expand Down Expand Up @@ -50,7 +50,7 @@ export default function CommunityPage({
{ topic: "member", containerId: communityAddr },
],
});

const { tooltipMessage, isConnected, missmatchUrl } = useDisableButtons();
useEffect(() => {
if (error) {
Expand Down Expand Up @@ -305,7 +305,7 @@ export default function CommunityPage({
covenant ? (
<p>{covenant}</p>
) : (
<LoadingSpinner></LoadingSpinner>
<LoadingSpinner />
)
) : (
<p className="italic">No covenant was submitted.</p>
Expand Down
2 changes: 1 addition & 1 deletion apps/web/app/api/ipfs/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export async function POST(req: NextRequest) {
} catch (error) {
return NextResponse.json(
{ message: "Error uploading json to IPFS" },
{ status: 500 }
{ status: 500 },
);
}
} else if (contentType?.startsWith("multipart/form-data")) {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/components/Communities.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function Communities({
if (!community?.members) {
return false;
}
for (let member of community?.members) {
for (let member of community?.members ?? []) {
if (member?.memberAddress?.toLowerCase() === address?.toLowerCase()) {
return true;
}
Expand Down
6 changes: 3 additions & 3 deletions apps/web/components/EthAddress.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"use client";
import React from "react";
import { Addreth } from "addreth";
import { Address } from "viem";
import { chainDataMap } from "@/configs/chainServer";
import { Addreth } from "addreth";
import LoadingSpinner from "./LoadingSpinner";
import React from "react";
import { chainDataMap } from "@/configs/chainServer";
import useChainFromPath from "@/hooks/useChainFromPath";

type EthAddressProps = {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/hooks/useViemClient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const useViemClient = function () {
const chainFromPath = useChainFromPath();
const chainId = useChainId();
const chain = chainFromPath ?? getChain(chainId);

const [viemClient, setViemClient] = useState<PublicClient>(
createPublicClient({
chain,
Expand Down
11 changes: 7 additions & 4 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@
"@babel/core": "^7.20.12",
"@babel/eslint-parser": "^7.23.3",
"@babel/preset-env": "^7.23.5",
"@eslint/js": "^9.6.0",
"@ianvs/prettier-plugin-sort-imports": "^4.1.1",
"@stylistic/eslint-plugin": "^2.3.0",
"@types/eslint__js": "^8.42.3",
"@types/lodash-es": "^4.17.12",
"@types/node": "^17.0.12",
"@types/react": "^18.0.22",
Expand All @@ -55,10 +58,9 @@
"@wagmi/cli": "1.5.2",
"autoprefixer": "^10.4.16",
"daisyui": "^4.4.20",
"eslint": "^8.55.0",
"eslint-config-custom": "workspace:*",
"eslint": "^8.57.0",
"eslint-config-next": "13.0.0",
"eslint-config-prettier": "^8.3.0",
"eslint-config-prettier": "^8.10.0",
"eslint-plugin-html": "^7.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-prettier": "^5.0.1",
Expand All @@ -70,6 +72,7 @@
"prettier-plugin-tailwindcss": "^0.5.7",
"tailwindcss": "^3.3.6",
"tsconfig": "workspace:*",
"typescript": "5.2"
"typescript": "~5.2.2",
"typescript-eslint": "^7.16.0"
}
}
5 changes: 5 additions & 0 deletions apps/web/prettier.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
/** @type {import("prettier").Config} */
const config = {
plugins: [require.resolve("prettier-plugin-tailwindcss")],
experimentalTernaries: true,
jsxSingleQuote: false,
singleQuote: false,
trailingComma: "all",

};

module.exports = config;
23 changes: 17 additions & 6 deletions apps/web/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"compilerOptions": {
"target": "ES2022",
"lib": ["dom", "dom.iterable", "esnext"],
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
Expand All @@ -19,16 +23,23 @@
}
],
"paths": {
"@/*": ["./*"],
"#/*": ["./../../pkg/*"]
"@/*": [
"./*"
],
"#/*": [
"./../../pkg/*"
]
}
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts",
"prettier.config.js"
"prettier.config.js",
".eslintrc.js",
],
"exclude": ["node_modules"]
}
"exclude": [
"node_modules"
]
}
Loading

0 comments on commit 270af11

Please sign in to comment.