Upgraded to Biome 2.2.0; added operatorLinebreak and a few new rules

This commit is contained in:
Bertie690 2025-08-14 10:14:09 -04:00 committed by Sirz Benjie
parent 6a2c887c02
commit 50cebc6a45
No known key found for this signature in database
GPG Key ID: 4A524B4D196C759E
3 changed files with 84 additions and 69 deletions

View File

@ -1,6 +1,5 @@
{ {
// ! Just ignore the errors for now guys. "$schema": "https://biomejs.dev/schemas/2.2.0/schema.json",
"$schema": "https://biomejs.dev/schemas/2.1.4/schema.json",
"vcs": { "vcs": {
"enabled": true, "enabled": true,
"clientKind": "git", "clientKind": "git",
@ -11,7 +10,7 @@
"enabled": true, "enabled": true,
"useEditorconfig": true, "useEditorconfig": true,
"indentStyle": "space", "indentStyle": "space",
"includes": ["**", "!**/src/enums/**/*", "!**/src/data/balance/**/*"], "includes": ["**", "!**/src/enums", "!**/src/data/balance"],
"lineWidth": 120 "lineWidth": 120
}, },
"files": { "files": {
@ -20,12 +19,12 @@
// and having to verify whether each individual file is ignored // and having to verify whether each individual file is ignored
"includes": [ "includes": [
"**", "**",
"!**/dist/**/*", "!**/dist",
"!**/coverage/**/*", "!**/coverage",
"!**/public/**/*", "!**/public",
"!**/.github/**/*", "!**/.github",
"!**/node_modules/**/*", "!**/node_modules",
"!**/typedoc/**/*", "!**/typedoc",
// TODO: lint css and html? // TODO: lint css and html?
"!**/*.css", "!**/*.css",
"!**/*.html", "!**/*.html",
@ -58,23 +57,35 @@
"noVoidTypeReturn": "error", "noVoidTypeReturn": "error",
"noUnusedImports": { "noUnusedImports": {
"level": "error", "level": "error",
"fix": "safe" "fix": "safe",
"options": {}
}, },
"noUnusedFunctionParameters": "error", "noUnusedFunctionParameters": "error",
"noUnusedLabels": "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": { "style": {
"useReadonlyClassProperties": {
"level": "info", // TODO: Graduate to error eventually
"options": { "checkAllProperties": true }
},
"useConsistentObjectDefinitions": {
"level": "error",
"options": { "syntax": "shorthand" }
},
"useCollapsedIf": "error", "useCollapsedIf": "error",
"useCollapsedElseIf": "error", "useCollapsedElseIf": "error",
"noDoneCallback": "error", "noDoneCallback": "error",
"noSubstr": "error", "noSubstr": "error",
"noYodaExpression": "error", "noYodaExpression": "error",
"useForOf": "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": { "useBlockStatements": {
"level": "error", "level": "error",
"fix": "safe" "fix": "safe",
"options": {}
}, },
"useConst": "error", "useConst": "error",
"useImportType": "error", "useImportType": "error",
@ -85,11 +96,13 @@
// TODO: Fix spots in the codebase where this flag would be triggered // TODO: Fix spots in the codebase where this flag would be triggered
// and then set to "error" and re-enable the fixer // and then set to "error" and re-enable the fixer
"level": "warn", "level": "warn",
"fix": "none" "fix": "none",
"options": {}
}, },
"useSingleVarDeclarator": { "useSingleVarDeclarator": {
"level": "error", "level": "error",
"fix": "safe" "fix": "safe",
"options": {}
}, },
"useNodejsImportProtocol": "off", "useNodejsImportProtocol": "off",
"useTemplate": "off", // string concatenation is faster: https://stackoverflow.com/questions/29055518/are-es6-template-literals-faster-than-string-concatenation "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": { "suspicious": {
"noDoubleEquals": "error", "noDoubleEquals": "error",
@ -124,7 +141,10 @@
"noGlobalIsNan": "error", "noGlobalIsNan": "error",
"noAsyncPromiseExecutor": "warn", // TODO: Refactor and make this an error "noAsyncPromiseExecutor": "warn", // TODO: Refactor and make this an error
"noVar": "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": { "complexity": {
"noUselessStringConcat": "error", "noUselessStringConcat": "error",
@ -136,7 +156,8 @@
"noBannedTypes": "warn", // TODO: Refactor and make this an error "noBannedTypes": "warn", // TODO: Refactor and make this an error
"noThisInStatic": "error", "noThisInStatic": "error",
"noUselessThisAlias": "error", "noUselessThisAlias": "error",
"noUselessTernary": "error" "noUselessTernary": "error",
"useIndexOf": "error"
}, },
"performance": { "performance": {
"noNamespaceImport": "error", "noNamespaceImport": "error",
@ -144,17 +165,10 @@
"noBarrelFile": "error" "noBarrelFile": "error"
}, },
"nursery": { "nursery": {
"useSingleJsDocAsterisk": "error", "useMaxParams": {
"useUnifiedTypeSignature": "error", "level": "warn", // TODO: Change to "error" eventually
"useAdjacentGetterSetter": "error", "options": { "max": 4 } // TODO: is this ok?
"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"
"noShadow": "warn" // TODO: refactor and make "error" "noShadow": "warn" // TODO: refactor and make "error"
} }
} }
@ -162,7 +176,8 @@
"javascript": { "javascript": {
"formatter": { "formatter": {
"quoteStyle": "double", "quoteStyle": "double",
"arrowParentheses": "asNeeded" "arrowParentheses": "asNeeded",
"operatorLinebreak": "before"
}, },
"globals": ["Phaser"], "globals": ["Phaser"],
"parser": { "parser": {
@ -179,7 +194,7 @@
"noNamespaceImport": "off" // this is required for `vi.spyOn` to work in some tests "noNamespaceImport": "off" // this is required for `vi.spyOn` to work in some tests
}, },
"style": { "style": {
"noNonNullAssertion": "off" "noNonNullAssertion": "off" // tedious in some tests
}, },
"nursery": { "nursery": {
"noFloatingPromises": "error" "noFloatingPromises": "error"

View File

@ -31,7 +31,7 @@
"update-locales:remote": "git submodule update --progress --init --recursive --force --remote" "update-locales:remote": "git submodule update --progress --init --recursive --force --remote"
}, },
"devDependencies": { "devDependencies": {
"@biomejs/biome": "2.1.4", "@biomejs/biome": "2.2.0",
"@ls-lint/ls-lint": "2.3.1", "@ls-lint/ls-lint": "2.3.1",
"@types/crypto-js": "^4.2.0", "@types/crypto-js": "^4.2.0",
"@types/jsdom": "^21.1.7", "@types/jsdom": "^21.1.7",

View File

@ -43,8 +43,8 @@ importers:
version: 1.80.16(graphology-types@0.24.8) version: 1.80.16(graphology-types@0.24.8)
devDependencies: devDependencies:
'@biomejs/biome': '@biomejs/biome':
specifier: 2.1.4 specifier: 2.2.0
version: 2.1.4 version: 2.2.0
'@ls-lint/ls-lint': '@ls-lint/ls-lint':
specifier: 2.3.1 specifier: 2.3.1
version: 2.3.1 version: 2.3.1
@ -195,55 +195,55 @@ packages:
resolution: {integrity: sha512-ruv7Ae4J5dUYULmeXw1gmb7rYRz57OWCPM57pHojnLq/3Z1CK2lNSLTCVjxVk1F/TZHwOZZrOWi0ur95BbLxNQ==} resolution: {integrity: sha512-ruv7Ae4J5dUYULmeXw1gmb7rYRz57OWCPM57pHojnLq/3Z1CK2lNSLTCVjxVk1F/TZHwOZZrOWi0ur95BbLxNQ==}
engines: {node: '>=6.9.0'} engines: {node: '>=6.9.0'}
'@biomejs/biome@2.1.4': '@biomejs/biome@2.2.0':
resolution: {integrity: sha512-QWlrqyxsU0FCebuMnkvBIkxvPqH89afiJzjMl+z67ybutse590jgeaFdDurE9XYtzpjRGTI1tlUZPGWmbKsElA==} resolution: {integrity: sha512-3On3RSYLsX+n9KnoSgfoYlckYBoU6VRM22cw1gB4Y0OuUVSYd/O/2saOJMrA4HFfA1Ff0eacOvMN1yAAvHtzIw==}
engines: {node: '>=14.21.3'} engines: {node: '>=14.21.3'}
hasBin: true hasBin: true
'@biomejs/cli-darwin-arm64@2.1.4': '@biomejs/cli-darwin-arm64@2.2.0':
resolution: {integrity: sha512-sCrNENE74I9MV090Wq/9Dg7EhPudx3+5OiSoQOkIe3DLPzFARuL1dOwCWhKCpA3I5RHmbrsbNSRfZwCabwd8Qg==} resolution: {integrity: sha512-zKbwUUh+9uFmWfS8IFxmVD6XwqFcENjZvEyfOxHs1epjdH3wyyMQG80FGDsmauPwS2r5kXdEM0v/+dTIA9FXAg==}
engines: {node: '>=14.21.3'} engines: {node: '>=14.21.3'}
cpu: [arm64] cpu: [arm64]
os: [darwin] os: [darwin]
'@biomejs/cli-darwin-x64@2.1.4': '@biomejs/cli-darwin-x64@2.2.0':
resolution: {integrity: sha512-gOEICJbTCy6iruBywBDcG4X5rHMbqCPs3clh3UQ+hRKlgvJTk4NHWQAyHOXvaLe+AxD1/TNX1jbZeffBJzcrOw==} resolution: {integrity: sha512-+OmT4dsX2eTfhD5crUOPw3RPhaR+SKVspvGVmSdZ9y9O/AgL8pla6T4hOn1q+VAFBHuHhsdxDRJgFCSC7RaMOw==}
engines: {node: '>=14.21.3'} engines: {node: '>=14.21.3'}
cpu: [x64] cpu: [x64]
os: [darwin] os: [darwin]
'@biomejs/cli-linux-arm64-musl@2.1.4': '@biomejs/cli-linux-arm64-musl@2.2.0':
resolution: {integrity: sha512-nYr7H0CyAJPaLupFE2cH16KZmRC5Z9PEftiA2vWxk+CsFkPZQ6dBRdcC6RuS+zJlPc/JOd8xw3uCCt9Pv41WvQ==} resolution: {integrity: sha512-egKpOa+4FL9YO+SMUMLUvf543cprjevNc3CAgDNFLcjknuNMcZ0GLJYa3EGTCR2xIkIUJDVneBV3O9OcIlCEZQ==}
engines: {node: '>=14.21.3'} engines: {node: '>=14.21.3'}
cpu: [arm64] cpu: [arm64]
os: [linux] os: [linux]
'@biomejs/cli-linux-arm64@2.1.4': '@biomejs/cli-linux-arm64@2.2.0':
resolution: {integrity: sha512-juhEkdkKR4nbUi5k/KRp1ocGPNWLgFRD4NrHZSveYrD6i98pyvuzmS9yFYgOZa5JhaVqo0HPnci0+YuzSwT2fw==} resolution: {integrity: sha512-6eoRdF2yW5FnW9Lpeivh7Mayhq0KDdaDMYOJnH9aT02KuSIX5V1HmWJCQQPwIQbhDh68Zrcpl8inRlTEan0SXw==}
engines: {node: '>=14.21.3'} engines: {node: '>=14.21.3'}
cpu: [arm64] cpu: [arm64]
os: [linux] os: [linux]
'@biomejs/cli-linux-x64-musl@2.1.4': '@biomejs/cli-linux-x64-musl@2.2.0':
resolution: {integrity: sha512-lvwvb2SQQHctHUKvBKptR6PLFCM7JfRjpCCrDaTmvB7EeZ5/dQJPhTYBf36BE/B4CRWR2ZiBLRYhK7hhXBCZAg==} resolution: {integrity: sha512-I5J85yWwUWpgJyC1CcytNSGusu2p9HjDnOPAFG4Y515hwRD0jpR9sT9/T1cKHtuCvEQ/sBvx+6zhz9l9wEJGAg==}
engines: {node: '>=14.21.3'} engines: {node: '>=14.21.3'}
cpu: [x64] cpu: [x64]
os: [linux] os: [linux]
'@biomejs/cli-linux-x64@2.1.4': '@biomejs/cli-linux-x64@2.2.0':
resolution: {integrity: sha512-Eoy9ycbhpJVYuR+LskV9s3uyaIkp89+qqgqhGQsWnp/I02Uqg2fXFblHJOpGZR8AxdB9ADy87oFVxn9MpFKUrw==} resolution: {integrity: sha512-5UmQx/OZAfJfi25zAnAGHUMuOd+LOsliIt119x2soA2gLggQYrVPA+2kMUxR6Mw5M1deUF/AWWP2qpxgH7Nyfw==}
engines: {node: '>=14.21.3'} engines: {node: '>=14.21.3'}
cpu: [x64] cpu: [x64]
os: [linux] os: [linux]
'@biomejs/cli-win32-arm64@2.1.4': '@biomejs/cli-win32-arm64@2.2.0':
resolution: {integrity: sha512-3WRYte7orvyi6TRfIZkDN9Jzoogbv+gSvR+b9VOXUg1We1XrjBg6WljADeVEaKTvOcpVdH0a90TwyOQ6ue4fGw==} resolution: {integrity: sha512-n9a1/f2CwIDmNMNkFs+JI0ZjFnMO0jdOyGNtihgUNFnlmd84yIYY2KMTBmMV58ZlVHjgmY5Y6E1hVTnSRieggA==}
engines: {node: '>=14.21.3'} engines: {node: '>=14.21.3'}
cpu: [arm64] cpu: [arm64]
os: [win32] os: [win32]
'@biomejs/cli-win32-x64@2.1.4': '@biomejs/cli-win32-x64@2.2.0':
resolution: {integrity: sha512-tBc+W7anBPSFXGAoQW+f/+svkpt8/uXfRwDzN1DvnatkRMt16KIYpEi/iw8u9GahJlFv98kgHcIrSsZHZTR0sw==} resolution: {integrity: sha512-Nawu5nHjP/zPKTIryh2AavzTc/KEg4um/MxWdXW0A6P/RZOyIpa7+QSjeXwAwX/utJGaCoXRPWtF3m5U/bB3Ww==}
engines: {node: '>=14.21.3'} engines: {node: '>=14.21.3'}
cpu: [x64] cpu: [x64]
os: [win32] os: [win32]
@ -2154,39 +2154,39 @@ snapshots:
'@babel/helper-string-parser': 7.27.1 '@babel/helper-string-parser': 7.27.1
'@babel/helper-validator-identifier': 7.27.1 '@babel/helper-validator-identifier': 7.27.1
'@biomejs/biome@2.1.4': '@biomejs/biome@2.2.0':
optionalDependencies: optionalDependencies:
'@biomejs/cli-darwin-arm64': 2.1.4 '@biomejs/cli-darwin-arm64': 2.2.0
'@biomejs/cli-darwin-x64': 2.1.4 '@biomejs/cli-darwin-x64': 2.2.0
'@biomejs/cli-linux-arm64': 2.1.4 '@biomejs/cli-linux-arm64': 2.2.0
'@biomejs/cli-linux-arm64-musl': 2.1.4 '@biomejs/cli-linux-arm64-musl': 2.2.0
'@biomejs/cli-linux-x64': 2.1.4 '@biomejs/cli-linux-x64': 2.2.0
'@biomejs/cli-linux-x64-musl': 2.1.4 '@biomejs/cli-linux-x64-musl': 2.2.0
'@biomejs/cli-win32-arm64': 2.1.4 '@biomejs/cli-win32-arm64': 2.2.0
'@biomejs/cli-win32-x64': 2.1.4 '@biomejs/cli-win32-x64': 2.2.0
'@biomejs/cli-darwin-arm64@2.1.4': '@biomejs/cli-darwin-arm64@2.2.0':
optional: true optional: true
'@biomejs/cli-darwin-x64@2.1.4': '@biomejs/cli-darwin-x64@2.2.0':
optional: true optional: true
'@biomejs/cli-linux-arm64-musl@2.1.4': '@biomejs/cli-linux-arm64-musl@2.2.0':
optional: true optional: true
'@biomejs/cli-linux-arm64@2.1.4': '@biomejs/cli-linux-arm64@2.2.0':
optional: true optional: true
'@biomejs/cli-linux-x64-musl@2.1.4': '@biomejs/cli-linux-x64-musl@2.2.0':
optional: true optional: true
'@biomejs/cli-linux-x64@2.1.4': '@biomejs/cli-linux-x64@2.2.0':
optional: true optional: true
'@biomejs/cli-win32-arm64@2.1.4': '@biomejs/cli-win32-arm64@2.2.0':
optional: true optional: true
'@biomejs/cli-win32-x64@2.1.4': '@biomejs/cli-win32-x64@2.2.0':
optional: true optional: true
'@bundled-es-modules/cookie@2.0.1': '@bundled-es-modules/cookie@2.0.1':