diff --git a/.eslintrc.json b/.eslintrc.json index 97d6b58b..fde573b7 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,10 +1,61 @@ { + "plugins": [ + "@typescript-eslint" + ], "extends": [ "next/core-web-vitals", - "plugin:prettier/recommended" + "plugin:prettier/recommended", + "eslint:recommended", + "plugin:@typescript-eslint/eslint-recommended", + "plugin:@typescript-eslint/recommended" ], "rules": { "prettier/prettier": ["error",{ - "endOfLine": "auto"}] - } + "endOfLine": "auto"}], + "@typescript-eslint/array-type": "off", + "@typescript-eslint/ban-ts-comment": "off", + "@typescript-eslint/ban-tslint-comment": "off", + "@typescript-eslint/ban-types": "off", + "@typescript-eslint/class-literal-property-style": "off", + "@typescript-eslint/consistent-generic-constructors": "off", + "@typescript-eslint/consistent-indexed-object-style": "off", + "@typescript-eslint/consistent-type-definitions": "off", + "@typescript-eslint/no-empty-function": "off", + "@typescript-eslint/no-namespace": "off", + "@typescript-eslint/no-shadow": "off", + "@typescript-eslint/no-empty-interface": "off", + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/no-inferrable-types": "off", + "@typescript-eslint/no-var-requires": "off", + "@typescript-eslint/prefer-for-of": "off", + "@typescript-eslint/prefer-function-type": "off", + "@typescript-eslint/no-this-alias": "off", + "@typescript-eslint/triple-slash-reference": "off", + "no-var": "off", + "prefer-const": "off", + "prefer-rest-params": "off", + "prefer-spread": "off", + "no-unused-expressions": "off", + "@typescript-eslint/no-unused-expressions": [ + "error", + { + "allowShortCircuit": true, + "allowTernary": true, + "allowTaggedTemplates": true + } + ], + "no-unused-vars": "off", + "@typescript-eslint/no-unused-vars": [ + "warn", + { + "args": "none", + "ignoreRestSiblings": true + } + ], + "no-use-before-define": "off", + "no-useless-constructor": "off", + "@typescript-eslint/no-use-before-define": "off", + "@typescript-eslint/no-useless-constructor": "warn", + "@typescript-eslint/prefer-literal-enum-member": "error" + } } \ No newline at end of file diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 408245ae..78722dfd 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -11,14 +11,18 @@ jobs: uses: actions/setup-node@v2 with: node-version: 20.11.0 + - name: Setup pnpm + uses: pnpm/action-setup@v3 + with: + version: 8 - uses: actions/cache@v2 with: path: "**/node_modules" - key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} + key: ${{ runner.os }}-modules-${{ hashFiles('**/pnpm-yarn.lock') }} - name: Install modules - run: npm install + run: pnpm install - name: Lint - run: npm run lint + run: pnpm run lint diff --git a/README.md b/README.md index aaced97c..59eca309 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,18 @@ # Mento Governance UI - + ## Description - + This is the UI repo for Mento Governance. - + ## Table of Contents - + - [Prerequisites](#prerequisites) - [Installation](#installation) - [Usage](#usage) - [Project Spec](#project-spec) - + ## Prerequisites - [node.js](https://nodejs.org/en) >= 20.11.0 @@ -24,43 +24,43 @@ This is the UI repo for Mento Governance. ```bash pnpm install && cp .env .env.local ``` - + ## Usage - + ```bash pnpm dev ``` ## Project spec -Please refer to our [spec documents by clicking here.](./docs/introduction.md) - +Please refer to our [spec documents by clicking here.](./docs/index.md) + - + - + - + \ No newline at end of file + +Go the extra mile and write tests for your application. Then provide examples on how to run them here. --> diff --git a/app/(routes)/create-proposal/page.tsx b/app/(routes)/create-proposal/page.tsx deleted file mode 100644 index 4758cc13..00000000 --- a/app/(routes)/create-proposal/page.tsx +++ /dev/null @@ -1,32 +0,0 @@ -"use client"; -import styles from "./page.module.scss"; -import { - CreateProposalExecutionStep, - CreateProposalContentStep, - CreateProposalWalletStep, - CreateProposalPreviewStep, -} from "@components/create-proposal"; -import { useEffect } from "react"; -import { useCreateProposalStore } from "@/app/store"; - -const Page = () => { - const { reset } = useCreateProposalStore(); - - useEffect(() => { - reset(); - }, [reset]); - - return ( -
-

Create a Proposal

-
- - - - -
-
- ); -}; - -export default Page; diff --git a/app/components/create-proposal/create-proposal-execution-step/create-proposal-execution-step.component.tsx b/app/components/create-proposal/create-proposal-execution-step/create-proposal-execution-step.component.tsx deleted file mode 100644 index d3793405..00000000 --- a/app/components/create-proposal/create-proposal-execution-step/create-proposal-execution-step.component.tsx +++ /dev/null @@ -1,66 +0,0 @@ -"use client"; -import Wrapper from "@components/create-proposal/wrapper/wrapper.component"; -import { yupResolver } from "@hookform/resolvers/yup"; -import { CreateProposalFormStepEnum } from "@interfaces/create-proposal.interface"; -import { useForm } from "react-hook-form"; -import { InferType, object, setLocale, string } from "yup"; -import { Textarea } from "@components/_shared"; -import { useCreateProposalStore } from "@/app/store"; -import { useEffect } from "react"; - -const validationSchema = object({ - code: string().required().typeError("Invalid code"), -}); - -type FormData = InferType; - -const formStep = CreateProposalFormStepEnum.execution; - -export const CreateProposalExecutionStep = () => { - const { patchExecutionStep } = useCreateProposalStore(); - - const { - register, - watch, - setValue, - getValues, - handleSubmit, - formState: { errors, isValid }, - } = useForm({ - resolver: yupResolver(validationSchema), - mode: "onChange", - }); - - setLocale({ - mixed: { - default: "Value is required", - }, - }); - - useEffect(() => { - const subscription = watch((value) => { - patchExecutionStep({ - code: value.code || "", - }); - }); - return () => subscription.unsubscribe(); - }, [watch, patchExecutionStep]); - - return ( - -
-

- Paste your governance proposal’s execution code in the json format in - the field below: -

-