fix eslint config
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"extends": ["next/core-web-vitals", "prettier"],
|
||||
"extends": ["eslint:recommended", "next/core-web-vitals", "prettier"],
|
||||
"settings": {
|
||||
"next": {
|
||||
"rootDir": "./client"
|
||||
"rootDir": "client/"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import "@/styles/globals.css";
|
||||
|
||||
import Header from "@/components/Header";
|
||||
import type { ReactNode } from "react";
|
||||
|
||||
import Footer from "@/components/Footer";
|
||||
import Header from "@/components/Header";
|
||||
import AuthModal from "@/components/auth/AuthModal";
|
||||
|
||||
import ContextProvider from "@/context/ContextProvider";
|
||||
@@ -34,7 +36,7 @@ export const metadata = {
|
||||
metadataBase: new URL(process.env.VERCEL ? "https://ches.su" : "http://localhost:3000")
|
||||
};
|
||||
|
||||
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
||||
export default function RootLayout({ children }: { children: ReactNode }) {
|
||||
return (
|
||||
<html lang="en" className="overflow-x-hidden">
|
||||
<body className="overflow-x-hidden">
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
"use client";
|
||||
|
||||
import type { User } from "@chessu/types";
|
||||
import type { ReactNode } from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
import { fetchSession } from "@/lib/auth";
|
||||
import { SessionContext } from "./session";
|
||||
|
||||
export default function ContextProvider({ children }: { children: React.ReactNode }) {
|
||||
export default function ContextProvider({ children }: { children: ReactNode }) {
|
||||
const [user, setUser] = useState<User | null>({});
|
||||
|
||||
async function getSession() {
|
||||
|
||||
@@ -11,7 +11,9 @@ export const fetchSession = async () => {
|
||||
const user: User = await res.json();
|
||||
return user;
|
||||
}
|
||||
} catch (err) {}
|
||||
} catch (err) {
|
||||
// do nothing
|
||||
}
|
||||
};
|
||||
|
||||
export const setGuestSession = async (name: string) => {
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
],
|
||||
"scripts": {
|
||||
"dev": "concurrently \"npm run dev -w client\" \"npm run dev -w server\"",
|
||||
"lint": "eslint .",
|
||||
"lint-fix": "eslint --fix .",
|
||||
"lint": "eslint . --ignore-path .gitignore",
|
||||
"lint-fix": "eslint --fix . --ignore-path .gitignore",
|
||||
"format": "prettier --write . --ignore-path .gitignore"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -9,11 +9,13 @@ import { db } from "../db/index.js";
|
||||
const PGSession = PGSimple(session);
|
||||
|
||||
declare module "express-session" {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
interface SessionData {
|
||||
user: User;
|
||||
}
|
||||
}
|
||||
declare module "http" {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
interface IncomingMessage {
|
||||
session: Session & {
|
||||
user: User;
|
||||
|
||||
@@ -152,6 +152,7 @@ export async function claimAbandoned(this: Socket, type: "win" | "draw") {
|
||||
activeGames.splice(activeGames.indexOf(game), 1);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
export async function getLatestGame(this: Socket) {
|
||||
const game = activeGames.find((g) => g.code === Array.from(this.rooms)[1]);
|
||||
if (game) this.emit("receivedLatestGame", game);
|
||||
@@ -219,6 +220,7 @@ export async function sendMove(this: Socket, m: { from: string; to: string; prom
|
||||
}
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
export async function joinAsPlayer(this: Socket) {
|
||||
const game = activeGames.find((g) => g.code === Array.from(this.rooms)[1]);
|
||||
if (!game) return;
|
||||
|
||||
Reference in New Issue
Block a user