diff --git a/biome.base.json b/biome.base.json deleted file mode 100644 index 9c79f83c..00000000 --- a/biome.base.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "$schema": "https://biomejs.dev/schemas/1.9.4/schema.json", - "vcs": { - "enabled": false, - "clientKind": "git", - "useIgnoreFile": true - }, - "files": { - "ignoreUnknown": false, - "ignore": ["tsconfig.*.json", "src/gen/**", "packages/*/dist/**", ".turbo"] - }, - "formatter": { - "indentStyle": "space" - }, - "linter": { - "rules": { - "recommended": true, - "style": { - "useTemplate": "off", - "useConst": "off", - "noParameterAssign": "off", - "useSingleVarDeclarator": "off", - "useNumberNamespace": "off", - "noUnusedTemplateLiteral": "off", - "useEnumInitializers": "off" - }, - "correctness": { - "noSwitchDeclarations": "off" - }, - "suspicious": { - "noDoubleEquals": "off", - "noFallthroughSwitchClause": "off", - "noCatchAssign": "off" - } - } - } -} diff --git a/biome.json b/biome.json index 8ce89a55..9255c6c6 100644 --- a/biome.json +++ b/biome.json @@ -1,7 +1,45 @@ { - "$schema": "https://biomejs.dev/schemas/1.9.4/schema.json", - "extends": ["./biome.base.json"], + "$schema": "https://biomejs.dev/schemas/2.3.8/schema.json", + "vcs": { + "enabled": false, + "clientKind": "git", + "useIgnoreFile": true + }, "files": { - "ignore": ["packages/**"] + "ignoreUnknown": false, + "includes": [ + "*", + "src/**", + "scripts/**", + "!tsconfig.*.json", + "!**/gen", + "!**/dist", + "!.turbo" + ] + }, + "formatter": { + "indentStyle": "space" + }, + "linter": { + "rules": { + "recommended": true, + "style": { + "useTemplate": "off", + "useConst": "off", + "noParameterAssign": "off", + "useSingleVarDeclarator": "off", + "useNumberNamespace": "off", + "noUnusedTemplateLiteral": "off", + "useEnumInitializers": "off" + }, + "correctness": { + "noSwitchDeclarations": "off" + }, + "suspicious": { + "noDoubleEquals": "off", + "noFallthroughSwitchClause": "off", + "noCatchAssign": "off" + } + } } } diff --git a/package-lock.json b/package-lock.json index 1fca2632..124a1166 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ ], "devDependencies": { "@arethetypeswrong/cli": "^0.18.2", - "@biomejs/biome": "^1.9.4", + "@biomejs/biome": "^2.3.8", "@bufbuild/buf": "^1.61.0", "@bufbuild/license-header": "^0.0.4", "@bufbuild/protoc-gen-es": "^2.10.1", @@ -93,11 +93,10 @@ } }, "node_modules/@biomejs/biome": { - "version": "1.9.4", - "resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-1.9.4.tgz", - "integrity": "sha512-1rkd7G70+o9KkTn5KLmDYXihGoTaIGO9PIIN2ZB7UJxFrWw04CZHPYiMRjYsaDvVV7hP1dYNRLxSANLaBFGpog==", + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-2.3.8.tgz", + "integrity": "sha512-Qjsgoe6FEBxWAUzwFGFrB+1+M8y/y5kwmg5CHac+GSVOdmOIqsAiXM5QMVGZJ1eCUCLlPZtq4aFAQ0eawEUuUA==", "dev": true, - "hasInstallScript": true, "license": "MIT OR Apache-2.0", "bin": { "biome": "bin/biome" @@ -110,20 +109,20 @@ "url": "https://opencollective.com/biome" }, "optionalDependencies": { - "@biomejs/cli-darwin-arm64": "1.9.4", - "@biomejs/cli-darwin-x64": "1.9.4", - "@biomejs/cli-linux-arm64": "1.9.4", - "@biomejs/cli-linux-arm64-musl": "1.9.4", - "@biomejs/cli-linux-x64": "1.9.4", - "@biomejs/cli-linux-x64-musl": "1.9.4", - "@biomejs/cli-win32-arm64": "1.9.4", - "@biomejs/cli-win32-x64": "1.9.4" + "@biomejs/cli-darwin-arm64": "2.3.8", + "@biomejs/cli-darwin-x64": "2.3.8", + "@biomejs/cli-linux-arm64": "2.3.8", + "@biomejs/cli-linux-arm64-musl": "2.3.8", + "@biomejs/cli-linux-x64": "2.3.8", + "@biomejs/cli-linux-x64-musl": "2.3.8", + "@biomejs/cli-win32-arm64": "2.3.8", + "@biomejs/cli-win32-x64": "2.3.8" } }, "node_modules/@biomejs/cli-darwin-arm64": { - "version": "1.9.4", - "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-1.9.4.tgz", - "integrity": "sha512-bFBsPWrNvkdKrNCYeAp+xo2HecOGPAy9WyNyB/jKnnedgzl4W4Hb9ZMzYNbf8dMCGmUdSavlYHiR01QaYR58cw==", + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-2.3.8.tgz", + "integrity": "sha512-HM4Zg9CGQ3txTPflxD19n8MFPrmUAjaC7PQdLkugeeC0cQ+PiVrd7i09gaBS/11QKsTDBJhVg85CEIK9f50Qww==", "cpu": [ "arm64" ], @@ -138,9 +137,9 @@ } }, "node_modules/@biomejs/cli-darwin-x64": { - "version": "1.9.4", - "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-x64/-/cli-darwin-x64-1.9.4.tgz", - "integrity": "sha512-ngYBh/+bEedqkSevPVhLP4QfVPCpb+4BBe2p7Xs32dBgs7rh9nY2AIYUL6BgLw1JVXV8GlpKmb/hNiuIxfPfZg==", + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-x64/-/cli-darwin-x64-2.3.8.tgz", + "integrity": "sha512-lUDQ03D7y/qEao7RgdjWVGCu+BLYadhKTm40HkpJIi6kn8LSv5PAwRlew/DmwP4YZ9ke9XXoTIQDO1vAnbRZlA==", "cpu": [ "x64" ], @@ -155,9 +154,9 @@ } }, "node_modules/@biomejs/cli-linux-arm64": { - "version": "1.9.4", - "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64/-/cli-linux-arm64-1.9.4.tgz", - "integrity": "sha512-fJIW0+LYujdjUgJJuwesP4EjIBl/N/TcOX3IvIHJQNsAqvV2CHIogsmA94BPG6jZATS4Hi+xv4SkBBQSt1N4/g==", + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64/-/cli-linux-arm64-2.3.8.tgz", + "integrity": "sha512-Uo1OJnIkJgSgF+USx970fsM/drtPcQ39I+JO+Fjsaa9ZdCN1oysQmy6oAGbyESlouz+rzEckLTF6DS7cWse95g==", "cpu": [ "arm64" ], @@ -172,9 +171,9 @@ } }, "node_modules/@biomejs/cli-linux-arm64-musl": { - "version": "1.9.4", - "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64-musl/-/cli-linux-arm64-musl-1.9.4.tgz", - "integrity": "sha512-v665Ct9WCRjGa8+kTr0CzApU0+XXtRgwmzIf1SeKSGAv+2scAlW6JR5PMFo6FzqqZ64Po79cKODKf3/AAmECqA==", + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64-musl/-/cli-linux-arm64-musl-2.3.8.tgz", + "integrity": "sha512-PShR4mM0sjksUMyxbyPNMxoKFPVF48fU8Qe8Sfx6w6F42verbwRLbz+QiKNiDPRJwUoMG1nPM50OBL3aOnTevA==", "cpu": [ "arm64" ], @@ -189,9 +188,9 @@ } }, "node_modules/@biomejs/cli-linux-x64": { - "version": "1.9.4", - "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64/-/cli-linux-x64-1.9.4.tgz", - "integrity": "sha512-lRCJv/Vi3Vlwmbd6K+oQ0KhLHMAysN8lXoCI7XeHlxaajk06u7G+UsFSO01NAs5iYuWKmVZjmiOzJ0OJmGsMwg==", + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64/-/cli-linux-x64-2.3.8.tgz", + "integrity": "sha512-QDPMD5bQz6qOVb3kiBui0zKZXASLo0NIQ9JVJio5RveBEFgDgsvJFUvZIbMbUZT3T00M/1wdzwWXk4GIh0KaAw==", "cpu": [ "x64" ], @@ -206,9 +205,9 @@ } }, "node_modules/@biomejs/cli-linux-x64-musl": { - "version": "1.9.4", - "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64-musl/-/cli-linux-x64-musl-1.9.4.tgz", - "integrity": "sha512-gEhi/jSBhZ2m6wjV530Yy8+fNqG8PAinM3oV7CyO+6c3CEh16Eizm21uHVsyVBEB6RIM8JHIl6AGYCv6Q6Q9Tg==", + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64-musl/-/cli-linux-x64-musl-2.3.8.tgz", + "integrity": "sha512-YGLkqU91r1276uwSjiUD/xaVikdxgV1QpsicT0bIA1TaieM6E5ibMZeSyjQ/izBn4tKQthUSsVZacmoJfa3pDA==", "cpu": [ "x64" ], @@ -223,9 +222,9 @@ } }, "node_modules/@biomejs/cli-win32-arm64": { - "version": "1.9.4", - "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-arm64/-/cli-win32-arm64-1.9.4.tgz", - "integrity": "sha512-tlbhLk+WXZmgwoIKwHIHEBZUwxml7bRJgk0X2sPyNR3S93cdRq6XulAZRQJ17FYGGzWne0fgrXBKpl7l4M87Hg==", + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-arm64/-/cli-win32-arm64-2.3.8.tgz", + "integrity": "sha512-H4IoCHvL1fXKDrTALeTKMiE7GGWFAraDwBYFquE/L/5r1927Te0mYIGseXi4F+lrrwhSWbSGt5qPFswNoBaCxg==", "cpu": [ "arm64" ], @@ -240,9 +239,9 @@ } }, "node_modules/@biomejs/cli-win32-x64": { - "version": "1.9.4", - "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-x64/-/cli-win32-x64-1.9.4.tgz", - "integrity": "sha512-8Y5wMhVIPaWe6jw2H+KlEm4wP/f7EW3810ZLmDlrEEy5KvBsb9ECEfu/kMWD484ijfQ8+nIi0giMgu9g1UAuuA==", + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-x64/-/cli-win32-x64-2.3.8.tgz", + "integrity": "sha512-RguzimPoZWtBapfKhKjcWXBVI91tiSprqdBYu7tWhgN8pKRZhw24rFeNZTNf6UiBfjCYCi9eFQs/JzJZIhuK4w==", "cpu": [ "x64" ], diff --git a/package.json b/package.json index c0fa7591..f1f0d27a 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,11 @@ "license-header": "license-header --ignore 'packages/**'", "lint": "biome lint --error-on-warnings" }, - "workspaces": ["packages/cel-spec", "packages/cel", "packages/example"], + "workspaces": [ + "packages/cel-spec", + "packages/cel", + "packages/example" + ], "type": "module", "packageManager": "npm@10.9.0", "licenseHeader": { @@ -20,7 +24,7 @@ }, "devDependencies": { "@arethetypeswrong/cli": "^0.18.2", - "@biomejs/biome": "^1.9.4", + "@biomejs/biome": "^2.3.8", "@bufbuild/buf": "^1.61.0", "@bufbuild/license-header": "^0.0.4", "@bufbuild/protoc-gen-es": "^2.10.1", diff --git a/packages/cel-spec/biome.json b/packages/cel-spec/biome.json index 2bb381b4..70b0f13d 100644 --- a/packages/cel-spec/biome.json +++ b/packages/cel-spec/biome.json @@ -1,7 +1,8 @@ { - "$schema": "https://biomejs.dev/schemas/1.9.4/schema.json", - "extends": ["../../biome.base.json"], + "root": false, + "$schema": "https://biomejs.dev/schemas/2.3.8/schema.json", + "extends": "//", "files": { - "ignore": ["dist", "src/wkt/gen", "src/testdata/conformance.ts"] + "includes": ["!**/src/testdata/conformance.ts"] } } diff --git a/packages/cel-spec/package.json b/packages/cel-spec/package.json index cd45eb14..3314b0d4 100644 --- a/packages/cel-spec/package.json +++ b/packages/cel-spec/package.json @@ -123,24 +123,42 @@ }, "typesVersions": { "*": { - "testdata/conformance.js": ["./dist/cjs/testdata/conformance.d.ts"], + "testdata/conformance.js": [ + "./dist/cjs/testdata/conformance.d.ts" + ], "testdata/parser-comprehensions.js": [ "./dist/cjs/testdata/parser-comprehensions.d.ts" ], "testdata/parser-conformance.js": [ "./dist/cjs/testdata/parser-conformance.d.ts" ], - "testdata/parser.js": ["./dist/cjs/testdata/parser.d.ts"], - "testdata/registry.js": ["./dist/cjs/testdata/registry.d.ts"], - "testdata/simple.js": ["./dist/cjs/testdata/simple.d.ts"], + "testdata/parser.js": [ + "./dist/cjs/testdata/parser.d.ts" + ], + "testdata/registry.js": [ + "./dist/cjs/testdata/registry.d.ts" + ], + "testdata/simple.js": [ + "./dist/cjs/testdata/simple.d.ts" + ], "testdata/to-debug-string.js": [ "./dist/cjs/testdata/to-debug-string.d.ts" ], - "cel/expr/checked_pb.js": ["./dist/cjs/gen/cel/expr/checked_pb.d.ts"], - "cel/expr/eval_pb.js": ["./dist/cjs/gen/cel/expr/eval_pb.d.ts"], - "cel/expr/explain_pb.js": ["./dist/cjs/gen/cel/expr/explain_pb.d.ts"], - "cel/expr/syntax_pb.js": ["./dist/cjs/gen/cel/expr/syntax_pb.d.ts"], - "cel/expr/value_pb.js": ["./dist/cjs/gen/cel/expr/value_pb.d.ts"], + "cel/expr/checked_pb.js": [ + "./dist/cjs/gen/cel/expr/checked_pb.d.ts" + ], + "cel/expr/eval_pb.js": [ + "./dist/cjs/gen/cel/expr/eval_pb.d.ts" + ], + "cel/expr/explain_pb.js": [ + "./dist/cjs/gen/cel/expr/explain_pb.d.ts" + ], + "cel/expr/syntax_pb.js": [ + "./dist/cjs/gen/cel/expr/syntax_pb.d.ts" + ], + "cel/expr/value_pb.js": [ + "./dist/cjs/gen/cel/expr/value_pb.d.ts" + ], "cel/expr/conformance/conformance_service_pb.js": [ "./dist/cjs/gen/cel/expr/conformance/conformance_service_pb.d.ts" ], diff --git a/packages/cel-spec/src/testdata/to-debug-string.ts b/packages/cel-spec/src/testdata/to-debug-string.ts index 08ada1b2..8f4e5b6d 100644 --- a/packages/cel-spec/src/testdata/to-debug-string.ts +++ b/packages/cel-spec/src/testdata/to-debug-string.ts @@ -29,8 +29,6 @@ const decoder = new TextDecoder(); // These expressions MUST capture a single character (a string `S` where `S.length == 1`) // @ts-expect-error - The regex flag `v` is only available in ES2024 or later const UNPRINTABLE_EXP: CharRegExp = /[^\p{L}\p{N}\p{S}\p{P}\p{Cs} ]/v; -// @ts-expect-error - The regex flag `v` is only available in ES2024 or later -const UNPRINTABLE_EXP_GLOBAL: CharRegExp = /[^\p{L}\p{N}\p{S}\p{P}\p{Cs} ]/gv; const SPECIAL_ESCAPES: Map = new Map([ [0x07, "\\a"], diff --git a/packages/cel/biome.json b/packages/cel/biome.json index 4ce16bda..4016a8c7 100644 --- a/packages/cel/biome.json +++ b/packages/cel/biome.json @@ -1,9 +1,7 @@ { - "$schema": "https://biomejs.dev/schemas/1.9.4/schema.json", - "extends": ["../../biome.base.json"], - "formatter": { - "ignore": ["dist", "src/gen"] - }, + "root": false, + "$schema": "https://biomejs.dev/schemas/2.3.8/schema.json", + "extends": "//", "linter": { "rules": { "suspicious": { diff --git a/packages/cel/package.json b/packages/cel/package.json index 895dc194..da3fdaf0 100644 --- a/packages/cel/package.json +++ b/packages/cel/package.json @@ -44,7 +44,9 @@ }, "typesVersions": { "*": { - "ext/strings": ["./dist/cjs/ext/strings/index.d.ts"] + "ext/strings": [ + "./dist/cjs/ext/strings/index.d.ts" + ] } }, "peerDependencies": { diff --git a/packages/cel/src/map.ts b/packages/cel/src/map.ts index e7a08cb2..35924e2d 100644 --- a/packages/cel/src/map.ts +++ b/packages/cel/src/map.ts @@ -134,9 +134,9 @@ class NativeMap implements CelMap { // biome-ignore lint/suspicious/noExplicitAny: Part of the Map interface. thisArg?: any, ): void { - this._map.forEach((value, key, _) => - callback.call(thisArg, toCel(value), key, this), - ); + this._map.forEach((value, key, _) => { + callback.call(thisArg, toCel(value), key, this); + }); } *entries(): MapIterator<[string | bigint | boolean | CelUint, CelValue]> { @@ -188,14 +188,14 @@ class ProtoMap implements CelMap { // biome-ignore lint/suspicious/noExplicitAny: Part of the Map interface. thisArg?: any, ): void { - this._map.forEach((value, key, _) => + this._map.forEach((value, key, _) => { callback.call( thisArg, celFromMapValue(this._map.field(), value), celFromMapKey(this._map.field(), key), this, - ), - ); + ); + }); } *entries(): MapIterator<[string | bigint | boolean | CelUint, CelValue]> { diff --git a/packages/cel/src/planner.ts b/packages/cel/src/planner.ts index 43438db5..530d4bdb 100644 --- a/packages/cel/src/planner.ts +++ b/packages/cel/src/planner.ts @@ -135,7 +135,7 @@ export class Planner { if (typeName === undefined) { return new EvalErr(id, "unknown type: " + expr.messageName); } - let optionals: boolean[] | undefined = undefined; + let optionals: boolean[] | undefined; const keys: string[] = []; const values: Interpretable[] = []; for (let i = 0; i < expr.entries.length; i++) { @@ -167,7 +167,7 @@ export class Planner { if (expr.messageName !== "") { return this.planCreateObj(id, expr); } - let optionals: boolean[] | undefined = undefined; + let optionals: boolean[] | undefined; const keys: Interpretable[] = []; const values: Interpretable[] = []; for (let i = 0; i < expr.entries.length; i++) { diff --git a/packages/cel/src/std/time.ts b/packages/cel/src/std/time.ts index 12368935..6d6f3974 100644 --- a/packages/cel/src/std/time.ts +++ b/packages/cel/src/std/time.ts @@ -54,8 +54,8 @@ function makeTimeOp(t: TimeFunc) { ); if (timeOffset?.groups) { const sign = timeOffset.groups.sign == "-" ? 1 : -1; - const hours = parseInt(timeOffset.groups.hours); - const minutes = parseInt(timeOffset.groups.minutes); + const hours = parseInt(timeOffset.groups.hours, 10); + const minutes = parseInt(timeOffset.groups.minutes, 10); const offset = sign * (hours * 60 * 60 * 1000 + minutes * 60 * 1000); val = new Date(val.getTime() - offset); val = new Date( @@ -92,22 +92,22 @@ function makeTimeOp(t: TimeFunc) { for (const part of format.formatToParts(val)) { switch (part.type) { case "year": - year = parseInt(part.value); + year = parseInt(part.value, 10); break; case "month": - month = parseInt(part.value) - 1; + month = parseInt(part.value, 10) - 1; break; case "day": - day = parseInt(part.value); + day = parseInt(part.value, 10); break; case "hour": - hour = parseInt(part.value); + hour = parseInt(part.value, 10); break; case "minute": - minute = parseInt(part.value); + minute = parseInt(part.value, 10); break; case "second": - second = parseInt(part.value); + second = parseInt(part.value, 10); break; } } diff --git a/packages/cel/src/testing.ts b/packages/cel/src/testing.ts index e491c746..3f905437 100644 --- a/packages/cel/src/testing.ts +++ b/packages/cel/src/testing.ts @@ -58,7 +58,7 @@ export function testSimpleTestFile( void suite(name(simpleTestFile), () => { for (const section of simpleTestFile.section) { const sectionFail = fileFail || failureFn?.(simpleTestFile, section); - void suite(name(section), (t) => { + void suite(name(section), () => { for (const simpleTest of section.test) { const fail = sectionFail || failureFn?.(simpleTestFile, section, simpleTest); diff --git a/packages/example/biome.json b/packages/example/biome.json index 6ae55468..ef2a8557 100644 --- a/packages/example/biome.json +++ b/packages/example/biome.json @@ -1,4 +1,5 @@ { - "$schema": "https://biomejs.dev/schemas/1.9.4/schema.json", - "extends": ["../../biome.base.json"] + "root": false, + "$schema": "https://biomejs.dev/schemas/2.3.8/schema.json", + "extends": "//" } diff --git a/scripts/release.js b/scripts/release.js index 297904c4..b609e999 100644 --- a/scripts/release.js +++ b/scripts/release.js @@ -12,10 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { readdirSync, readFileSync } from "node:fs"; -import { join } from "node:path"; -import { existsSync } from "node:fs"; import { execSync } from "node:child_process"; +import { existsSync, readdirSync, readFileSync } from "node:fs"; +import { join } from "node:path"; /* * Publish cel-es @@ -86,7 +85,7 @@ function determinePublishTag(version) { * @returns {string} */ function findWorkspaceVersion(packagesDir) { - let version = undefined; + let version; for (const entry of readdirSync(packagesDir, { withFileTypes: true })) { if (!entry.isDirectory()) { continue; diff --git a/scripts/set-workspace-version.js b/scripts/set-workspace-version.js index dd142378..d372b364 100755 --- a/scripts/set-workspace-version.js +++ b/scripts/set-workspace-version.js @@ -14,7 +14,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { readFileSync, writeFileSync, existsSync, globSync } from "node:fs"; +import { existsSync, globSync, readFileSync, writeFileSync } from "node:fs"; import { dirname, join } from "node:path"; if (process.argv.length !== 3 || !/^\d+\.\d+\.\d+$/.test(process.argv[2])) {