Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions .eleventy.js
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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--) {
Expand Down
8 changes: 0 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions biome.json
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
33 changes: 14 additions & 19 deletions src/assets/js/eggs.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,40 +187,35 @@ 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, "🚀", {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variable `player` is assigned without declaration, creating an implicit global


The variable player is assigned without being declared with let, const, or var. This creates an implicit global variable, which can lead to name collisions, makes code harder to maintain, and would throw an error in strict mode. This issue also applies to bullets, aliens, and cursors within the same function.

To fix this, explicitly declare these variables in the appropriate shared scope, likely at the top of the file, using let player, bullets, aliens, cursors;.

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
const spacingY = 45; // Tighter vertical spacing

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);
Expand All @@ -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) {
Expand All @@ -248,7 +243,7 @@ function setupSpaceInvaders() {
}
});

cursors = scene.input.keyboard.createCursorKeys();
cursors = this.input.keyboard.createCursorKeys();
}

function moveAliens() {
Expand Down
14 changes: 7 additions & 7 deletions src/assets/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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");

Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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]++;
}
}
Expand Down Expand Up @@ -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);
Expand Down
Loading