update eslint configs

This commit is contained in:
Nathaniel Tampus
2023-07-27 15:02:34 +08:00
parent a87cf86239
commit 2238038c95
6 changed files with 18 additions and 6 deletions

View File

@@ -2,7 +2,8 @@
"extends": ["eslint:recommended", "next/core-web-vitals", "prettier"], "extends": ["eslint:recommended", "next/core-web-vitals", "prettier"],
"settings": { "settings": {
"next": { "next": {
"rootDir": "client/" "rootDir": "."
}
} }
},
"root": true
} }

View File

@@ -24,6 +24,7 @@
"@types/react-dom": "^18.2.7", "@types/react-dom": "^18.2.7",
"autoprefixer": "^10.4.14", "autoprefixer": "^10.4.14",
"daisyui": "^2.52.0", "daisyui": "^2.52.0",
"eslint-config-next": "^13.4.12",
"postcss": "^8.4.27", "postcss": "^8.4.27",
"tailwindcss": "^3.3.3", "tailwindcss": "^3.3.3",
"typescript": "^5.1.6" "typescript": "^5.1.6"

View File

@@ -17,7 +17,6 @@
"devDependencies": { "devDependencies": {
"concurrently": "^8.2.0", "concurrently": "^8.2.0",
"eslint": "^8.45.0", "eslint": "^8.45.0",
"eslint-config-next": "^13.4.12",
"eslint-config-prettier": "^8.8.0", "eslint-config-prettier": "^8.8.0",
"prettier": "^2.8.8", "prettier": "^2.8.8",
"prettier-plugin-tailwindcss": "^0.4.1" "prettier-plugin-tailwindcss": "^0.4.1"

11
server/.eslintrc Normal file
View File

@@ -0,0 +1,11 @@
{
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/stylistic",
"prettier"
],
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"root": true
}

View File

@@ -1,7 +1,7 @@
import type { Game, User } from "@chessu/types"; import type { Game, User } from "@chessu/types";
import { db } from "../index.js"; import { db } from "../index.js";
export const activeGames: Array<Game> = []; export const activeGames: Game[] = [];
export const save = async (game: Game) => { export const save = async (game: Game) => {
try { try {

View File

@@ -44,7 +44,7 @@ export const findByNameEmail = async (user: User, includePassword = false, limit
`SELECT id, name, email, wins, losses, draws FROM "user" LIMIT $1`, `SELECT id, name, email, wins, losses, draws FROM "user" LIMIT $1`,
[limit ?? 10] [limit ?? 10]
); );
return res.rows as Array<User & { password?: string }>; return res.rows as (User & { password?: string })[];
} catch (err: unknown) { } catch (err: unknown) {
console.log(err); console.log(err);
return null; return null;
@@ -58,7 +58,7 @@ export const findByNameEmail = async (user: User, includePassword = false, limit
} FROM "user" WHERE name=$1 OR email=$2 LIMIT $3`, } FROM "user" WHERE name=$1 OR email=$2 LIMIT $3`,
[user.name, user.email, limit ?? 1] [user.name, user.email, limit ?? 1]
); );
return res.rows as Array<User & { password?: string }>; return res.rows as (User & { password?: string })[];
} catch (err: unknown) { } catch (err: unknown) {
console.log(err); console.log(err);
return null; return null;