diff --git a/.eleventy.js b/.eleventy.js index 874f668..b208c7f 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -1,9 +1,7 @@ const yaml = require("js-yaml"); -module.exports = function (eleventyConfig) { - eleventyConfig.addShortcode("currentYear", function () { - return new Date().getFullYear(); - }); +module.exports = (eleventyConfig) => { + eleventyConfig.addShortcode("currentYear", () => new Date().getFullYear()); // Add this line to copy your external assets eleventyConfig.addPassthroughCopy("src/assets"); // 1. Recognize YAML as a template format @@ -27,12 +25,12 @@ module.exports = function (eleventyConfig) { }); // 2. The Randomized Collection - eleventyConfig.addCollection("randomPeople", function (collectionApi) { + eleventyConfig.addCollection("randomPeople", (collectionApi) => { // Grab all yaml files from the users folder const people = collectionApi.getFilteredByGlob("src/users/*.yaml"); // Create a copy of the array to avoid mutating the original global collection - let shuffled = [...people]; + const shuffled = [...people]; // Fisher-Yates Shuffle for (let i = shuffled.length - 1; i > 0; i--) { diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d992077..5eec92b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -121,14 +121,6 @@ repos: description: Run Biome linter and formatter for JSON files additional_dependencies: ["@biomejs/biome"] - - repo: https://github.com/pre-commit/mirrors-prettier - rev: v4.0.0-alpha.8 - hooks: - - id: prettier - name: run prettier - types_or: [css, html, javascript, json, markdown, yaml] - additional_dependencies: ["prettier@3.8.1"] - - repo: https://github.com/igorshubovych/markdownlint-cli rev: v0.48.0 hooks: diff --git a/biome.json b/biome.json index 115edc8..87c2b9b 100644 --- a/biome.json +++ b/biome.json @@ -1,7 +1,7 @@ { - "$schema": "https://biomejs.dev/schemas/2.3.13/schema.json", + "$schema": "https://biomejs.dev/schemas/2.3.14/schema.json", "files": { - "includes": ["**/*.json"] + "includes": ["**/*.json", "**/*.njk"] }, "linter": { "enabled": true, diff --git a/src/assets/js/eggs.js b/src/assets/js/eggs.js index 2ba15bb..3b8aafc 100644 --- a/src/assets/js/eggs.js +++ b/src/assets/js/eggs.js @@ -187,23 +187,18 @@ function spawnExplosion(scene) { } function setupSpaceInvaders() { - const scene = this; - // Player Rocket - player = scene.add.text( - window.innerWidth / 2, - window.innerHeight - 80, - "🚀", - { fontSize: "50px" }, - ); - scene.physics.add.existing(player); + player = this.add.text(window.innerWidth / 2, window.innerHeight - 80, "🚀", { + fontSize: "50px", + }); + this.physics.add.existing(player); player.body.setCollideWorldBounds(true); // Bullets - bullets = scene.physics.add.group(); + bullets = this.physics.add.group(); // Aliens Grid - Adjusted for smaller size - aliens = scene.physics.add.group(); + aliens = this.physics.add.group(); const rows = 5; const cols = 10; const spacingX = 50; // Tighter horizontal spacing @@ -211,16 +206,16 @@ function setupSpaceInvaders() { for (let y = 0; y < rows; y++) { for (let x = 0; x < cols; x++) { - let alienEmoji = ["👾", "👽", "🛸", "🐙", "👾"][y]; + const alienEmoji = ["👾", "👽", "🛸", "🐙", "👾"][y]; // Shrink from 35px to 24px - let alien = scene.add.text( + const alien = this.add.text( x * spacingX + 80, y * spacingY + 80, alienEmoji, { fontSize: "24px" }, ); - scene.physics.add.existing(alien); + this.physics.add.existing(alien); alien.body.setAllowGravity(false); // Shrink the collision box to match the smaller emoji alien.body.setSize(24, 24); @@ -230,16 +225,16 @@ function setupSpaceInvaders() { } // Alien Movement Timer - scene.alienDirection = 1; - scene.time.addEvent({ + this.alienDirection = 1; + this.time.addEvent({ delay: 800, callback: moveAliens, - callbackScope: scene, + callbackScope: this, loop: true, }); // Collisions - scene.physics.add.overlap(bullets, aliens, (bullet, alien) => { + this.physics.add.overlap(bullets, aliens, (bullet, alien) => { bullet.destroy(); alien.destroy(); if (aliens.countActive() === 0) { @@ -248,7 +243,7 @@ function setupSpaceInvaders() { } }); - cursors = scene.input.keyboard.createCursorKeys(); + cursors = this.input.keyboard.createCursorKeys(); } function moveAliens() { diff --git a/src/assets/js/script.js b/src/assets/js/script.js index cb2cba1..9f51391 100644 --- a/src/assets/js/script.js +++ b/src/assets/js/script.js @@ -17,7 +17,7 @@ let isSurging = false; let audioCtx; -let unlockedEggs = JSON.parse(localStorage.getItem("unlockedEggs")) || []; +const unlockedEggs = JSON.parse(localStorage.getItem("unlockedEggs")) || []; let surpriseClickCount = 0; let matrixActive = false; let destructInterval; @@ -312,7 +312,7 @@ function reopenConsole() { let isProcessingXP = false; // Ensure this is in the GLOBAL scope (not hidden inside another function) -window.createFloatingXP = function (e) { +window.createFloatingXP = (e) => { // Prevent "spam" firing from high-speed mouse movement if (isProcessingXP) return; isProcessingXP = true; @@ -837,7 +837,7 @@ document /** * 7. SELF DESTRUCT ENGINE */ -window.startSelfDestruct = function () { +window.startSelfDestruct = () => { const btn = document.getElementById("self-destruct-btn"); const devPanel = document.getElementById("dev-tools"); @@ -965,7 +965,7 @@ function scrollToRandomUser() { /** * UTILITY: SCREENSHOT MODE */ -window.toggleScreenshotMode = function () { +window.toggleScreenshotMode = () => { const devPanel = document.getElementById("dev-tools"); const header = document.querySelector("header"); const footer = document.querySelector("footer"); @@ -1081,7 +1081,7 @@ document.addEventListener("keydown", (e) => { async function addExperience(amount) { // 1. Force strict numeric types to prevent "1" + "1" = "11" - let xpToAdd = Number(amount) || 0; + const xpToAdd = Number(amount) || 0; currentXP = Number(currentXP) || 0; currentLevel = Number(currentLevel) || 0; const XP_THRESHOLD = 45; @@ -1143,7 +1143,7 @@ function updateInventoryCounts(lvl) { const levelEntry = LEVELS[i]; if (levelEntry?.rarity) { const r = levelEntry.rarity.toLowerCase(); - if (counts.hasOwnProperty(r)) { + if (Object.hasOwn(counts, r)) { counts[r]++; } } @@ -1278,7 +1278,7 @@ function initProfileTracker() { // Only increment if the link text contains "Profile" if (targetLink?.textContent?.includes("Profile")) { - let currentCount = parseInt( + const currentCount = parseInt( localStorage.getItem("profile_view_count") || 0, ); localStorage.setItem("profile_view_count", currentCount + 1);