Skip to content

Commit

Permalink
chore: added knip to ci, removed unused exports
Browse files Browse the repository at this point in the history
  • Loading branch information
jurerotar committed Nov 8, 2024
1 parent 18ae0e0 commit 475fe8b
Show file tree
Hide file tree
Showing 14 changed files with 78 additions and 282 deletions.
71 changes: 37 additions & 34 deletions .github/workflows/develop-ci.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,37 @@
name: develop ci

on:
push:
branches:
- develop

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Use Node.js LTS
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
cache: npm

- name: Install modules
run: npm install

- name: Type check
run: npm run type-check

- name: Lint
run: npm run lint:check

- name: Format
run: npm run format:check

- name: Run tests
run: npm test
name: ci

on:
push:


jobs:
build:
name: Continuous Integration
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Use Node.js LTS
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
cache: npm

- name: Install modules
run: npm install

- name: Type check
run: npm run type-check

- name: Lint check
run: npm run lint:check

- name: Format check
run: npm run format:check

- name: Unused exports and dependencies check
run: npm run format:check

- name: Run tests
run: npm test
35 changes: 0 additions & 35 deletions .github/workflows/feature-branch-ci.yml

This file was deleted.

34 changes: 0 additions & 34 deletions .github/workflows/master-ci.yml

This file was deleted.

4 changes: 2 additions & 2 deletions app/(game)/(map)/components/cell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ import type { Village, VillageSize } from 'app/interfaces/models/game/village';
import clsx from 'clsx';
import type React from 'react';
import { memo } from 'react';
import { type GridChildComponentProps, areEqual } from 'react-window';
import { areEqual, type GridChildComponentProps } from 'react-window';
import cellStyles from './cell.module.scss';

export const reputationColorMap = new Map<ReputationLevel, string>([
const reputationColorMap = new Map<ReputationLevel, string>([
['player', 'after:border-reputation-player'],
['ecstatic', 'after:border-reputation-ecstatic'],
['respected', 'after:border-reputation-respected'],
Expand Down
18 changes: 0 additions & 18 deletions app/(game)/providers/game-providers.tsx

This file was deleted.

58 changes: 0 additions & 58 deletions app/(game)/utils/adventure.ts

This file was deleted.

4 changes: 2 additions & 2 deletions app/(game)/utils/building.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const getBuildingData = (buildingId: Building['id']) => {
return buildingMap.get(buildingId)!;
};

export const getBuildingFieldPresetData = (buildingFieldsPresets: Village['buildingFieldsPresets']): BuildingField[] => {
const getBuildingFieldPresetData = (buildingFieldsPresets: Village['buildingFieldsPresets']): BuildingField[] => {
return buildingFieldsPresets.flatMap((presetId) => presetIdToPresetMap.get(presetId)!);
};

Expand Down Expand Up @@ -80,7 +80,7 @@ export const calculatePopulationFromBuildingFields = (
return sum;
};

export const getResourceProductionByResourceField = (resourceField: BuildingField): number => {
const getResourceProductionByResourceField = (resourceField: BuildingField): number => {
const { buildingId, level } = resourceField;
const fullBuildingData: Building = getBuildingData(buildingId)!;
// There's only 1 effect on production buildings, this should be fine
Expand Down
27 changes: 1 addition & 26 deletions app/(game)/utils/guards/effect-guards.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
import type {
Effect,
GlobalEffect,
HeroEffect,
ServerEffect,
TribalEffect,
VillageBuildingEffect,
VillageEffect,
VillageOasisEffect,
} from 'app/interfaces/models/game/effect';
import type { Effect, GlobalEffect, ServerEffect, VillageEffect } from 'app/interfaces/models/game/effect';

export const isServerEffect = (effect: Effect): effect is ServerEffect => {
return effect.scope === 'server';
Expand All @@ -17,22 +8,6 @@ export const isGlobalEffect = (effect: Effect): effect is GlobalEffect => {
return effect.scope === 'global';
};

export const isTribalEffect = (effect: Effect): effect is TribalEffect => {
return effect.scope === 'global' && effect.source === 'tribe';
};

export const isHeroEffect = (effect: Effect): effect is HeroEffect => {
return effect.scope === 'global' && effect.source === 'hero';
};

export const isVillageEffect = (effect: Effect): effect is VillageEffect => {
return effect.scope === 'village';
};

export const isVillageBuildingEffect = (effect: Effect): effect is VillageBuildingEffect => {
return effect.scope === 'village' && effect.source === 'building';
};

export const isVillageOasisEffect = (effect: Effect): effect is VillageOasisEffect => {
return effect.scope === 'village' && effect.source === 'oasis';
};
2 changes: 1 addition & 1 deletion app/hooks/use-available-servers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { Server } from 'app/interfaces/models/game/server';
import { getRootHandle } from 'app/utils/opfs';
import { availableServerCacheKey } from 'app/query-keys';

export const deleteServerData = async (server: Server) => {
const deleteServerData = async (server: Server) => {
const rootHandle = await getRootHandle();
await rootHandle.removeEntry(`${server.slug}.json`);
const servers: Server[] = JSON.parse(window.localStorage.getItem(availableServerCacheKey) ?? '[]');
Expand Down
6 changes: 1 addition & 5 deletions app/interfaces/models/game/effect.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { BuildingField, Village } from 'app/interfaces/models/game/village';

export type TroopTrainingDurationEffectId =
type TroopTrainingDurationEffectId =
| 'barracksTrainingDuration'
| 'greatBarracksTrainingDuration'
| 'stableTrainingDuration'
Expand Down Expand Up @@ -64,7 +64,3 @@ export type VillageBuildingEffect = Omit<VillageEffect, 'source'> & {
source: 'building';
buildingFieldId: BuildingField['id'];
};

export type VillageOasisEffect = Omit<VillageEffect, 'source'> & {
source: 'oasis';
};
Loading

0 comments on commit 475fe8b

Please sign in to comment.