Set up eslint, gotta keep the vibes in check.

This commit is contained in:
Ryan Lanny Jenkins 2025-05-26 20:57:14 -05:00
parent 72b287e421
commit 9edb030079
7 changed files with 1388 additions and 57 deletions

1
.nvmrc Normal file
View file

@ -0,0 +1 @@
lts/iron

12
eslint.config.mjs Normal file
View file

@ -0,0 +1,12 @@
import eslint from '@eslint/js'
import tseslint from 'typescript-eslint'
export default tseslint.config(
eslint.configs.recommended,
tseslint.configs.recommended,
{
rules: {
'@typescript-eslint/no-unused-vars': ['error', { 'argsIgnorePattern': '^_' }]
}
}
)

1368
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -8,7 +8,8 @@
"build": "vite build",
"type-check": "tsc --noEmit",
"preview": "vite preview",
"lint": "prettier --write src/"
"lint": "eslint --fix ./src",
"style": "prettier --write src/"
},
"dependencies": {
"@linaria/core": "^6.3.0",
@ -27,8 +28,10 @@
"@types/react-dom": "^18.3.1",
"@vitejs/plugin-react": "^4.3.4",
"@wyw-in-js/vite": "^0.6.0",
"eslint": "^9.27.0",
"prettier": "3.5.3",
"typescript": "^5.8.3",
"typescript-eslint": "^8.32.1",
"vite": "^6.0.1"
}
}

View file

@ -147,39 +147,6 @@ const getMaturityProgressBarStyle = (
boxShadow: '0 0 3px rgba(0, 0, 0, 0.5)',
})
const modalOverlayStyle: React.CSSProperties = {
position: 'fixed',
top: 0,
left: 0,
right: 0,
bottom: 0,
backgroundColor: 'rgba(0, 0, 0, 0.5)',
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
zIndex: 1000,
}
const modalContentStyle: React.CSSProperties = {
backgroundColor: 'white',
padding: '2rem',
borderRadius: '0.5rem',
maxWidth: '400px',
width: '90%',
position: 'relative',
}
const modalCloseButtonStyle: React.CSSProperties = {
position: 'absolute',
top: '0.5rem',
right: '0.5rem',
padding: '0.5rem',
border: 'none',
background: 'none',
cursor: 'pointer',
fontSize: '1.5rem',
}
const plotInfoStyle: React.CSSProperties = {
display: 'flex',
flexDirection: 'column',

View file

@ -1,5 +1,4 @@
import React, {
useEffect,
useState,
useImperativeHandle,
forwardRef,

View file

@ -347,7 +347,7 @@ export const useGameStore = create<
})
// Update equipment progress
Object.entries(state.equipment).forEach(([id, equipment]) => {
Object.entries(state.equipment).forEach(([, equipment]) => {
// TODO: this type cast shouldn't be necessary
const equipmentInstance = equipment as Equipment
if (equipmentInstance.isProcessing) {
@ -421,7 +421,7 @@ export const useGameStore = create<
},
buyItem: (itemId) => {
const { cash, landPurchases, plots, fieldSize } = get()
const { cash, landPurchases } = get()
const item = ITEMS[itemId]
if (!item || item.buyPrice === null || item.buyPrice === undefined) {
@ -499,26 +499,7 @@ export const useGameStore = create<
saveToSlot: (slot: number) => {
const state = get()
const {
plant,
water,
harvest,
tick,
assignCrop,
upgradeField,
setGameSpeed,
setActionCooldown,
buyItem,
sellItem,
saveToSlot,
loadFromSlot,
purchaseUpgrade,
pray,
buyEquipment,
configureEquipment,
useEquipment,
...gameState
} = state
const { ...gameState } = state
saveGame(slot, gameState)
},