Add more typescript lints

This commit is contained in:
Aode (lion) 2021-12-30 10:58:39 -06:00
parent 90b9e22f4d
commit 76030da785
4 changed files with 12 additions and 7 deletions

View file

@ -1,10 +1,15 @@
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
parserOptions: {
tsconfigRootDir: __dirname,
project: ["./tsconfig.json"],
},
plugins: ["@typescript-eslint"],
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"prettier",

View file

@ -44,7 +44,7 @@ interface CellProps {
onSelectDestination: OnSelectDestination;
}
type FileState = {
export type FileState = {
[key in RANK]?: PieceState;
};
@ -118,10 +118,10 @@ const Cell = ({
const classNames =
selected !== null &&
selected.piece.kind === piece.kind &&
selected.piece.color === piece.color &&
selected.location.file === file &&
selected.location.rank === rank
selected.piece.kind === piece.kind &&
selected.piece.color === piece.color &&
selected.location.file === file &&
selected.location.rank === rank
? ["icon-cell", "selected"]
: ["icon-cell"];

View file

@ -2,7 +2,7 @@ import { ReportHandler } from "web-vitals";
const reportWebVitals = (onPerfEntry?: ReportHandler) => {
if (onPerfEntry && onPerfEntry instanceof Function) {
import("web-vitals").then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
void import("web-vitals").then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
getCLS(onPerfEntry);
getFID(onPerfEntry);
getFCP(onPerfEntry);

View file

@ -27,7 +27,7 @@ const validateBoardState = (input: unknown): BoardState | null => {
return true;
}
return Object.entries(ranks).some(([rank, pieces]) => {
return Object.entries(ranks as { [s: string]: unknown; }).some(([rank, pieces]) => {
if (typeof rank !== "string") {
console.error("rank is not a string");
return true;