Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup formatting with prettier #32

Merged
merged 9 commits into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
585 changes: 0 additions & 585 deletions .editorconfig

This file was deleted.

7 changes: 5 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"extends": "next/core-web-vitals"
}
"extends": [
"next/core-web-vitals",
"plugin:prettier/recommended"
]
}
24 changes: 24 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: "ESLint check"
on: [pull_request]

jobs:
eslint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 20.11.0

- uses: actions/cache@v2
with:
path: "**/node_modules"
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}

- name: Install modules
run: npm install

- name: Lint
run: npm run lint
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run lint
51 changes: 27 additions & 24 deletions app/(api)/api/proposals/[id]/route.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {NextRequest} from "next/server";
import IProposal, {ProposalStatus} from "@interfaces/proposal.interface";
import { NextRequest } from "next/server";
import IProposal, { ProposalStatus } from "@interfaces/proposal.interface";
import addDays from "date-fns/addDays";

const proposalDescription = `This is an amended draft proposal by the RARI Foundation, addressing community feedback.
Expand Down Expand Up @@ -99,32 +99,35 @@ Payment terms:

The 100,000 USD amount is payable in ARB under the exchange rate on the day of the proposal submission. As of Sept 13, the rate is 1 ARB = $0.785339, which translates to 127,351 ARB.

Note that the Rari Foundation will absorb costs related to the service and maintainance of the Protocol upkeep after the integration implementation.`
Note that the Rari Foundation will absorb costs related to the service and maintainance of the Protocol upkeep after the integration implementation.`;

const singleProposal: IProposal = {
id: '599ca521-df39-442f-937c-03b20bcafc2d',
title: 'Building the Building the Future of NFTs: The Rarible Protocol',
description: proposalDescription,
status: ProposalStatus.active,
votesYes: 2700,
votesNo: 1400,
votesTotal: 4100,
createdAt: addDays(new Date(), Math.round(Math.random() * 10) * -1),
deadlineAt: addDays(new Date(), Math.round(Math.random() * 10)),
creator: 'Andrzej'
}
id: "599ca521-df39-442f-937c-03b20bcafc2d",
title: "Building the Building the Future of NFTs: The Rarible Protocol",
description: proposalDescription,
status: ProposalStatus.active,
votesYes: 2700,
votesNo: 1400,
votesTotal: 4100,
createdAt: addDays(new Date(), Math.round(Math.random() * 10) * -1),
deadlineAt: addDays(new Date(), Math.round(Math.random() * 10)),
creator: "Andrzej",
};

interface GetMethodContext {
params: {
id: string;
}
params: {
id: string;
};
}

export async function GET(req: NextRequest, { params: { id } }: GetMethodContext) {
const data = {
...singleProposal,
id
}
export async function GET(
req: NextRequest,
{ params: { id } }: GetMethodContext,
) {
const data = {
...singleProposal,
id,
};

return Response.json(data);
}
return Response.json(data);
}
33 changes: 18 additions & 15 deletions app/(api)/api/proposals/[id]/votes/[type]/route.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
import {NextRequest} from "next/server";
import {IVoteType} from "@interfaces/vote.interface";
import { NextRequest } from "next/server";
import { IVoteType } from "@interfaces/vote.interface";

interface PutMethodContext {
params: {
id: string;
type: IVoteType;
}
params: {
id: string;
type: IVoteType;
};
}

export async function PUT(req: NextRequest, { params: { type, id } }: PutMethodContext) {
const body = await req.json();
export async function PUT(
req: NextRequest,
{ params: { type, id } }: PutMethodContext,
) {
const body = await req.json();

const data = {
id,
type,
...body
};
const data = {
id,
type,
...body,
};

return Response.json(data);
}
return Response.json(data);
}
Loading
Loading