diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..f4f079f --- /dev/null +++ b/.eslintignore @@ -0,0 +1,5 @@ +node_modules +.yarn +.next +yarn.lock +package-lock.json diff --git a/.eslintrc.json b/.eslintrc.json index 00a1ed6..0993a5c 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,7 +1,9 @@ { - "extends": "next/core-web-vitals", - "rules": { + "extends": ["next/core-web-vitals", "plugin:prettier/recommended"], + "rules": { "react/no-unescaped-entities": 0, - "@next/next/no-img-element": 0 - } + "@next/next/no-img-element": 0, + "prettier/prettier": "error" + }, + "plugins": ["prettier"] } diff --git a/.github/workflows/types.yml b/.github/workflows/types.yml new file mode 100644 index 0000000..e02bf07 --- /dev/null +++ b/.github/workflows/types.yml @@ -0,0 +1,42 @@ +name: Lint, Format, and Type Check + +on: + push: + branches: + - '**' + pull_request: + branches: + - '**' + +jobs: + lint-and-format: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: '21' + + - name: Install dependencies + run: npm install + + - name: Run ESLint + run: npm run lint --fix + + - name: Run Prettier + run: npm run format + + - name: Run Type Check + run: npm run type-check + + - name: Commit and Push Changes + run: | + git config --local user.name "github-actions[bot]" + git config --local user.email "github-actions[bot]@users.noreply.github.com" + git add . + git commit -m "Prettier Format & ESLint" || echo "No changes to commit" + git push origin ${{ github.ref }} diff --git a/.gitignore b/.gitignore index 82708bd..43e94b2 100644 --- a/.gitignore +++ b/.gitignore @@ -5,12 +5,12 @@ /.pnp .pnp.js .yarn/install-state.gz +/.yarn # testing /coverage # next.js -.yarn /.next/ /out/ @@ -28,6 +28,10 @@ yarn-error.log* # local env files .env*.local +.env +.env.production +.env.local +.env.development # vercel .vercel @@ -35,5 +39,3 @@ yarn-error.log* # typescript *.tsbuildinfo next-env.d.ts - -.env \ No newline at end of file diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..f4f079f --- /dev/null +++ b/.prettierignore @@ -0,0 +1,5 @@ +node_modules +.yarn +.next +yarn.lock +package-lock.json diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..9e4c08a --- /dev/null +++ b/.prettierrc @@ -0,0 +1,5 @@ +{ + "semi": true, + "singleQuote": true, + "trailingComma": "all" +} diff --git a/.vscode/settings.json b/.vscode/settings.json index 3662b37..25fa621 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,3 @@ { "typescript.tsdk": "node_modules/typescript/lib" -} \ No newline at end of file +} diff --git a/README.md b/README.md index 6abc161..c403366 100644 --- a/README.md +++ b/README.md @@ -34,4 +34,3 @@ You can check out [the Next.js GitHub repository](https://github.com/vercel/next The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. - diff --git a/app/api/downloads/route.ts b/app/api/downloads/route.ts index e0ad555..6955837 100644 --- a/app/api/downloads/route.ts +++ b/app/api/downloads/route.ts @@ -1,26 +1,42 @@ -import { getGitHubDownloads, getModrinthDownloads, getPlanetMCDownloads, getCurseForgeDownloads } from "@/lib/getDownloads"; -import { NextResponse } from "next/server"; +import { + getGitHubDownloads, + getModrinthDownloads, + getPlanetMCDownloads, + getCurseForgeDownloads, +} from '@/lib/getDownloads'; +import { NextResponse } from 'next/server'; export async function GET(request: any) { const [github, modrinth, planetmc, curseforge] = await Promise.all([ getGitHubDownloads(), getModrinthDownloads(), getPlanetMCDownloads(), - getCurseForgeDownloads() + getCurseForgeDownloads(), ]); - if (typeof github === 'number' && typeof modrinth === 'number' && typeof planetmc === 'number' && typeof curseforge === 'number') { + if ( + typeof github === 'number' && + typeof modrinth === 'number' && + typeof planetmc === 'number' && + typeof curseforge === 'number' + ) { const total = github + modrinth + planetmc + curseforge; - return NextResponse.json({ - downloads: { - github, - modrinth, - planetmc, - curseforge, - total, - } - }, { status: 200 }); + return NextResponse.json( + { + downloads: { + github, + modrinth, + planetmc, + curseforge, + total, + }, + }, + { status: 200 }, + ); } else { - return NextResponse.json({ message: "Server-side error during fetching of downloads" }, { status: 500 }); + return NextResponse.json( + { message: 'Server-side error during fetching of downloads' }, + { status: 500 }, + ); } } diff --git a/app/configs/page.tsx b/app/configs/page.tsx index c14842a..cf12fd1 100644 --- a/app/configs/page.tsx +++ b/app/configs/page.tsx @@ -1,11 +1,11 @@ -import { NextAuthProvider } from "@/lib/provider"; -import Configs from "@/components/Sections/configs/Configs"; -import { Metadata } from "next"; -import Link from "next/link"; +import { NextAuthProvider } from '@/lib/provider'; +import Configs from '@/components/Sections/configs/Configs'; +import { Metadata } from 'next'; +import Link from 'next/link'; export const metadata: Metadata = { - title: "ClickCrystals - Configs Explorer", -} + title: 'ClickCrystals - Configs Explorer', +}; export default function ScriptsArchive() { return ( @@ -14,12 +14,19 @@ export default function ScriptsArchive() {

