From ab76c03b72e92b17d36b9a7feedad71f604f93ce Mon Sep 17 00:00:00 2001 From: Araxeus <78568641+Araxeus@users.noreply.github.com> Date: Sat, 18 May 2024 11:16:09 +0300 Subject: [PATCH] replace rome with biome --- .vscode/extensions.json | 2 +- biome.json | 39 +++++++ package.json | 6 +- rome.json | 29 ----- unpacked/pageAccess.js | 5 +- unpacked/popup/elements/slider.js | 1 + unpacked/popup/elements/tooltip.js | 1 + yarn.lock | 164 ++++++++++++++++------------- 8 files changed, 140 insertions(+), 107 deletions(-) create mode 100644 biome.json delete mode 100644 rome.json diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 302c5bb..b02a0f0 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -2,6 +2,6 @@ "recommendations": [ "arcanis.vscode-zipfs", "dbaeumer.vscode-eslint", - "rome.rome" + "biomejs.biome" ] } diff --git a/biome.json b/biome.json new file mode 100644 index 0000000..c6997a6 --- /dev/null +++ b/biome.json @@ -0,0 +1,39 @@ +{ + "$schema": "https://biomejs.dev/schemas/1.7.3/schema.json", + "files": { + "ignore": ["**/popup/vendors/*", "./.pnp.*", "*.json"] + }, + "javascript": { + "formatter": { + "quoteStyle": "single" + } + }, + "formatter": { + "enabled": true, + "indentStyle": "space", + "indentWidth": 4 + }, + "linter": { + "enabled": true, + "rules": { + "recommended": true, + "correctness": { + "noUndeclaredVariables": "error", + "noUnusedVariables": "error" + }, + "complexity": { + "noThisInStatic": "off", + "noForEach": "off" + }, + "suspicious": { + "noAssignInExpressions": "off" + }, + "style": { + "useNumberNamespace": "off" + }, + "nursery": { + "recommended": true + } + } + } +} diff --git a/package.json b/package.json index c258ae0..cf66489 100644 --- a/package.json +++ b/package.json @@ -11,8 +11,8 @@ "packageManager": "yarn@4.0.1", "scripts": { "check": "yarn copy_to_dist && yarn check_no_copy && del-cli dist", - "check_no_copy": "(eslint . && rome ci . && web-ext lint -w --ignore-files \"./popup/vendors/*\") || (del-cli dist && exit 1)", - "format": "eslint . --fix && rome format . --write", + "check_no_copy": "(eslint . && biome ci . && web-ext lint -w --ignore-files \"./popup/vendors/*\") || (del-cli dist && exit 1)", + "format": "eslint . --fix && biome format . --write", "sas": "sass --update unpacked/popup", "release": "release-it", "publish": "gh workflow run publish.yml", @@ -38,6 +38,7 @@ }, "homepage": "https://github.com/Araxeus/Youtube-Volume-Scroll#readme", "devDependencies": { + "@biomejs/biome": "^1.7.3", "@release-it/bumper": "^4.0.2", "auto-changelog": "^2.4.0", "cpy-cli": "^4.2.0", @@ -45,7 +46,6 @@ "dot-json": "^1.2.2", "eslint": "^8.39.0", "release-it": "^15.10.1", - "rome": "^12.0.0", "sass": "^1.62.0", "vendorfiles": "^1.1.1", "web-ext": "^7.6.2", diff --git a/rome.json b/rome.json deleted file mode 100644 index b8ef0a4..0000000 --- a/rome.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "files": { - "ignore": ["**/popup/vendors/*", "./.pnp.*", "*.json"] - }, - "javascript": { - "formatter": { - "quoteStyle": "single" - } - }, - "formatter": { - "enabled": true, - "indentStyle": "space", - "indentSize": 4 - }, - "linter": { - "enabled": true, - "rules": { - "recommended": true, - "correctness": { - "noUndeclaredVariables": "error", - "noUnusedVariables": "error" - }, - "nursery": { - "recommended": true, - "noAssignInExpressions": "off" - } - } - } -} diff --git a/unpacked/pageAccess.js b/unpacked/pageAccess.js index 8dcb7be..68a0b5e 100644 --- a/unpacked/pageAccess.js +++ b/unpacked/pageAccess.js @@ -1,6 +1,7 @@ // set last active time to now every 15min (blocks "are you there?" popup) setInterval(() => (window._lact = Date.now()), 9e5); +// biome-ignore lint/complexity/noStaticOnlyClass: this is a class to hide private variables and avoid page pollution class ytvs { static #$ = document.querySelector.bind(document); static get $() { @@ -587,7 +588,7 @@ class YoutubeVolumeScroll { createNative(); } break; - // rome-ignore lint/nursery/noUselessSwitchCase: Just here for clarity + // biome-ignore lint/complexity/noUselessSwitchCase: Just here for clarity case ytvs.hudTypes.custom: default: if (!ytvs.$(`${this.hudContainer} .volume-hud-custom`)) { @@ -735,7 +736,7 @@ class YoutubeVolumeScroll { const newTop = ev.clientY - dragTargetRect.y - dragOffsetY; const padding = - parseFloat( + Number.parseFloat( window.getComputedStyle(draggedElement, undefined).padding, ) - 2; diff --git a/unpacked/popup/elements/slider.js b/unpacked/popup/elements/slider.js index 273557f..63a2d2c 100644 --- a/unpacked/popup/elements/slider.js +++ b/unpacked/popup/elements/slider.js @@ -40,6 +40,7 @@ customElements.define( return this.getAttribute('value') || '1'; } + // biome-ignore lint/complexity/noUselessConstructor: for clarity constructor() { super(); } diff --git a/unpacked/popup/elements/tooltip.js b/unpacked/popup/elements/tooltip.js index 73c7665..2e77bd0 100644 --- a/unpacked/popup/elements/tooltip.js +++ b/unpacked/popup/elements/tooltip.js @@ -1,6 +1,7 @@ customElements.define( 'tooltip-icon', class Tooltip extends HTMLElement { + // biome-ignore lint/complexity/noUselessConstructor: for clarity constructor() { super(); } diff --git a/yarn.lock b/yarn.lock index 36db3d3..6818923 100644 --- a/yarn.lock +++ b/yarn.lock @@ -50,6 +50,97 @@ __metadata: languageName: node linkType: hard +"@biomejs/biome@npm:^1.7.3": + version: 1.7.3 + resolution: "@biomejs/biome@npm:1.7.3" + dependencies: + "@biomejs/cli-darwin-arm64": "npm:1.7.3" + "@biomejs/cli-darwin-x64": "npm:1.7.3" + "@biomejs/cli-linux-arm64": "npm:1.7.3" + "@biomejs/cli-linux-arm64-musl": "npm:1.7.3" + "@biomejs/cli-linux-x64": "npm:1.7.3" + "@biomejs/cli-linux-x64-musl": "npm:1.7.3" + "@biomejs/cli-win32-arm64": "npm:1.7.3" + "@biomejs/cli-win32-x64": "npm:1.7.3" + dependenciesMeta: + "@biomejs/cli-darwin-arm64": + optional: true + "@biomejs/cli-darwin-x64": + optional: true + "@biomejs/cli-linux-arm64": + optional: true + "@biomejs/cli-linux-arm64-musl": + optional: true + "@biomejs/cli-linux-x64": + optional: true + "@biomejs/cli-linux-x64-musl": + optional: true + "@biomejs/cli-win32-arm64": + optional: true + "@biomejs/cli-win32-x64": + optional: true + bin: + biome: bin/biome + checksum: fafe2caa658489f80640ecad27b4715881eaf0e88868da039610ebf13385f6345761a7b685772926abe9c415c5eaec07c890206bfcee632daaf0808b310e01e9 + languageName: node + linkType: hard + +"@biomejs/cli-darwin-arm64@npm:1.7.3": + version: 1.7.3 + resolution: "@biomejs/cli-darwin-arm64@npm:1.7.3" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + +"@biomejs/cli-darwin-x64@npm:1.7.3": + version: 1.7.3 + resolution: "@biomejs/cli-darwin-x64@npm:1.7.3" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + +"@biomejs/cli-linux-arm64-musl@npm:1.7.3": + version: 1.7.3 + resolution: "@biomejs/cli-linux-arm64-musl@npm:1.7.3" + conditions: os=linux & cpu=arm64 & libc=musl + languageName: node + linkType: hard + +"@biomejs/cli-linux-arm64@npm:1.7.3": + version: 1.7.3 + resolution: "@biomejs/cli-linux-arm64@npm:1.7.3" + conditions: os=linux & cpu=arm64 & libc=glibc + languageName: node + linkType: hard + +"@biomejs/cli-linux-x64-musl@npm:1.7.3": + version: 1.7.3 + resolution: "@biomejs/cli-linux-x64-musl@npm:1.7.3" + conditions: os=linux & cpu=x64 & libc=musl + languageName: node + linkType: hard + +"@biomejs/cli-linux-x64@npm:1.7.3": + version: 1.7.3 + resolution: "@biomejs/cli-linux-x64@npm:1.7.3" + conditions: os=linux & cpu=x64 & libc=glibc + languageName: node + linkType: hard + +"@biomejs/cli-win32-arm64@npm:1.7.3": + version: 1.7.3 + resolution: "@biomejs/cli-win32-arm64@npm:1.7.3" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + +"@biomejs/cli-win32-x64@npm:1.7.3": + version: 1.7.3 + resolution: "@biomejs/cli-win32-x64@npm:1.7.3" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + "@commander-js/extra-typings@npm:^10.0.3": version: 10.0.3 resolution: "@commander-js/extra-typings@npm:10.0.3" @@ -474,48 +565,6 @@ __metadata: languageName: node linkType: hard -"@rometools/cli-darwin-arm64@npm:12.0.0": - version: 12.0.0 - resolution: "@rometools/cli-darwin-arm64@npm:12.0.0" - conditions: os=darwin & cpu=arm64 - languageName: node - linkType: hard - -"@rometools/cli-darwin-x64@npm:12.0.0": - version: 12.0.0 - resolution: "@rometools/cli-darwin-x64@npm:12.0.0" - conditions: os=darwin & cpu=x64 - languageName: node - linkType: hard - -"@rometools/cli-linux-arm64@npm:12.0.0": - version: 12.0.0 - resolution: "@rometools/cli-linux-arm64@npm:12.0.0" - conditions: os=linux & cpu=arm64 - languageName: node - linkType: hard - -"@rometools/cli-linux-x64@npm:12.0.0": - version: 12.0.0 - resolution: "@rometools/cli-linux-x64@npm:12.0.0" - conditions: os=linux & cpu=x64 - languageName: node - linkType: hard - -"@rometools/cli-win32-arm64@npm:12.0.0": - version: 12.0.0 - resolution: "@rometools/cli-win32-arm64@npm:12.0.0" - conditions: os=win32 & cpu=arm64 - languageName: node - linkType: hard - -"@rometools/cli-win32-x64@npm:12.0.0": - version: 12.0.0 - resolution: "@rometools/cli-win32-x64@npm:12.0.0" - conditions: os=win32 & cpu=x64 - languageName: node - linkType: hard - "@sindresorhus/is@npm:^5.2.0": version: 5.3.0 resolution: "@sindresorhus/is@npm:5.3.0" @@ -6559,35 +6608,6 @@ __metadata: languageName: node linkType: hard -"rome@npm:^12.0.0": - version: 12.0.0 - resolution: "rome@npm:12.0.0" - dependencies: - "@rometools/cli-darwin-arm64": "npm:12.0.0" - "@rometools/cli-darwin-x64": "npm:12.0.0" - "@rometools/cli-linux-arm64": "npm:12.0.0" - "@rometools/cli-linux-x64": "npm:12.0.0" - "@rometools/cli-win32-arm64": "npm:12.0.0" - "@rometools/cli-win32-x64": "npm:12.0.0" - dependenciesMeta: - "@rometools/cli-darwin-arm64": - optional: true - "@rometools/cli-darwin-x64": - optional: true - "@rometools/cli-linux-arm64": - optional: true - "@rometools/cli-linux-x64": - optional: true - "@rometools/cli-win32-arm64": - optional: true - "@rometools/cli-win32-x64": - optional: true - bin: - rome: bin/rome - checksum: 2c9ad2d58de52d821f568a2fb9e1857b8a79ec0bea972b074006846d337939f212ce2663fc55875458f6a0a8e9d1aa0e858e9ab57dc12548c13004a50714e840 - languageName: node - linkType: hard - "run-applescript@npm:^5.0.0": version: 5.0.0 resolution: "run-applescript@npm:5.0.0" @@ -8206,6 +8226,7 @@ __metadata: version: 0.0.0-use.local resolution: "youtube-volume-scroll@workspace:." dependencies: + "@biomejs/biome": "npm:^1.7.3" "@release-it/bumper": "npm:^4.0.2" auto-changelog: "npm:^2.4.0" cpy-cli: "npm:^4.2.0" @@ -8213,7 +8234,6 @@ __metadata: dot-json: "npm:^1.2.2" eslint: "npm:^8.39.0" release-it: "npm:^15.10.1" - rome: "npm:^12.0.0" sass: "npm:^1.62.0" vendorfiles: "npm:^1.1.1" web-ext: "npm:^7.6.2"