From 6ebb31132faf0ba9b49edfd7edf5f37ec96f888f Mon Sep 17 00:00:00 2001 From: NightKev <34855794+DayKev@users.noreply.github.com> Date: Tue, 17 Jun 2025 13:00:52 -0700 Subject: [PATCH] Migrate `biome.jsonc` to 2.0 --- biome.jsonc | 90 ++++++++++++++++++++++++++++------------------------- 1 file changed, 48 insertions(+), 42 deletions(-) diff --git a/biome.jsonc b/biome.jsonc index d183334ad58..360091f1908 100644 --- a/biome.jsonc +++ b/biome.jsonc @@ -1,5 +1,5 @@ { - "$schema": "https://biomejs.dev/schemas/1.9.4/schema.json", + "$schema": "https://biomejs.dev/schemas/2.0.0/schema.json", "vcs": { "enabled": false, "clientKind": "git", @@ -10,35 +10,35 @@ "enabled": true, "useEditorconfig": true, "indentStyle": "space", - "ignore": ["src/enums/*", "src/data/balance/*"], + "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 - "ignore": [ - "**/*.d.ts", - "dist/*", - "build/*", - "coverage/*", - "public/*", - ".github/*", - "node_modules/*", - ".vscode/*", - "*.css", // TODO? - "*.html", // TODO? - // TODO: these files are too big and complex, ignore them until their respective refactors - "src/data/moves/move.ts", - - // this file is just too big: - "src/data/balance/tms.ts" + "includes": [ + "**", + "!**/*.d.ts", + "!**/dist/**/*", + "!**/build/**/*", + "!**/coverage/**/*", + "!**/public/**/*", + "!**/.github/**/*", + "!**/node_modules/**/*", + "!**/.vscode/**/*", + // 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" ] }, - // While it'd be nice to enable consistent sorting, enabling this causes issues due to circular import resolution order - // TODO: Remove if we ever get down to 0 circular imports - "organizeImports": { "enabled": false }, + // TODO: Configure and enable import sorting + "assist": { "actions": { "source": { "organizeImports": "off" } } }, "linter": { "enabled": true, "rules": { @@ -51,7 +51,6 @@ "noUnusedImports": "error" }, "style": { - "noVar": "error", "useEnumInitializers": "off", // large enums like Moves/Species would make this cumbersome "useBlockStatements": "error", "useConst": "error", @@ -63,7 +62,23 @@ "useSingleVarDeclarator": "off", "useNodejsImportProtocol": "off", "useTemplate": "off", // string concatenation is faster: https://stackoverflow.com/questions/29055518/are-es6-template-literals-faster-than-string-concatenation - "noNamespaceImport": "error" + "useAsConstAssertion": "error", + "useSelfClosingElements": "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" + } + } + } + } }, "suspicious": { "noDoubleEquals": "error", @@ -77,7 +92,8 @@ "noImplicitAnyLet": "warn", // TODO: Refactor and make this an error "noRedeclare": "info", // TODO: Refactor and make this an error "noGlobalIsNan": "off", - "noAsyncPromiseExecutor": "warn" // TODO: Refactor and make this an error + "noAsyncPromiseExecutor": "warn", // TODO: Refactor and make this an error + "noVar": "error" }, "complexity": { "noExcessiveCognitiveComplexity": "warn", // TODO: Refactor and make this an error @@ -87,18 +103,8 @@ "noUselessConstructor": "error", "noBannedTypes": "warn" // TODO: Refactor and make this an error }, - "nursery": { - "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" - } - } - } - } + "performance": { + "noNamespaceImport": "error" } } }, @@ -107,15 +113,15 @@ }, "overrides": [ { - "include": ["test/**/*.test.ts"], - "javascript": { "globals": [] }, + "includes": ["**/test/**/*.test.ts"], "linter": { "rules": { "performance": { - "noDelete": "off" // TODO: evaluate if this is necessary for the test(s) to function + "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": { - "noNamespaceImport": "off" // this is required for `vi.spyOn` to work in some tests + "noNonNullAssertion": "off" } } } @@ -123,7 +129,7 @@ // Overrides to prevent unused import removal inside `overrides.ts` and enums files (for TSDoc linkcodes) { - "include": ["src/overrides.ts", "src/enums/*"], + "includes": ["**/src/overrides.ts", "**/src/enums/**/*"], "linter": { "rules": { "correctness": { @@ -133,7 +139,7 @@ } }, { - "include": ["src/overrides.ts"], + "includes": ["**/src/overrides.ts"], "linter": { "rules": { "style": {