- ClickCrystals Configs Explorer + ClickCrystals{' '} + Configs Explorer

- ClickCrystals Configs are used to import/export and share your ClickCrystals module, HUD and core settings with others. Here are some of our configs and you can also share your config by uploading here! -
- Need to explore scripts? Scripts Archive + ClickCrystals Configs are used to import/export and share your + ClickCrystals module, HUD and core settings with others. Here are + some of our configs and you can also share your config by + uploading here! +
+ Need to explore scripts?{' '} + + Scripts Archive +

diff --git a/app/download/page.tsx b/app/download/page.tsx index ae3e03e..c6daefd 100644 --- a/app/download/page.tsx +++ b/app/download/page.tsx @@ -1,13 +1,12 @@ -import Download from "@/components/Sections/download/download"; -import { Metadata } from "next"; +import Download from '@/components/Sections/download/download'; +import { Metadata } from 'next'; export const metadata: Metadata = { - title: "ClickCrystals - Download", - description: "Download ClickCrystals and experience its whole set of ultimate features. Downloading ClickCrystals is a click-to-go process, so why not do it now?", -} + title: 'ClickCrystals - Download', + description: + 'Download ClickCrystals and experience its whole set of ultimate features. Downloading ClickCrystals is a click-to-go process, so why not do it now?', +}; export default function download() { - return ( - - ) -} \ No newline at end of file + return ; +} diff --git a/app/editor/[id]/page.tsx b/app/editor/[id]/page.tsx index c0aef21..a0f9e6b 100644 --- a/app/editor/[id]/page.tsx +++ b/app/editor/[id]/page.tsx @@ -1,15 +1,15 @@ import { loadCode } from '@/lib/scripts'; import { Metadata } from 'next'; -import dynamic from 'next/dynamic' +import dynamic from 'next/dynamic'; import { redirect } from 'next/navigation'; const CCSEditor = dynamic(() => import('@/components/Sections/editor/Editor'), { ssr: false, -}) +}); export const metadata: Metadata = { - title: "ClickCrystals - CCS Playground", -} + title: 'ClickCrystals - CCS Playground', +}; const EditorPage = async ({ params }: { params: { id: string } }) => { try { @@ -22,13 +22,13 @@ const EditorPage = async ({ params }: { params: { id: string } }) => { - ) + ); } else { - return redirect("/editor?error=not_found") + return redirect('/editor?error=not_found'); } } catch (error: any) { - return redirect("/editor?error=not_found") + return redirect('/editor?error=not_found'); } -} +}; export default EditorPage; diff --git a/app/editor/page.tsx b/app/editor/page.tsx index 542928b..af4a35f 100644 --- a/app/editor/page.tsx +++ b/app/editor/page.tsx @@ -1,13 +1,13 @@ -import { Metadata } from 'next' -import dynamic from 'next/dynamic' +import { Metadata } from 'next'; +import dynamic from 'next/dynamic'; const CCSEditor = dynamic(() => import('@/components/Sections/editor/Editor'), { ssr: false, -}) +}); export const metadata: Metadata = { - title: "ClickCrystals - CCS Playground", -} + title: 'ClickCrystals - CCS Playground', +}; export default function EditorPage() { return ( @@ -16,5 +16,5 @@ export default function EditorPage() { - ) + ); } diff --git a/app/fonts.ts b/app/fonts.ts index 03610ce..f3c94ce 100644 --- a/app/fonts.ts +++ b/app/fonts.ts @@ -3,7 +3,10 @@ // export const inter = DM_Sans({ subsets: ["latin"], weight: '400' }); // export const interHeading = Sofia_Sans_Condensed({ subsets: ["latin"], weight: '400' }); -import localFont from "next/font/local"; +import localFont from 'next/font/local'; -export const inter = localFont({ src: "../public/inter.woff2" }); -export const interHeading = localFont({ src: "../public/interheading.woff2", variable: "--font-heading" }); +export const inter = localFont({ src: '../public/inter.woff2' }); +export const interHeading = localFont({ + src: '../public/interheading.woff2', + variable: '--font-heading', +}); diff --git a/app/gallery/page.tsx b/app/gallery/page.tsx index 78c7dce..ce6a5b7 100644 --- a/app/gallery/page.tsx +++ b/app/gallery/page.tsx @@ -1,13 +1,11 @@ -import { Metadata } from "next"; +import { Metadata } from 'next'; export const metadata: Metadata = { - title: "ClickCrystals - Gallery", -} + title: 'ClickCrystals - Gallery', +}; -import Gallery from "@/components/Sections/gallery/Gallery"; +import Gallery from '@/components/Sections/gallery/Gallery'; export default function GalleryPage() { - return ( - - ) -} \ No newline at end of file + return ; +} diff --git a/app/get/page.ts b/app/get/page.ts index 326a5f2..92d504c 100644 --- a/app/get/page.ts +++ b/app/get/page.ts @@ -1,11 +1,12 @@ -import { Metadata } from "next"; -import { getLatestLink } from "@/lib/getLatest"; -import { redirect } from "next/navigation"; +import { Metadata } from 'next'; +import { getLatestLink } from '@/lib/getLatest'; +import { redirect } from 'next/navigation'; const metadata: Metadata = { - title: "ClickCrystals - Get", - description: "Instantly download ClickCrystals's latest version for the latest supported minecraft!" -} + title: 'ClickCrystals - Get', + description: + "Instantly download ClickCrystals's latest version for the latest supported minecraft!", +}; export default async function GetClickCrystals() { const link = await getLatestLink(); diff --git a/app/help/page.tsx b/app/help/page.tsx index 06263ca..f47e381 100644 --- a/app/help/page.tsx +++ b/app/help/page.tsx @@ -1,10 +1,10 @@ -import { Metadata } from "next"; +import { Metadata } from 'next'; export const metadata: Metadata = { - title: "ClickCrystals - Help", -} + title: 'ClickCrystals - Help', +}; -import FAQ from "@/components/Sections/faq/FAQ"; +import FAQ from '@/components/Sections/faq/FAQ'; export default function Help() { return ( @@ -17,7 +17,10 @@ export default function Help() {

