mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-21 09:02:47 +02:00
[Dev] Enable dependency cruiser workflow (#5966)
* Update `.dependency-cruiser.cjs` config file * Update GitHub workflow * Have `depcruise` check `test/` as well * Remove circular import between `battle-anims.ts` and `battler-tags.ts`
This commit is contained in:
parent
0918985a63
commit
f8d8a3de84
@ -4,7 +4,7 @@ module.exports = {
|
|||||||
{
|
{
|
||||||
name: "only-type-imports",
|
name: "only-type-imports",
|
||||||
severity: "error",
|
severity: "error",
|
||||||
comment: "Files in enums and @types may only use type imports.",
|
comment: "Files in 'enums/' and '@types/' must only use type imports.",
|
||||||
from: {
|
from: {
|
||||||
path: ["(^|/)src/@types", "(^|/)src/enums"],
|
path: ["(^|/)src/@types", "(^|/)src/enums"],
|
||||||
},
|
},
|
||||||
@ -14,7 +14,7 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "no-circular-at-runtime",
|
name: "no-circular-at-runtime",
|
||||||
severity: "warn",
|
severity: "error",
|
||||||
comment:
|
comment:
|
||||||
"This dependency is part of a circular relationship. You might want to revise " +
|
"This dependency is part of a circular relationship. You might want to revise " +
|
||||||
"your solution (i.e. use dependency inversion, make sure the modules have a single responsibility) ",
|
"your solution (i.e. use dependency inversion, make sure the modules have a single responsibility) ",
|
||||||
@ -34,7 +34,7 @@ module.exports = {
|
|||||||
"add an exception for it in your dependency-cruiser configuration. By default " +
|
"add an exception for it in your dependency-cruiser configuration. By default " +
|
||||||
"this rule does not scrutinize dot-files (e.g. .eslintrc.js), TypeScript declaration " +
|
"this rule does not scrutinize dot-files (e.g. .eslintrc.js), TypeScript declaration " +
|
||||||
"files (.d.ts), tsconfig.json and some of the babel and webpack configs.",
|
"files (.d.ts), tsconfig.json and some of the babel and webpack configs.",
|
||||||
severity: "warn",
|
severity: "error",
|
||||||
from: {
|
from: {
|
||||||
orphan: true,
|
orphan: true,
|
||||||
pathNot: [
|
pathNot: [
|
||||||
@ -42,8 +42,7 @@ module.exports = {
|
|||||||
"[.]d[.]ts$", // TypeScript declaration files
|
"[.]d[.]ts$", // TypeScript declaration files
|
||||||
"(^|/)tsconfig[.]json$", // TypeScript config
|
"(^|/)tsconfig[.]json$", // TypeScript config
|
||||||
"(^|/)(?:babel|webpack)[.]config[.](?:js|cjs|mjs|ts|cts|mts|json)$", // other configs
|
"(^|/)(?:babel|webpack)[.]config[.](?:js|cjs|mjs|ts|cts|mts|json)$", // other configs
|
||||||
// anything in src/@types
|
"(^|/)test/.+[.]setup[.]ts", // Vitest setup files
|
||||||
"(^|/)src/@types/",
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
to: {},
|
to: {},
|
||||||
@ -53,7 +52,7 @@ module.exports = {
|
|||||||
comment:
|
comment:
|
||||||
"A module depends on a node core module that has been deprecated. Find an alternative - these are " +
|
"A module depends on a node core module that has been deprecated. Find an alternative - these are " +
|
||||||
"bound to exist - node doesn't deprecate lightly.",
|
"bound to exist - node doesn't deprecate lightly.",
|
||||||
severity: "warn",
|
severity: "error",
|
||||||
from: {},
|
from: {},
|
||||||
to: {
|
to: {
|
||||||
dependencyTypes: ["core"],
|
dependencyTypes: ["core"],
|
||||||
@ -86,7 +85,7 @@ module.exports = {
|
|||||||
comment:
|
comment:
|
||||||
"This module uses a (version of an) npm module that has been deprecated. Either upgrade to a later " +
|
"This module uses a (version of an) npm module that has been deprecated. Either upgrade to a later " +
|
||||||
"version of that module, or find an alternative. Deprecated modules are a security risk.",
|
"version of that module, or find an alternative. Deprecated modules are a security risk.",
|
||||||
severity: "warn",
|
severity: "error",
|
||||||
from: {},
|
from: {},
|
||||||
to: {
|
to: {
|
||||||
dependencyTypes: ["deprecated"],
|
dependencyTypes: ["deprecated"],
|
||||||
@ -122,7 +121,7 @@ module.exports = {
|
|||||||
"Likely this module depends on an external ('npm') package that occurs more than once " +
|
"Likely this module depends on an external ('npm') package that occurs more than once " +
|
||||||
"in your package.json i.e. bot as a devDependencies and in dependencies. This will cause " +
|
"in your package.json i.e. bot as a devDependencies and in dependencies. This will cause " +
|
||||||
"maintenance problems later on.",
|
"maintenance problems later on.",
|
||||||
severity: "warn",
|
severity: "error",
|
||||||
from: {},
|
from: {},
|
||||||
to: {
|
to: {
|
||||||
moreThanOneDependencyType: true,
|
moreThanOneDependencyType: true,
|
||||||
@ -133,7 +132,7 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
/* rules you might want to tweak for your specific situation: */
|
// rules you might want to tweak for your specific situation:
|
||||||
|
|
||||||
{
|
{
|
||||||
name: "not-to-spec",
|
name: "not-to-spec",
|
||||||
@ -188,7 +187,7 @@ module.exports = {
|
|||||||
"in your package.json. This makes sense if your package is e.g. a plugin, but in " +
|
"in your package.json. This makes sense if your package is e.g. a plugin, but in " +
|
||||||
"other cases - maybe not so much. If the use of a peer dependency is intentional " +
|
"other cases - maybe not so much. If the use of a peer dependency is intentional " +
|
||||||
"add an exception to your dependency-cruiser configuration.",
|
"add an exception to your dependency-cruiser configuration.",
|
||||||
severity: "warn",
|
severity: "error",
|
||||||
from: {},
|
from: {},
|
||||||
to: {
|
to: {
|
||||||
dependencyTypes: ["npm-peer"],
|
dependencyTypes: ["npm-peer"],
|
||||||
@ -196,6 +195,7 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
options: {
|
options: {
|
||||||
|
exclude: ["src/plugins/vite/*", "src/vite.env.d.ts"],
|
||||||
/* Which modules not to follow further when encountered */
|
/* Which modules not to follow further when encountered */
|
||||||
doNotFollow: {
|
doNotFollow: {
|
||||||
/* path: an array of regular expressions in strings to match against */
|
/* path: an array of regular expressions in strings to match against */
|
||||||
@ -235,7 +235,7 @@ module.exports = {
|
|||||||
true: also detect dependencies that only exist before typescript-to-javascript compilation
|
true: also detect dependencies that only exist before typescript-to-javascript compilation
|
||||||
"specify": for each dependency identify whether it only exists before compilation or also after
|
"specify": for each dependency identify whether it only exists before compilation or also after
|
||||||
*/
|
*/
|
||||||
// tsPreCompilationDeps: false,
|
tsPreCompilationDeps: true,
|
||||||
|
|
||||||
/* list of extensions to scan that aren't javascript or compile-to-javascript.
|
/* list of extensions to scan that aren't javascript or compile-to-javascript.
|
||||||
Empty by default. Only put extensions in here that you want to take into
|
Empty by default. Only put extensions in here that you want to take into
|
||||||
|
42
.github/workflows/linting.yml
vendored
Normal file
42
.github/workflows/linting.yml
vendored
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
name: Linting
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- beta
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- beta
|
||||||
|
merge_group:
|
||||||
|
types: [checks_requested]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
run-linters:
|
||||||
|
name: Run linters
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Check out Git repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
submodules: 'recursive'
|
||||||
|
|
||||||
|
- name: Set up Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version-file: '.nvmrc'
|
||||||
|
cache: 'npm'
|
||||||
|
|
||||||
|
- name: Install Node.js dependencies
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Run ESLint
|
||||||
|
run: npm run eslint-ci
|
||||||
|
|
||||||
|
- name: Lint with Biome
|
||||||
|
run: npm run biome-ci
|
||||||
|
|
||||||
|
- name: Check dependencies with depcruise
|
||||||
|
run: npm run depcruise
|
41
.github/workflows/quality.yml
vendored
41
.github/workflows/quality.yml
vendored
@ -1,41 +0,0 @@
|
|||||||
name: Biome Code Quality
|
|
||||||
|
|
||||||
on:
|
|
||||||
# Trigger the workflow on push or pull request,
|
|
||||||
# but only for the main branch
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main # Trigger on push events to the main branch
|
|
||||||
- beta # Trigger on push events to the beta branch
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- main # Trigger on pull request events targeting the main branch
|
|
||||||
- beta # Trigger on pull request events targeting the beta branch
|
|
||||||
merge_group:
|
|
||||||
types: [checks_requested]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
run-linters: # Define a job named "run-linters"
|
|
||||||
name: Run linters # Human-readable name for the job
|
|
||||||
runs-on: ubuntu-latest # Specify the latest Ubuntu runner for the job
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Check out Git repository # Step to check out the repository
|
|
||||||
uses: actions/checkout@v4 # Use the checkout action version 4
|
|
||||||
with:
|
|
||||||
submodules: 'recursive'
|
|
||||||
|
|
||||||
- name: Set up Node.js # Step to set up Node.js environment
|
|
||||||
uses: actions/setup-node@v4 # Use the setup-node action version 4
|
|
||||||
with:
|
|
||||||
node-version-file: '.nvmrc'
|
|
||||||
cache: 'npm'
|
|
||||||
|
|
||||||
- name: Install Node.js dependencies # Step to install Node.js dependencies
|
|
||||||
run: npm ci # Use 'npm ci' to install dependencies
|
|
||||||
|
|
||||||
- name: eslint # Step to run linters
|
|
||||||
run: npm run eslint-ci
|
|
||||||
|
|
||||||
- name: Lint with Biome # Step to run linters
|
|
||||||
run: npm run biome-ci
|
|
@ -20,7 +20,7 @@
|
|||||||
"biome": "biome check --write --changed --no-errors-on-unmatched",
|
"biome": "biome check --write --changed --no-errors-on-unmatched",
|
||||||
"biome-ci": "biome ci --diagnostic-level=error --reporter=github --no-errors-on-unmatched",
|
"biome-ci": "biome ci --diagnostic-level=error --reporter=github --no-errors-on-unmatched",
|
||||||
"docs": "typedoc",
|
"docs": "typedoc",
|
||||||
"depcruise": "depcruise src",
|
"depcruise": "depcruise src test",
|
||||||
"depcruise:graph": "depcruise src --output-type dot | node dependency-graph.js > dependency-graph.svg",
|
"depcruise:graph": "depcruise src --output-type dot | node dependency-graph.js > dependency-graph.svg",
|
||||||
"postinstall": "npx lefthook install && npx lefthook run post-merge",
|
"postinstall": "npx lefthook install && npx lefthook run post-merge",
|
||||||
"update-version:patch": "npm version patch --force --no-git-tag-version",
|
"update-version:patch": "npm version patch --force --no-git-tag-version",
|
||||||
|
@ -1,12 +1,18 @@
|
|||||||
import { globalScene } from "#app/global-scene";
|
import { globalScene } from "#app/global-scene";
|
||||||
import { allMoves } from "./data-lists";
|
import { allMoves } from "#app/data/data-lists";
|
||||||
import { MoveFlags } from "#enums/MoveFlags";
|
import { MoveFlags } from "#enums/MoveFlags";
|
||||||
import type Pokemon from "../field/pokemon";
|
import type Pokemon from "#app/field/pokemon";
|
||||||
import { type nil, getFrameMs, getEnumKeys, getEnumValues, animationFileName, coerceArray } from "../utils/common";
|
import {
|
||||||
|
type nil,
|
||||||
|
getFrameMs,
|
||||||
|
getEnumKeys,
|
||||||
|
getEnumValues,
|
||||||
|
animationFileName,
|
||||||
|
coerceArray,
|
||||||
|
isNullOrUndefined,
|
||||||
|
} from "#app/utils/common";
|
||||||
import type { BattlerIndex } from "#enums/battler-index";
|
import type { BattlerIndex } from "#enums/battler-index";
|
||||||
import { MoveId } from "#enums/move-id";
|
import { MoveId } from "#enums/move-id";
|
||||||
import { SubstituteTag } from "./battler-tags";
|
|
||||||
import { isNullOrUndefined } from "../utils/common";
|
|
||||||
import Phaser from "phaser";
|
import Phaser from "phaser";
|
||||||
import { EncounterAnim } from "#enums/encounter-anims";
|
import { EncounterAnim } from "#enums/encounter-anims";
|
||||||
import { AnimBlendType, AnimFrameTarget, AnimFocus, ChargeAnim, CommonAnim } from "#enums/move-anims-common";
|
import { AnimBlendType, AnimFrameTarget, AnimFocus, ChargeAnim, CommonAnim } from "#enums/move-anims-common";
|
||||||
@ -845,7 +851,7 @@ export abstract class BattleAnim {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const targetSubstitute = !!onSubstitute && user !== target ? target.getTag(SubstituteTag) : null;
|
const targetSubstitute = !!onSubstitute && user !== target ? target.getTag(BattlerTagType.SUBSTITUTE) : null;
|
||||||
|
|
||||||
const userSprite = user.getSprite();
|
const userSprite = user.getSprite();
|
||||||
const targetSprite = targetSubstitute?.sprite ?? target.getSprite();
|
const targetSprite = targetSubstitute?.sprite ?? target.getSprite();
|
||||||
|
Loading…
Reference in New Issue
Block a user