From f3f746ebdcbc79d60881838ed4ee9d9355d3788b Mon Sep 17 00:00:00 2001 From: Bertie690 Date: Fri, 6 Jun 2025 23:10:22 -0400 Subject: [PATCH 1/3] Added lefthook to enforce no non-type export in `src/@types` --- .dependency-cruiser.cjs | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/.dependency-cruiser.cjs b/.dependency-cruiser.cjs index 40a9785aeaf..d4d1b5aa863 100644 --- a/.dependency-cruiser.cjs +++ b/.dependency-cruiser.cjs @@ -1,6 +1,18 @@ /** @type {import('dependency-cruiser').IConfiguration} */ module.exports = { forbidden: [ + { + name: "no-non-type-@type-exports", + severity: "error", + comment: + "Files in @types should not export anything but types and interfaces. " + + "The folder is intended to house imports that are removed at runtime, " + + "and thus should not contain anything with a bearing on runtime code.", + to: { + path: "(^|/)src/@types", + dependencyTypesNot: ["type-only"], + }, + }, { name: "only-type-imports", severity: "error", @@ -218,7 +230,7 @@ module.exports = { module systems it knows of. It's the default because it's the safe option It might come at a performance penalty, though. moduleSystems: ['amd', 'cjs', 'es6', 'tsd'] - + As in practice only commonjs ('cjs') and ecmascript modules ('es6') are widely used, you can limit the moduleSystems to those. */ @@ -226,7 +238,7 @@ module.exports = { // moduleSystems: ['cjs', 'es6'], /* prefix for links in html and svg output (e.g. 'https://github.com/you/yourrepo/blob/main/' - to open it on your online repo or `vscode://file/${process.cwd()}/` to + to open it on your online repo or `vscode://file/${process.cwd()}/` to open it in visual studio code), */ // prefix: `vscode://file/${process.cwd()}/`, @@ -271,7 +283,7 @@ module.exports = { to './webpack.conf.js'. The (optional) `env` and `arguments` attributes contain the parameters - to be passed if your webpack config is a function and takes them (see + to be passed if your webpack config is a function and takes them (see webpack documentation for details) */ // webpackConfig: { @@ -322,8 +334,8 @@ module.exports = { A list of alias fields in package.jsons See [this specification](https://github.com/defunctzombie/package-browser-field-spec) and the webpack [resolve.alias](https://webpack.js.org/configuration/resolve/#resolvealiasfields) - documentation - + documentation + Defaults to an empty array (= don't use alias fields). */ // aliasFields: ["browser"], From 9ca3bdebdc6dcea4cf8d3a22b2952a59484c2b40 Mon Sep 17 00:00:00 2001 From: NightKev <34855794+DayKev@users.noreply.github.com> Date: Sun, 15 Jun 2025 01:51:57 -0700 Subject: [PATCH 2/3] Add missing field in config --- .dependency-cruiser.cjs | 1 + 1 file changed, 1 insertion(+) diff --git a/.dependency-cruiser.cjs b/.dependency-cruiser.cjs index b684c48491b..141402a1239 100644 --- a/.dependency-cruiser.cjs +++ b/.dependency-cruiser.cjs @@ -8,6 +8,7 @@ module.exports = { "Files in @types should not export anything but types and interfaces. " + "The folder is intended to house imports that are removed at runtime, " + "and thus should not contain anything with a bearing on runtime code.", + from: {}, to: { path: "(^|/)src/@types", dependencyTypesNot: ["type-only"], From 22e28956b6520ac5b9518dd41ffdf8ce1435eebb Mon Sep 17 00:00:00 2001 From: Bertie690 Date: Mon, 16 Jun 2025 12:46:50 -0400 Subject: [PATCH 3/3] Fixed type import inside `move.ts` --- src/data/moves/move.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/data/moves/move.ts b/src/data/moves/move.ts index b46f109db9e..2e454e95a44 100644 --- a/src/data/moves/move.ts +++ b/src/data/moves/move.ts @@ -97,7 +97,7 @@ import { MoveEffectTrigger } from "#enums/MoveEffectTrigger"; import { MultiHitType } from "#enums/MultiHitType"; import { invalidAssistMoves, invalidCopycatMoves, invalidMetronomeMoves, invalidMirrorMoveMoves, invalidSleepTalkMoves } from "./invalid-moves"; import { SelectBiomePhase } from "#app/phases/select-biome-phase"; -import { ChargingMove, MoveAttrMap, MoveAttrString, MoveKindString, MoveClassMap } from "#app/@types/move-types"; +import type { ChargingMove, MoveAttrMap, MoveAttrString, MoveKindString, MoveClassMap } from "#app/@types/move-types"; import { applyMoveAttrs } from "./apply-attrs"; import { frenzyMissFunc, getMoveTargets } from "./move-utils"; @@ -126,10 +126,10 @@ export default abstract class Move implements Localizable { /** * Check if the move is of the given subclass without requiring `instanceof`. - * + * * ⚠️ Does _not_ work for {@linkcode ChargingAttackMove} and {@linkcode ChargingSelfStatusMove} subclasses. For those, * use {@linkcode isChargingMove} instead. - * + * * @param moveKind - The string name of the move to check against * @returns Whether this move is of the provided type. */