Skip to content

Commit 328f931

Browse files
committed
chore: package upgrades, addressing several linter warnings after upgrade
1 parent 9d848f4 commit 328f931

File tree

77 files changed

+1981
-1625
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+1981
-1625
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929

3030
- uses: pnpm/[email protected]
3131
with:
32-
version: 10.11.0
32+
version: 10.12.1
3333

3434
- name: Install
3535
run: pnpm i

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ registry=https://registry.npmjs.org/
33
unsafe-perm=true
44
enable-pre-post-scripts=true
55
auto-install-peers=true
6+
ignore-workspace-root-check=true

CLAUDE.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
objECS is a TypeScript Entity Component System (ECS) library for game development. It uses a pnpm monorepo structure.
8+
9+
## Monorepo Structure
10+
11+
- `packages/objecs/` - Core ECS library (published to npm as `objecs`)
12+
- `packages/examples/` - Vite-based demo applications using the library
13+
- `packages/ecs-benchmark/` - Benchmarks comparing objecs against other ECS libraries
14+
- `packages/benchmark/` - Additional benchmarking utilities
15+
16+
## Common Commands
17+
18+
### Root-level
19+
```bash
20+
pnpm install # Install all dependencies
21+
pnpm lint # Lint all packages
22+
pnpm lint:fix # Fix lint issues
23+
```
24+
25+
### Core Library (packages/objecs)
26+
```bash
27+
pnpm --filter objecs build # Build the library (runs lint first)
28+
pnpm --filter objecs test # Run tests in watch mode
29+
pnpm --filter objecs test run # Run tests once
30+
pnpm --filter objecs lint # Lint the library
31+
```
32+
33+
### Examples (packages/examples)
34+
```bash
35+
pnpm --filter examples dev # Start Vite dev server
36+
pnpm --filter examples build # Build examples
37+
```
38+
39+
### Benchmarks
40+
```bash
41+
pnpm --filter ecs-benchmark start # Run ECS comparison benchmarks
42+
```
43+
44+
## Architecture
45+
46+
### Core Concepts
47+
48+
**World** (`packages/objecs/src/world.ts`): Container for all entities. Creates entities, manages archetypes, and handles component operations.
49+
50+
**Archetype** (`packages/objecs/src/archetype.ts`): A query that groups entities sharing the same component combination. Created via `world.archetype('component1', 'component2', ...)`. Supports `without()` for exclusion filters.
51+
52+
**Entity**: Plain JavaScript objects (must be `JsonObject` from type-fest). Components are simply properties on the entity object.
53+
54+
### Usage Pattern
55+
56+
```typescript
57+
// Define entity type with all possible components
58+
type Entity = {
59+
position?: { x: number; y: number };
60+
velocity?: { x: number; y: number };
61+
health?: number;
62+
};
63+
64+
// Create world and entities
65+
const world = new World<Entity>();
66+
world.createEntity({ position: { x: 0, y: 0 }, velocity: { x: 1, y: 0 } });
67+
68+
// Create archetype query (entities matching these components)
69+
const movingEntities = world.archetype('position', 'velocity');
70+
71+
// Iterate in systems
72+
for (const entity of movingEntities.entities) {
73+
entity.position.x += entity.velocity.x * dt;
74+
}
75+
```
76+
77+
### Type Safety
78+
79+
- `SafeEntity<Entity, Components>` ensures queried components exist
80+
- Archetypes return entities with required components as non-optional
81+
- `createEntity()` with arguments requires at least one component
82+
83+
## Development Workflow
84+
85+
Uses [Conventional Commits](https://www.conventionalcommits.org/). For releases:
86+
1. Run `bumpp` to interactively create a version tag
87+
2. Create GitHub release to trigger publish workflow
88+
89+
## Testing
90+
91+
Tests use Vitest. Test files are colocated with source (`.test.ts` suffix).

eslint.config.mjs

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import eslint from "@eslint/js";
2+
import globals from "globals";
3+
import { defineConfig } from "eslint/config";
4+
import tseslint from "typescript-eslint";
5+
import eslintConfigPrettier from "eslint-config-prettier/flat";
6+
import depend from "eslint-plugin-depend";
7+
8+
export default defineConfig(
9+
{
10+
ignores: [
11+
"**/node_modules",
12+
"**/build",
13+
"**/dist",
14+
"**/public",
15+
// This package mixes a lot of packages that I don't control, so ignore it.
16+
"packages/ecs-benchmark/**",
17+
],
18+
},
19+
{
20+
files: ["**/*.{js,mjs,cjs,ts,mts,cts}"],
21+
languageOptions: { globals: globals.browser },
22+
plugins: { depend },
23+
extends: ["depend/flat/recommended"],
24+
},
25+
eslintConfigPrettier,
26+
eslint.configs.recommended,
27+
tseslint.configs.recommended,
28+
tseslint.configs.strictTypeChecked,
29+
tseslint.configs.stylisticTypeChecked,
30+
{
31+
languageOptions: {
32+
parserOptions: {
33+
projectService: true,
34+
tsconfigRootDir: import.meta.dirname,
35+
},
36+
},
37+
},
38+
{
39+
rules: {
40+
"@typescript-eslint/array-type": "off",
41+
"@typescript-eslint/restrict-template-expressions": [
42+
"error",
43+
{
44+
allowNumber: true,
45+
},
46+
],
47+
"@typescript-eslint/consistent-type-definitions": "off",
48+
"@typescript-eslint/interface-name-prefix": "off",
49+
"@typescript-eslint/explicit-function-return-type": "off",
50+
"@typescript-eslint/no-explicit-any": "off",
51+
"@typescript-eslint/camelcase": "off",
52+
"@typescript-eslint/no-var-requires": "off",
53+
"no-unused-vars": "off",
54+
55+
"@typescript-eslint/no-unused-vars": [
56+
"error",
57+
{
58+
argsIgnorePattern: "^_",
59+
varsIgnorePattern: "^_",
60+
},
61+
],
62+
},
63+
},
64+
);

mise.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[tools]
2-
pnpm = "10.11.0"
3-
node = "22.16.0"
2+
pnpm = "10.26.0"
3+
node = "24.12.0"

package.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "objecs",
3+
"private": true,
4+
"type": "module",
5+
"scripts": {
6+
"lint": "eslint \"packages/**/*.{js,jsx,ts,tsx}\" eslint.config.mjs",
7+
"lint:fix": "eslint --fix \"packages/**/*.{js,jsx,ts,tsx}\" eslint.config.mjs"
8+
},
9+
"keywords": [],
10+
"author": "",
11+
"license": "ISC",
12+
"packageManager": "[email protected]",
13+
"devDependencies": {
14+
"@eslint/js": "9.39.2",
15+
"@types/eslint": "^9.6.1",
16+
"@typescript-eslint/utils": "8.50.0",
17+
"eslint": "^9.39.2",
18+
"eslint-config-prettier": "^10.1.8",
19+
"eslint-plugin-depend": "1.4.0",
20+
"globals": "16.5.0",
21+
"typescript": "5.9.3",
22+
"typescript-eslint": "8.50.0"
23+
}
24+
}

