Added and enforced no-fallthrough

This commit is contained in:
Bertie690 2025-04-24 20:15:22 -04:00
parent 6dc2a7fddc
commit ba2bf7dd01
10 changed files with 46 additions and 16 deletions

View File

@ -38,6 +38,9 @@
"src/data/balance/tms.ts"
]
},
// While it'd be nice to enable consistent sorting, this stuff screws with circular import resolution order
// TODO: Remove if we ever get down to 0 circular imports
"organizeImports": { "enabled": false },
"linter": {
"ignore": [
@ -55,13 +58,13 @@
},
"style": {
"noVar": "error",
"useEnumInitializers": "off",
"useEnumInitializers": "off", // have fun explicitly numbering all 1000+ species, moves, etc. lol
"useBlockStatements": "error",
"useConst": "error",
"useImportType": "error",
"noNonNullAssertion": "off", // TODO: Turn this on ASAP and fix all non-null assertions
"noParameterAssign": "off",
"useExponentiationOperator": "off",
"useExponentiationOperator": "off", // Too typo-prone and easy to mixup with standard multiplication
"useDefaultParameterLast": "off", // TODO: Fix spots in the codebase where this flag would be triggered, and then enable
"useSingleVarDeclarator": "off",
"useNodejsImportProtocol": "off",
@ -70,10 +73,10 @@
},
"suspicious": {
"noDoubleEquals": "error",
"noExplicitAny": "off",
"noExplicitAny": "off", // TODO: Refactor and make this an error after save data refactored
"noAssignInExpressions": "off",
"noPrototypeBuiltins": "off",
"noFallthroughSwitchClause": "off",
"noFallthroughSwitchClause": "off", // Handled by ESLint due to not supporting simple "falls through" commenst
"noImplicitAnyLet": "info", // TODO: Refactor and make this an error
"noRedeclare": "off", // TODO: Refactor and make this an error
"noGlobalIsNan": "off",

View File

@ -1,9 +1,10 @@
import tseslint from "@typescript-eslint/eslint-plugin";
/** @ts-check */
import tseslint from "typescript-eslint";
import stylisticTs from "@stylistic/eslint-plugin-ts";
import parser from "@typescript-eslint/parser";
import importX from "eslint-plugin-import-x";
export default [
export default tseslint.config(
{
name: "eslint-config",
files: ["src/**/*.{ts,tsx,js,jsx}", "test/**/*.{ts,tsx,js,jsx}"],
@ -14,12 +15,14 @@ export default [
plugins: {
"import-x": importX,
"@stylistic/ts": stylisticTs,
"@typescript-eslint": tseslint,
"@typescript-eslint": tseslint.plugin,
},
rules: {
"prefer-const": "error", // Enforces the use of `const` for variables that are never reassigned
// Prevent fallthrough on switch without an explicit "falls through" comment.
// Note: Move to biome if/when they add "falls through" comments
"no-fallthrough": ["error", { commentPattern: "falls through" }],
"no-undef": "off", // Disables the rule that disallows the use of undeclared variables (TypeScript handles this)
"no-extra-semi": ["error"], // Disallows unnecessary semicolons for TypeScript-specific syntax
"no-extra-semi": "error", // Disallows unnecessary semicolons for TypeScript-specific syntax
"import-x/extensions": ["error", "never", { json: "always" }], // Enforces no extension for imports unless json
},
},
@ -33,11 +36,11 @@ export default [
},
},
plugins: {
"@typescript-eslint": tseslint,
"@typescript-eslint": tseslint.plugin,
},
rules: {
"@typescript-eslint/no-floating-promises": "error", // Require Promise-like statements to be handled appropriately. - https://typescript-eslint.io/rules/no-floating-promises/
"@typescript-eslint/no-misused-promises": "error", // Disallow Promises in places not designed to handle them. - https://typescript-eslint.io/rules/no-misused-promises/
},
},
];
);

20
package-lock.json generated
View File

@ -19,7 +19,8 @@
"json-stable-stringify": "^1.2.0",
"jszip": "^3.10.1",
"phaser": "^3.88.2",
"phaser3-rex-plugins": "^1.80.15"
"phaser3-rex-plugins": "^1.80.15",
"save-dev": "^0.0.1-security"
},
"devDependencies": {
"@biomejs/biome": "1.9.4",
@ -5226,6 +5227,18 @@
"moo-color": "^1.0.2"
}
},
"node_modules/jiti": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/jiti/-/jiti-2.4.2.tgz",
"integrity": "sha512-rg9zJN+G4n2nfJl5MW3BMygZX56zKPNVEYYqq7adpmMh4Jn2QNEwhvQlFy6jPVdcod7txZtKHWnyZiA3a0zP7A==",
"dev": true,
"license": "MIT",
"optional": true,
"peer": true,
"bin": {
"jiti": "lib/jiti-cli.mjs"
}
},
"node_modules/js-tokens": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
@ -6671,6 +6684,11 @@
"dev": true,
"license": "MIT"
},
"node_modules/save-dev": {
"version": "0.0.1-security",
"resolved": "https://registry.npmjs.org/save-dev/-/save-dev-0.0.1-security.tgz",
"integrity": "sha512-k6knZTDNK8PKKbIqnvxiOveJinuw2LcQjqDoaorZWP9M5AR2EPsnpDeSbeoZZ0pHr5ze1uoaKdK8NBGQrJ34Uw=="
},
"node_modules/saxes": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/saxes/-/saxes-6.0.0.tgz",

View File

@ -64,7 +64,8 @@
"json-stable-stringify": "^1.2.0",
"jszip": "^3.10.1",
"phaser": "^3.88.2",
"phaser3-rex-plugins": "^1.80.15"
"phaser3-rex-plugins": "^1.80.15",
"save-dev": "^0.0.1-security"
},
"engines": {
"node": ">=22.0.0"

@ -1 +1 @@
Subproject commit 18c1963ef309612a5a7fef76f9879709a7202189
Subproject commit e98f0eb9c2022bc78b53f0444424c636498e725a

View File

@ -488,6 +488,7 @@ export abstract class PokemonSpeciesForm {
if (formSpriteKey.startsWith("behemoth")) {
formSpriteKey = "crowned";
}
break;
default:
ret += `-${formSpriteKey}`;
break;

View File

@ -369,6 +369,7 @@ export function getRandomWeatherType(arena: Arena): WeatherType {
if (hasSun) {
weatherPool.push({ weatherType: WeatherType.SUNNY, weight: 2 });
}
break;
case Biome.VOLCANO:
weatherPool = [
{

View File

@ -804,6 +804,7 @@ export function setSetting(setting: string, value: number): boolean {
break;
case SettingKeys.Candy_Upgrade_Display:
globalScene.candyUpgradeDisplay = value;
break;
case SettingKeys.Money_Format:
switch (Setting[index].options[value].value) {
case "Normal":

View File

@ -176,11 +176,13 @@ export class UiInputs {
return;
}
switch (globalScene.ui?.getMode()) {
case UiMode.MESSAGE:
case UiMode.MESSAGE: {
const messageHandler = globalScene.ui.getHandler<MessageUiHandler>();
if (!messageHandler.pendingPrompt || messageHandler.isTextAnimationInProgress()) {
return;
}
// falls through
}
case UiMode.TITLE:
case UiMode.COMMAND:
case UiMode.MODIFIER_SELECT:

View File

@ -7,7 +7,7 @@
"esModuleInterop": true,
"strictNullChecks": true,
"sourceMap": false,
"strict": false,
"strict": false, // TODO: Enable this eventually
"rootDir": ".",
"baseUrl": "./src",
"paths": {