{ "$schema": "https://biomejs.dev/schemas/2.2.0/schema.json", "vcs": { "enabled": true, "clientKind": "git", "useIgnoreFile": true, "defaultBranch": "beta" }, "formatter": { "enabled": true, "useEditorconfig": true, "indentStyle": "space", "includes": ["**", "!**/src/enums", "!**/src/data/balance"], "lineWidth": 120 }, "files": { "ignoreUnknown": true, // Adding folders to the ignore list is GREAT for performance because it prevents biome from descending into them // and having to verify whether each individual file is ignored "includes": [ "**", "!**/dist", "!**/coverage", "!**/public", "!**/.github", "!**/node_modules", "!**/typedoc", // TODO: lint css and html? "!**/*.css", "!**/*.html", // TODO: enable linting this file "!**/src/data/moves/move.ts", // this file is too big "!**/src/data/balance/tms.ts" ] }, "assist": { "actions": { "source": { "organizeImports": { "level": "on", "options": { "groups": [":ALIAS:", ":NODE:", ":PACKAGE_WITH_PROTOCOL:", ":PACKAGE:", ":PATH:"] } } } } }, "linter": { "enabled": true, "rules": { "recommended": true, "correctness": { "noUndeclaredVariables": "error", "noUnusedVariables": "error", "noSwitchDeclarations": "error", "noVoidTypeReturn": "error", "noUnusedImports": { "level": "error", "fix": "safe", "options": {} }, "noUnusedFunctionParameters": "error", "noUnusedLabels": "error", "noPrivateImports": "error", "useSingleJsDocAsterisk": "error", "useJsonImportAttributes": "off" // "Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. ts(2823)" }, "style": { "useReadonlyClassProperties": { "level": "info", // TODO: Graduate to error eventually "options": { "checkAllProperties": true } }, "useConsistentObjectDefinitions": { "level": "error", "options": { "syntax": "shorthand" } }, "useCollapsedIf": "error", "useCollapsedElseIf": "error", "noDoneCallback": "error", "noSubstr": "error", "noYodaExpression": "error", "useForOf": "error", "useEnumInitializers": "off", // large enums like MoveId/SpeciesId would make this cumbersome "useBlockStatements": { "level": "error", "fix": "safe", "options": {} }, "useConst": "error", "useImportType": "error", "noNonNullAssertion": "off", // TODO: Turn this on ASAP and fix all non-null assertions in non-test files "noParameterAssign": "off", "useExponentiationOperator": "off", // Too typo-prone and easy to mixup with standard multiplication (* vs **) "useDefaultParameterLast": { // TODO: Fix spots in the codebase where this flag would be triggered // and then set to "error" and re-enable the fixer "level": "warn", "fix": "none", "options": {} }, "useSingleVarDeclarator": { "level": "error", "fix": "safe", "options": {} }, "useNodejsImportProtocol": "off", "useTemplate": "off", // string concatenation is faster: https://stackoverflow.com/questions/29055518/are-es6-template-literals-faster-than-string-concatenation "useAsConstAssertion": "error", "noUnusedTemplateLiteral": "error", "useNumberNamespace": "error", "noInferrableTypes": "error", "noUselessElse": "error", "noRestrictedTypes": { "level": "error", "options": { "types": { "integer": { "message": "This is an alias for 'number' that can provide false impressions of what values can actually be contained in this variable. Use 'number' instead.", "use": "number" } } } }, "useUnifiedTypeSignatures": "error", "useGroupedAccessorPairs": "error", "useObjectSpread": "error", "useNumericSeparators": "off" // TODO: Consider enabling? }, "suspicious": { "noDoubleEquals": "error", // While this would be a nice rule to enable, the current structure of the codebase makes this infeasible // due to being used for move/ability `args` params and save data-related code. // This can likely be enabled for all non-utils files once these are eventually reworked, but until then we leave it off. "noExplicitAny": "off", "noAssignInExpressions": "off", "noPrototypeBuiltins": "off", // TODO: enable this "noFallthroughSwitchClause": "error", // Prevents accidental automatic fallthroughs in switch cases (use disable comment if needed) "noImplicitAnyLet": "warn", // TODO: Refactor and make this an error "noRedeclare": "info", // TODO: Refactor and make this an error "noGlobalIsNan": "error", "noAsyncPromiseExecutor": "warn", // TODO: Refactor and make this an error "noVar": "error", "noDocumentCookie": "off", // Firefox has minimal support for the "Cookie Store API" "noConstantBinaryExpressions": "error", "noTsIgnore": "error", "useIterableCallbackReturn": "warn" // TODO: Refactor and change to error }, "complexity": { "noUselessStringConcat": "error", "noExcessiveCognitiveComplexity": "info", // TODO: Refactor and make this an error "useLiteralKeys": "off", // TODO: enable? "noForEach": "off", // Foreach vs for of is not that simple. "noUselessSwitchCase": "off", // Explicit > Implicit "noUselessConstructor": "error", "noBannedTypes": "warn", // TODO: Refactor and make this an error "noThisInStatic": "error", "noUselessThisAlias": "error", "noUselessTernary": "error", "useIndexOf": "error" }, "performance": { "noNamespaceImport": "error", "noDelete": "error", "noBarrelFile": "error" }, "nursery": { "useMaxParams": { "level": "warn", // TODO: Change to "error" eventually "options": { "max": 4 } // TODO: is this ok? }, "noShadow": "warn" // TODO: refactor and make "error" } } }, "javascript": { "formatter": { "quoteStyle": "double", "arrowParentheses": "asNeeded", "operatorLinebreak": "before" }, "globals": ["Phaser"], "parser": { "jsxEverywhere": false } }, "overrides": [ { "includes": ["**/test/**/*.test.ts"], "linter": { "rules": { "performance": { "noDelete": "off", // TODO: evaluate if this is necessary for the test(s) to function "noNamespaceImport": "off" // this is required for `vi.spyOn` to work in some tests }, "style": { "noNonNullAssertion": "off" // tedious in some tests }, "nursery": { "noFloatingPromises": "error" } } } }, // Overrides to prevent unused import removal inside `overrides.ts` and enums files (for TSDoc linkcodes), // as well as in all TS files in `scripts/` (which are assumed to be boilerplate templates). { "includes": ["**/src/overrides.ts", "**/src/enums", "**/scripts/**/*.ts", "**/*.d.ts"], "linter": { "rules": { "correctness": { "noUnusedImports": "off" } } } }, { "includes": ["**/src/overrides.ts", "**/scripts/**/*.ts"], "linter": { "rules": { "style": { "useImportType": "off" } } } } ] }