From 50cebc6a450dbf6b8c179c961d773001ae4223bc Mon Sep 17 00:00:00 2001 From: Bertie690 Date: Thu, 14 Aug 2025 10:14:09 -0400 Subject: [PATCH] Upgraded to Biome 2.2.0; added `operatorLinebreak` and a few new rules --- biome.jsonc | 77 ++++++++++++++++++++++++++++++-------------------- package.json | 2 +- pnpm-lock.yaml | 74 ++++++++++++++++++++++++------------------------ 3 files changed, 84 insertions(+), 69 deletions(-) diff --git a/biome.jsonc b/biome.jsonc index ba59ed0bc1f..6685f4595ae 100644 --- a/biome.jsonc +++ b/biome.jsonc @@ -1,6 +1,5 @@ { - // ! Just ignore the errors for now guys. - "$schema": "https://biomejs.dev/schemas/2.1.4/schema.json", + "$schema": "https://biomejs.dev/schemas/2.2.0/schema.json", "vcs": { "enabled": true, "clientKind": "git", @@ -11,7 +10,7 @@ "enabled": true, "useEditorconfig": true, "indentStyle": "space", - "includes": ["**", "!**/src/enums/**/*", "!**/src/data/balance/**/*"], + "includes": ["**", "!**/src/enums", "!**/src/data/balance"], "lineWidth": 120 }, "files": { @@ -20,12 +19,12 @@ // and having to verify whether each individual file is ignored "includes": [ "**", - "!**/dist/**/*", - "!**/coverage/**/*", - "!**/public/**/*", - "!**/.github/**/*", - "!**/node_modules/**/*", - "!**/typedoc/**/*", + "!**/dist", + "!**/coverage", + "!**/public", + "!**/.github", + "!**/node_modules", + "!**/typedoc", // TODO: lint css and html? "!**/*.css", "!**/*.html", @@ -58,23 +57,35 @@ "noVoidTypeReturn": "error", "noUnusedImports": { "level": "error", - "fix": "safe" + "fix": "safe", + "options": {} }, "noUnusedFunctionParameters": "error", "noUnusedLabels": "error", - "noPrivateImports": "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 Moves/Species would make this cumbersome + "useEnumInitializers": "off", // large enums like MoveId/SpeciesId would make this cumbersome "useBlockStatements": { "level": "error", - "fix": "safe" + "fix": "safe", + "options": {} }, "useConst": "error", "useImportType": "error", @@ -85,11 +96,13 @@ // 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" + "fix": "none", + "options": {} }, "useSingleVarDeclarator": { "level": "error", - "fix": "safe" + "fix": "safe", + "options": {} }, "useNodejsImportProtocol": "off", "useTemplate": "off", // string concatenation is faster: https://stackoverflow.com/questions/29055518/are-es6-template-literals-faster-than-string-concatenation @@ -108,7 +121,11 @@ } } } - } + }, + "useUnifiedTypeSignatures": "error", + "useGroupedAccessorPairs": "error", + "useObjectSpread": "error", + "useNumericSeparators": "off" // TODO: Consider enabling? }, "suspicious": { "noDoubleEquals": "error", @@ -124,7 +141,10 @@ "noGlobalIsNan": "error", "noAsyncPromiseExecutor": "warn", // TODO: Refactor and make this an error "noVar": "error", - "noDocumentCookie": "off" // Firefox has minimal support for the "Cookie Store API" + "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", @@ -136,7 +156,8 @@ "noBannedTypes": "warn", // TODO: Refactor and make this an error "noThisInStatic": "error", "noUselessThisAlias": "error", - "noUselessTernary": "error" + "noUselessTernary": "error", + "useIndexOf": "error" }, "performance": { "noNamespaceImport": "error", @@ -144,17 +165,10 @@ "noBarrelFile": "error" }, "nursery": { - "useSingleJsDocAsterisk": "error", - "useUnifiedTypeSignature": "error", - "useAdjacentGetterSetter": "error", - "noConstantBinaryExpression": "error", - "noTsIgnore": "error", - "noAwaitInLoop": "off", // we do this a lot - "useJsonImportAttribute": "off", // "Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. ts(2823)" - "useIndexOf": "error", - "useObjectSpread": "error", - "useNumericSeparators": "off", // TODO: enable? - "useIterableCallbackReturn": "warn", // TODO: refactor and make "error" + "useMaxParams": { + "level": "warn", // TODO: Change to "error" eventually + "options": { "max": 4 } // TODO: is this ok? + }, "noShadow": "warn" // TODO: refactor and make "error" } } @@ -162,7 +176,8 @@ "javascript": { "formatter": { "quoteStyle": "double", - "arrowParentheses": "asNeeded" + "arrowParentheses": "asNeeded", + "operatorLinebreak": "before" }, "globals": ["Phaser"], "parser": { @@ -179,7 +194,7 @@ "noNamespaceImport": "off" // this is required for `vi.spyOn` to work in some tests }, "style": { - "noNonNullAssertion": "off" + "noNonNullAssertion": "off" // tedious in some tests }, "nursery": { "noFloatingPromises": "error" diff --git a/package.json b/package.json index cbb33749977..09adf60e890 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "update-locales:remote": "git submodule update --progress --init --recursive --force --remote" }, "devDependencies": { - "@biomejs/biome": "2.1.4", + "@biomejs/biome": "2.2.0", "@ls-lint/ls-lint": "2.3.1", "@types/crypto-js": "^4.2.0", "@types/jsdom": "^21.1.7", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 98731152faa..2414df2a160 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -43,8 +43,8 @@ importers: version: 1.80.16(graphology-types@0.24.8) devDependencies: '@biomejs/biome': - specifier: 2.1.4 - version: 2.1.4 + specifier: 2.2.0 + version: 2.2.0 '@ls-lint/ls-lint': specifier: 2.3.1 version: 2.3.1 @@ -195,55 +195,55 @@ packages: resolution: {integrity: sha512-ruv7Ae4J5dUYULmeXw1gmb7rYRz57OWCPM57pHojnLq/3Z1CK2lNSLTCVjxVk1F/TZHwOZZrOWi0ur95BbLxNQ==} engines: {node: '>=6.9.0'} - '@biomejs/biome@2.1.4': - resolution: {integrity: sha512-QWlrqyxsU0FCebuMnkvBIkxvPqH89afiJzjMl+z67ybutse590jgeaFdDurE9XYtzpjRGTI1tlUZPGWmbKsElA==} + '@biomejs/biome@2.2.0': + resolution: {integrity: sha512-3On3RSYLsX+n9KnoSgfoYlckYBoU6VRM22cw1gB4Y0OuUVSYd/O/2saOJMrA4HFfA1Ff0eacOvMN1yAAvHtzIw==} engines: {node: '>=14.21.3'} hasBin: true - '@biomejs/cli-darwin-arm64@2.1.4': - resolution: {integrity: sha512-sCrNENE74I9MV090Wq/9Dg7EhPudx3+5OiSoQOkIe3DLPzFARuL1dOwCWhKCpA3I5RHmbrsbNSRfZwCabwd8Qg==} + '@biomejs/cli-darwin-arm64@2.2.0': + resolution: {integrity: sha512-zKbwUUh+9uFmWfS8IFxmVD6XwqFcENjZvEyfOxHs1epjdH3wyyMQG80FGDsmauPwS2r5kXdEM0v/+dTIA9FXAg==} engines: {node: '>=14.21.3'} cpu: [arm64] os: [darwin] - '@biomejs/cli-darwin-x64@2.1.4': - resolution: {integrity: sha512-gOEICJbTCy6iruBywBDcG4X5rHMbqCPs3clh3UQ+hRKlgvJTk4NHWQAyHOXvaLe+AxD1/TNX1jbZeffBJzcrOw==} + '@biomejs/cli-darwin-x64@2.2.0': + resolution: {integrity: sha512-+OmT4dsX2eTfhD5crUOPw3RPhaR+SKVspvGVmSdZ9y9O/AgL8pla6T4hOn1q+VAFBHuHhsdxDRJgFCSC7RaMOw==} engines: {node: '>=14.21.3'} cpu: [x64] os: [darwin] - '@biomejs/cli-linux-arm64-musl@2.1.4': - resolution: {integrity: sha512-nYr7H0CyAJPaLupFE2cH16KZmRC5Z9PEftiA2vWxk+CsFkPZQ6dBRdcC6RuS+zJlPc/JOd8xw3uCCt9Pv41WvQ==} + '@biomejs/cli-linux-arm64-musl@2.2.0': + resolution: {integrity: sha512-egKpOa+4FL9YO+SMUMLUvf543cprjevNc3CAgDNFLcjknuNMcZ0GLJYa3EGTCR2xIkIUJDVneBV3O9OcIlCEZQ==} engines: {node: '>=14.21.3'} cpu: [arm64] os: [linux] - '@biomejs/cli-linux-arm64@2.1.4': - resolution: {integrity: sha512-juhEkdkKR4nbUi5k/KRp1ocGPNWLgFRD4NrHZSveYrD6i98pyvuzmS9yFYgOZa5JhaVqo0HPnci0+YuzSwT2fw==} + '@biomejs/cli-linux-arm64@2.2.0': + resolution: {integrity: sha512-6eoRdF2yW5FnW9Lpeivh7Mayhq0KDdaDMYOJnH9aT02KuSIX5V1HmWJCQQPwIQbhDh68Zrcpl8inRlTEan0SXw==} engines: {node: '>=14.21.3'} cpu: [arm64] os: [linux] - '@biomejs/cli-linux-x64-musl@2.1.4': - resolution: {integrity: sha512-lvwvb2SQQHctHUKvBKptR6PLFCM7JfRjpCCrDaTmvB7EeZ5/dQJPhTYBf36BE/B4CRWR2ZiBLRYhK7hhXBCZAg==} + '@biomejs/cli-linux-x64-musl@2.2.0': + resolution: {integrity: sha512-I5J85yWwUWpgJyC1CcytNSGusu2p9HjDnOPAFG4Y515hwRD0jpR9sT9/T1cKHtuCvEQ/sBvx+6zhz9l9wEJGAg==} engines: {node: '>=14.21.3'} cpu: [x64] os: [linux] - '@biomejs/cli-linux-x64@2.1.4': - resolution: {integrity: sha512-Eoy9ycbhpJVYuR+LskV9s3uyaIkp89+qqgqhGQsWnp/I02Uqg2fXFblHJOpGZR8AxdB9ADy87oFVxn9MpFKUrw==} + '@biomejs/cli-linux-x64@2.2.0': + resolution: {integrity: sha512-5UmQx/OZAfJfi25zAnAGHUMuOd+LOsliIt119x2soA2gLggQYrVPA+2kMUxR6Mw5M1deUF/AWWP2qpxgH7Nyfw==} engines: {node: '>=14.21.3'} cpu: [x64] os: [linux] - '@biomejs/cli-win32-arm64@2.1.4': - resolution: {integrity: sha512-3WRYte7orvyi6TRfIZkDN9Jzoogbv+gSvR+b9VOXUg1We1XrjBg6WljADeVEaKTvOcpVdH0a90TwyOQ6ue4fGw==} + '@biomejs/cli-win32-arm64@2.2.0': + resolution: {integrity: sha512-n9a1/f2CwIDmNMNkFs+JI0ZjFnMO0jdOyGNtihgUNFnlmd84yIYY2KMTBmMV58ZlVHjgmY5Y6E1hVTnSRieggA==} engines: {node: '>=14.21.3'} cpu: [arm64] os: [win32] - '@biomejs/cli-win32-x64@2.1.4': - resolution: {integrity: sha512-tBc+W7anBPSFXGAoQW+f/+svkpt8/uXfRwDzN1DvnatkRMt16KIYpEi/iw8u9GahJlFv98kgHcIrSsZHZTR0sw==} + '@biomejs/cli-win32-x64@2.2.0': + resolution: {integrity: sha512-Nawu5nHjP/zPKTIryh2AavzTc/KEg4um/MxWdXW0A6P/RZOyIpa7+QSjeXwAwX/utJGaCoXRPWtF3m5U/bB3Ww==} engines: {node: '>=14.21.3'} cpu: [x64] os: [win32] @@ -2154,39 +2154,39 @@ snapshots: '@babel/helper-string-parser': 7.27.1 '@babel/helper-validator-identifier': 7.27.1 - '@biomejs/biome@2.1.4': + '@biomejs/biome@2.2.0': optionalDependencies: - '@biomejs/cli-darwin-arm64': 2.1.4 - '@biomejs/cli-darwin-x64': 2.1.4 - '@biomejs/cli-linux-arm64': 2.1.4 - '@biomejs/cli-linux-arm64-musl': 2.1.4 - '@biomejs/cli-linux-x64': 2.1.4 - '@biomejs/cli-linux-x64-musl': 2.1.4 - '@biomejs/cli-win32-arm64': 2.1.4 - '@biomejs/cli-win32-x64': 2.1.4 + '@biomejs/cli-darwin-arm64': 2.2.0 + '@biomejs/cli-darwin-x64': 2.2.0 + '@biomejs/cli-linux-arm64': 2.2.0 + '@biomejs/cli-linux-arm64-musl': 2.2.0 + '@biomejs/cli-linux-x64': 2.2.0 + '@biomejs/cli-linux-x64-musl': 2.2.0 + '@biomejs/cli-win32-arm64': 2.2.0 + '@biomejs/cli-win32-x64': 2.2.0 - '@biomejs/cli-darwin-arm64@2.1.4': + '@biomejs/cli-darwin-arm64@2.2.0': optional: true - '@biomejs/cli-darwin-x64@2.1.4': + '@biomejs/cli-darwin-x64@2.2.0': optional: true - '@biomejs/cli-linux-arm64-musl@2.1.4': + '@biomejs/cli-linux-arm64-musl@2.2.0': optional: true - '@biomejs/cli-linux-arm64@2.1.4': + '@biomejs/cli-linux-arm64@2.2.0': optional: true - '@biomejs/cli-linux-x64-musl@2.1.4': + '@biomejs/cli-linux-x64-musl@2.2.0': optional: true - '@biomejs/cli-linux-x64@2.1.4': + '@biomejs/cli-linux-x64@2.2.0': optional: true - '@biomejs/cli-win32-arm64@2.1.4': + '@biomejs/cli-win32-arm64@2.2.0': optional: true - '@biomejs/cli-win32-x64@2.1.4': + '@biomejs/cli-win32-x64@2.2.0': optional: true '@bundled-es-modules/cookie@2.0.1':