packages/benchmark/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,25 @@
55
"main": "index.js",
66
"type": "module",
77
"scripts": {
8-
"lint": "prettier --check 'src/**/*.ts'",
9-
"lint:fix": "prettier --write 'src/**/*.ts'",
8+
"lint": "eslint \"src/**/*.{js,jsx,ts,tsx}\"",
9+
"lint:fix": "eslint --fix \"src/**/*.{js,jsx,ts,tsx}\"",
1010
"start": "tsx src/bench.ts"
1111
},
1212
"keywords": [],
1313
"author": "",
1414
"license": "ISC",
1515
"devDependencies": {
1616
"@types/benchmark": "^2.1.5",
17-
"@types/node": "^22.15.21",
18-
"tsx": "^4.19.4",
19-
"typescript": "5.8.3"
17+
"@types/node": "^24.10.4",
18+
"tsx": "^4.21.0",
19+
"typescript": "5.9.3"
2020
},
2121
"dependencies": {
22-
"@thi.ng/bench": "3.6.20",
22+
"@thi.ng/bench": "3.6.37",
2323
"benchmark": "^2.1.4",
2424
"miniplex": "2.0.0",
2525
"mitata": "1.0.34",
2626
"objecs": "workspace:*",
27-
"type-fest": "4.41.0"
27+
"type-fest": "5.3.1"
2828
}
2929
}

packages/benchmark/src/suites/frag_iter.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ const ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" as const;
77

88
type Alphabet = Split<typeof ALPHABET, "">[number];
99

10-
type Entity = {
11-
[K in Alphabet]?: number;
12-
} & {
10+
type Entity = Partial<Record<Alphabet, number>> & {
1311
Data?: number;
1412
};
1513

@@ -44,7 +42,6 @@ summary(() => {
4442

4543
Array.from(ALPHABET).forEach((component) => {
4644
for (let i = 0; i < count; i++) {
47-
// @ts-ignore
4845
world.add({ [component]: 1, Data: 1 });
4946
}
5047
});

packages/ecs-benchmark/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"wolf-ecs": "2.1.2"
2727
},
2828
"devDependencies": {
29-
"@types/node": "^22.15.21",
30-
"prettier": "^3.5.3"
29+
"@types/node": "^24.10.4",
30+
"prettier": "^3.7.4"
3131
}
3232
}

packages/ecs-benchmark/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"checkJs": true,
77
"module": "NodeNext",
88
"noEmit": true,
9-
"types": ["node"]
9+
"types": ["node"],
10+
"strictNullChecks": true
1011
},
1112
"include": [
1213
"src/cases/objecs/**/*.js",

0 commit comments

Comments
 (0)