- Have some questions with ClickCrystals? Read out our FAQs here. Still have a question that is not here? Join our discord server and mention a support staff with your question and they'll get your answer solved on the way! + Have some questions with ClickCrystals? Read out our FAQs here. + Still have a question that is not here? Join our discord server + and mention a support staff with your question and they'll + get your answer solved on the way!

diff --git a/app/layout.tsx b/app/layout.tsx index ceadde6..0bc0c3b 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -1,18 +1,19 @@ -import "@/styles/globals.css"; -import { inter, interHeading } from "./fonts"; -import type { Metadata } from "next"; +import '@/styles/globals.css'; +import { inter, interHeading } from './fonts'; +import type { Metadata } from 'next'; -import Header from "@/components/ui/Nav"; -import Footer from "@/components/ui/Footer"; +import Header from '@/components/ui/Nav'; +import Footer from '@/components/ui/Footer'; // import { ScrollTop } from "@/components/ui/ScrollTop"; -import { cn } from "@/lib/utils"; -import { Toaster } from "@/components/ui/toaster" +import { cn } from '@/lib/utils'; +import { Toaster } from '@/components/ui/toaster'; export const metadata: Metadata = { - title: "ClickCrystals", - description: "Your ultimate crystal PvP assistance, ClickCrystals at your service", - authors: [{'name': "ItziSpyder", 'url': "https://github.com/ItziSpyder"}], - icons: [{'rel': "icon", "url": "/favicon.ico"}] + title: 'ClickCrystals', + description: + 'Your ultimate crystal PvP assistance, ClickCrystals at your service', + authors: [{ name: 'ItziSpyder', url: 'https://github.com/ItziSpyder' }], + icons: [{ rel: 'icon', url: '/favicon.ico' }], }; export default function RootLayout({ @@ -22,11 +23,14 @@ export default function RootLayout({ }>) { return ( - +
- {children} +
{children}