Skip to content

Commit

Permalink
Merge pull request #10855 from DestinyItemManager/update-dead-code
Browse files Browse the repository at this point in the history
Update dead-code and find the dead code
  • Loading branch information
bhollis authored Dec 18, 2024
2 parents 529605c + be762ac commit 890daba
Show file tree
Hide file tree
Showing 22 changed files with 27 additions and 110 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,14 @@
"style-loader": "^4.0.0",
"stylelint": "^16.12.0",
"stylelint-config-css-modules": "^4.4.0",
"stylelint-config-standard-scss": "^13.1.0",
"stylelint-config-standard-scss": "^14.0.0",
"stylelint-order": "^6.0.4",
"svgo": "^3.3.2",
"svgo-loader": "^4.0.0",
"terser-webpack-plugin": "^5.3.11",
"ts-jest": "^29.2.5",
"ts-loader": "^9.5.1",
"ts-unused-exports": "^10.1.0",
"ts-unused-exports": "^11.0.1",
"tsconfig-paths-webpack-plugin": "^4.2.0",
"typescript": "^5.7.2",
"typescript-eslint": "^8.18.1",
Expand Down
18 changes: 9 additions & 9 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions src/app/destiny2/d2-definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import {
DestinyInventoryItemDefinition,
DestinyItemCategoryDefinition,
DestinyLoadoutColorDefinition,
DestinyLoadoutConstantsDefinition,
DestinyLoadoutIconDefinition,
DestinyLoadoutNameDefinition,
DestinyMaterialRequirementSetDefinition,
Expand Down Expand Up @@ -89,7 +88,6 @@ export const allTables: ManifestTablesShort[] = [
'Race',
'Faction',
'ActivityMode',
'LoadoutConstants',
];

export interface DefinitionTable<T> {
Expand Down Expand Up @@ -140,7 +138,6 @@ export interface D2ManifestDefinitions {
DamageType: DefinitionTable<DestinyDamageTypeDefinition>;
Collectible: DefinitionTable<DestinyCollectibleDefinition>;
EventCard: DefinitionTable<DestinyEventCardDefinition>;
LoadoutConstants: DefinitionTable<DestinyLoadoutConstantsDefinition>;
LoadoutName: DefinitionTable<DestinyLoadoutNameDefinition>;
LoadoutColor: DefinitionTable<DestinyLoadoutColorDefinition>;
LoadoutIcon: DefinitionTable<DestinyLoadoutIconDefinition>;
Expand Down
2 changes: 1 addition & 1 deletion src/app/dim-api/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1472,7 +1472,7 @@ function applyUpdateLocally(draft: Draft<DimApiState>, update: ProfileUpdateWith
}
}

export function reverseUpdateLocally(draft: Draft<DimApiState>, update: ProfileUpdateWithRollback) {
function reverseUpdateLocally(draft: Draft<DimApiState>, update: ProfileUpdateWithRollback) {
try {
switch (update.action) {
case 'delete_loadout': {
Expand Down
4 changes: 2 additions & 2 deletions src/app/dim-ui/CollapsibleTitle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,11 @@ export function CollapseIcon({ collapsed }: { collapsed: boolean }) {
);
}

export const collapsibleTitleAnimateVariants: Variants = {
const collapsibleTitleAnimateVariants: Variants = {
open: { height: 'auto' },
collapsed: { height: 0 },
};
export const collapsibleTitleAnimateTransition: Spring = {
const collapsibleTitleAnimateTransition: Spring = {
type: 'spring',
duration: 0.5,
bounce: 0,
Expand Down
9 changes: 0 additions & 9 deletions src/app/dim-ui/WeaponCatalystInfo.m.scss.d.ts

This file was deleted.

7 changes: 0 additions & 7 deletions src/app/dim-ui/WeaponCraftedInfo.m.scss.d.ts

This file was deleted.

8 changes: 0 additions & 8 deletions src/app/dim-ui/WeaponDeepsightInfo.m.scss.d.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/app/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const browserLangToDimLang: Record<string, DimLanguage> = {
'zh-Hant': 'zh-cht',
};

export const dimLangToBrowserLang = invert(browserLangToDimLang);
const dimLangToBrowserLang = invert(browserLangToDimLang);

// Hot-reload translations in dev. You'll still need to get things to re-render when
// translations change (unless we someday switch to react-i18next)
Expand Down
6 changes: 3 additions & 3 deletions src/app/inventory/store/crafted.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ export const craftedSocketCategoryHash = 3583996951;
export const mementoSocketCategoryHash = 3201856887;

/** the socket containing the enhancement tier plugs */
export const enhancementSocketHash = 4251072212;
export const plugHashToEnhancementTier: HashLookup<number> = {
const enhancementSocketHash = 4251072212;
const plugHashToEnhancementTier: HashLookup<number> = {
2728416798: 1,
2728416797: 2,
2728416796: 3,
Expand Down Expand Up @@ -47,7 +47,7 @@ export function getCraftedSocket(item: DimItem): DimSocket | undefined {
}
}

export function getEnhancementTier(item: DimItem): number {
function getEnhancementTier(item: DimItem): number {
if (item.bucket.inWeapons && item.sockets) {
const plugHash = item.sockets.allSockets.find(
(s) => s.socketDefinition.socketTypeHash === enhancementSocketHash,
Expand Down
2 changes: 1 addition & 1 deletion src/app/inventory/store/d1-item-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const getClassTypeNameLocalized = memoize(
/**
* Convert a D1DamageType to the D2 definition, so we don't have to maintain both codepaths
*/
export const toD2DamageType = memoize(
const toD2DamageType = memoize(
(damageType: D1DamageTypeDefinition | undefined): DestinyDamageTypeDefinition | undefined =>
damageType && {
displayProperties: {
Expand Down
4 changes: 2 additions & 2 deletions src/app/inventory/store/d2-store-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ const genderTypeToEnglish = {
[DestinyGender.Unknown]: '',
} as const;

export function makeCharacter(
function makeCharacter(
defs: D2ManifestDefinitions,
character: DestinyCharacterComponent,
mostRecentLastPlayed: Date,
Expand Down Expand Up @@ -183,7 +183,7 @@ export function makeCharacter(
};
}

export function makeVault(): DimStore {
function makeVault(): DimStore {
const vaultName = t('Bucket.Vault');
return {
destinyVersion: 2,
Expand Down
2 changes: 0 additions & 2 deletions src/app/loadout-builder/filter/LoadoutOptimizerMenuItems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,5 +128,3 @@ export const LoadoutOptimizerExcludedItems = memo(function LoadoutOptimizerExclu
</LoadoutEditSection>
);
});

export const loMenuSection = styles.area;
10 changes: 0 additions & 10 deletions src/app/loadout-builder/filter/LockArmorAndPerks.m.scss.d.ts

This file was deleted.

12 changes: 0 additions & 12 deletions src/app/loadout-drawer/loadout-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ import {
DestinyLoadoutItemComponent,
DestinySeasonDefinition,
} from 'bungie-api-ts/destiny2';
import deprecatedMods from 'data/d2/deprecated-mods.json';
import { BucketHashes, SocketCategoryHashes } from 'data/d2/generated-enums';
import { keyBy, maxBy } from 'es-toolkit';
import { produce } from 'immer';
Expand Down Expand Up @@ -838,17 +837,6 @@ const oldToNewMod: HashLookup<number> = {
3253038666: 4287799666, // InventoryItem "Strength Mod"
};

export function hasDeprecatedMods(loadout: Loadout, defs: D2ManifestDefinitions): boolean {
return Boolean(
loadout.parameters?.mods?.some((modHash) => {
const migratedModHash = oldToNewMod[modHash] ?? modHash;
return (
deprecatedMods.includes(migratedModHash) || !defs.InventoryItem.getOptional(migratedModHash)
);
}),
);
}

/**
* Convert a list of plug item hashes into ResolvedLoadoutMods, which may not be
* the same as the original hashes as we try to be smart about what the user meant.
Expand Down
7 changes: 0 additions & 7 deletions src/app/loadout/LoadoutsRow.m.scss.d.ts

This file was deleted.

20 changes: 0 additions & 20 deletions src/app/loadout/loadout-item-utils.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { D2ManifestDefinitions } from 'app/destiny2/d2-definitions';
import { t } from 'app/i18next-t';
import { DimItem } from 'app/inventory/item-types';
import { isPluggableItem } from 'app/inventory/store/sockets';
import { ShowItemPickerFn } from 'app/item-picker/item-picker';
import { ResolvedLoadoutItem } from 'app/loadout/loadout-types';
import { armorStats } from 'app/search/d2-known-values';
import { filterMap } from 'app/utils/collections';
Expand All @@ -12,7 +10,6 @@ import {
getDefaultAbilityChoiceHash,
getSocketsByIndexes,
} from 'app/utils/socket-utils';
import { BucketHashes } from 'data/d2/generated-enums';

/** Checks if the item is Armor 2.0 and whether it has stats present for all 6 armor stats. */
export function isLoadoutBuilderItem(item: DimItem) {
Expand All @@ -23,23 +20,6 @@ export function isLoadoutBuilderItem(item: DimItem) {
);
}

export async function pickSubclass(
showItemPicker: ShowItemPickerFn,
filterItems: (item: DimItem) => boolean,
) {
const item = await showItemPicker({
filterItems: (item: DimItem) => item.bucket.hash === BucketHashes.Subclass && filterItems(item),
// We can only sort so that the classes are grouped and stasis comes first
sortBy: (item) => `${item.classType}-${item.energy?.energyType}`,
// We only want to show a single instance of a given subclass, we reconcile them by their hash from
// the appropriate store at render time
uniqueBy: (item) => item.hash,
prompt: t('Loadouts.ChooseItem', { name: t('Bucket.Class') }),
});

return item;
}

export function getSubclassPlugHashes(subclass: ResolvedLoadoutItem | undefined) {
const plugs: {
plugHash: number;
Expand Down
2 changes: 1 addition & 1 deletion src/app/loadout/loadout-ui/LoadoutParametersDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export default function LoadoutParametersDisplay({ params }: { params: LoadoutPa
);
}

export function StatConstraintRange({
function StatConstraintRange({
statConstraint,
className,
}: {
Expand Down
5 changes: 0 additions & 5 deletions src/app/manifest/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,3 @@ export function useD2Definitions() {
export function useDefinitions() {
return useSelector(manifestSelector);
}

export const loadoutConstantsSelector = (state: RootState) =>
d2ManifestSelector(state)?.LoadoutConstants.get(
destiny2CoreSettingsSelector(state)?.loadoutConstantsHash ?? 1,
);
4 changes: 2 additions & 2 deletions src/app/search/items/search-filters/known-values.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const prismaticDamageLookupTable: { [key in DamageType]: string | undefined } =
[DamageType.Strand]: 'dark',
};

export const prismaticDamageFilter = {
const prismaticDamageFilter = {
keywords: ['light', 'dark'],
description: tl('Filter.PrismaticDamageType'),
filter:
Expand Down Expand Up @@ -202,7 +202,7 @@ export const itemTypeFilter = {
} satisfies ItemFilterDefinition;

// D1 has different item types, otherwise this is the same as itemTypeFilter.
export const d1itemTypeFilter = {
const d1itemTypeFilter = {
keywords: Object.values(D1Categories) // stuff like Engrams, Kinetic, Gauntlets, Emblems, Finishers, Modifications
.flat()
.map((v) => {
Expand Down
2 changes: 1 addition & 1 deletion src/app/search/items/search-filters/loadouts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export function loadoutToSearchString(loadout: Loadout | InGameLoadout) {

// related: https://github.com/DestinyItemManager/DIM/issues/9069
// sanity check: `inloadout:#hashta` should not suggest `inloadout:inloadout:#hashtag` (double prefix)
export function loadoutToSuggestions(loadout: Loadout) {
function loadoutToSuggestions(loadout: Loadout) {
return [
quoteFilterString(loadout.name.toLowerCase()), // loadout name
...getHashtagsFromString(loadout.name, loadout.notes), // #hashtags in the name/notes
Expand Down
4 changes: 2 additions & 2 deletions src/app/search/loadouts/loadout-search-filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import freeformFilters from './search-filters/freeform';
import overloadedRangeFilters from './search-filters/range-overload';
import simpleFilters from './search-filters/simple';

export const allLoadoutFilters = [...simpleFilters, ...freeformFilters, ...overloadedRangeFilters];
const allLoadoutFilters = [...simpleFilters, ...freeformFilters, ...overloadedRangeFilters];

//
// Selectors
Expand Down Expand Up @@ -117,7 +117,7 @@ export const buildLoadoutsFiltersMap = memoizeOne((destinyVersion: DestinyVersio
buildFiltersMap(destinyVersion, allLoadoutFilters),
);

export function buildLoadoutsSearchConfig(
function buildLoadoutsSearchConfig(
destinyVersion: DestinyVersion,
language: DimLanguage,
suggestionsContext: LoadoutSuggestionsContext,
Expand Down

0 comments on commit 890daba

Please sign in to comment.