Skip to content

Commit 6392db7

Browse files
committed
Replace Prettier with Biome for linting and formatting
- Removed archived mirrors-prettier hook - Enhanced biome-check hook to handle JS, CSS, and JSON - Updated biome.json to handle all supported files - Fixed typo in .pre-commit-config.yaml (minimum_pre_commit_version) - Applied automated formatting fixes via Biome
1 parent a8bc14e commit 6392db7

5 files changed

Lines changed: 27 additions & 45 deletions

File tree

.eleventy.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
const yaml = require("js-yaml");
22

3-
module.exports = function (eleventyConfig) {
4-
eleventyConfig.addShortcode("currentYear", function () {
5-
return new Date().getFullYear();
6-
});
3+
module.exports = (eleventyConfig) => {
4+
eleventyConfig.addShortcode("currentYear", () => new Date().getFullYear());
75
// Add this line to copy your external assets
86
eleventyConfig.addPassthroughCopy("src/assets");
97
// 1. Recognize YAML as a template format
@@ -27,12 +25,12 @@ module.exports = function (eleventyConfig) {
2725
});
2826

2927
// 2. The Randomized Collection
30-
eleventyConfig.addCollection("randomPeople", function (collectionApi) {
28+
eleventyConfig.addCollection("randomPeople", (collectionApi) => {
3129
// Grab all yaml files from the users folder
3230
const people = collectionApi.getFilteredByGlob("src/users/*.yaml");
3331

3432
// Create a copy of the array to avoid mutating the original global collection
35-
let shuffled = [...people];
33+
const shuffled = [...people];
3634

3735
// Fisher-Yates Shuffle
3836
for (let i = shuffled.length - 1; i > 0; i--) {

.pre-commit-config.yaml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
default_stages: [pre-commit, pre-push]
2-
minimum_prek_version: "0.2.22"
2+
minimum_pre_commit_version: "0.2.22"
33
default_language_version:
44
python: python3
55
node: 24.13.0
@@ -118,17 +118,9 @@ repos:
118118
hooks:
119119
- id: biome-check
120120
name: run biome-check
121-
description: Run Biome linter and formatter for JSON files
121+
description: Run Biome linter and formatter for JS, CSS, and JSON files
122122
additional_dependencies: ["@biomejs/biome"]
123123

124-
- repo: https://github.com/pre-commit/mirrors-prettier
125-
rev: v4.0.0-alpha.8
126-
hooks:
127-
- id: prettier
128-
name: run prettier
129-
types_or: [css, html, javascript, json, markdown, yaml]
130-
additional_dependencies: ["prettier@3.8.1"]
131-
132124
- repo: https://github.com/igorshubovych/markdownlint-cli
133125
rev: v0.47.0
134126
hooks:

biome.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
{
22
"$schema": "https://biomejs.dev/schemas/2.3.13/schema.json",
3-
"files": {
4-
"includes": ["**/*.json"]
5-
},
63
"linter": {
74
"enabled": true,
85
"rules": {

src/assets/js/eggs.js

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -187,40 +187,35 @@ function spawnExplosion(scene) {
187187
}
188188

189189
function setupSpaceInvaders() {
190-
const scene = this;
191-
192190
// Player Rocket
193-
player = scene.add.text(
194-
window.innerWidth / 2,
195-
window.innerHeight - 80,
196-
"🚀",
197-
{ fontSize: "50px" },
198-
);
199-
scene.physics.add.existing(player);
191+
player = this.add.text(window.innerWidth / 2, window.innerHeight - 80, "🚀", {
192+
fontSize: "50px",
193+
});
194+
this.physics.add.existing(player);
200195
player.body.setCollideWorldBounds(true);
201196

202197
// Bullets
203-
bullets = scene.physics.add.group();
198+
bullets = this.physics.add.group();
204199

205200
// Aliens Grid - Adjusted for smaller size
206-
aliens = scene.physics.add.group();
201+
aliens = this.physics.add.group();
207202
const rows = 5;
208203
const cols = 10;
209204
const spacingX = 50; // Tighter horizontal spacing
210205
const spacingY = 45; // Tighter vertical spacing
211206

212207
for (let y = 0; y < rows; y++) {
213208
for (let x = 0; x < cols; x++) {
214-
let alienEmoji = ["👾", "👽", "🛸", "🐙", "👾"][y];
209+
const alienEmoji = ["👾", "👽", "🛸", "🐙", "👾"][y];
215210
// Shrink from 35px to 24px
216-
let alien = scene.add.text(
211+
const alien = this.add.text(
217212
x * spacingX + 80,
218213
y * spacingY + 80,
219214
alienEmoji,
220215
{ fontSize: "24px" },
221216
);
222217

223-
scene.physics.add.existing(alien);
218+
this.physics.add.existing(alien);
224219
alien.body.setAllowGravity(false);
225220
// Shrink the collision box to match the smaller emoji
226221
alien.body.setSize(24, 24);
@@ -230,16 +225,16 @@ function setupSpaceInvaders() {
230225
}
231226

232227
// Alien Movement Timer
233-
scene.alienDirection = 1;
234-
scene.time.addEvent({
228+
this.alienDirection = 1;
229+
this.time.addEvent({
235230
delay: 800,
236231
callback: moveAliens,
237-
callbackScope: scene,
232+
callbackScope: this,
238233
loop: true,
239234
});
240235

241236
// Collisions
242-
scene.physics.add.overlap(bullets, aliens, (bullet, alien) => {
237+
this.physics.add.overlap(bullets, aliens, (bullet, alien) => {
243238
bullet.destroy();
244239
alien.destroy();
245240
if (aliens.countActive() === 0) {
@@ -248,7 +243,7 @@ function setupSpaceInvaders() {
248243
}
249244
});
250245

251-
cursors = scene.input.keyboard.createCursorKeys();
246+
cursors = this.input.keyboard.createCursorKeys();
252247
}
253248

254249
function moveAliens() {

src/assets/js/script.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ function playSound(type) {
104104
}
105105
}
106106

107-
let unlockedEggs = JSON.parse(localStorage.getItem("unlockedEggs")) || [];
107+
const unlockedEggs = JSON.parse(localStorage.getItem("unlockedEggs")) || [];
108108
let surpriseClickCount = 0;
109109
let matrixActive = false;
110110
let destructInterval;
@@ -233,7 +233,7 @@ function reopenConsole() {
233233
let isProcessingXP = false;
234234

235235
// Ensure this is in the GLOBAL scope (not hidden inside another function)
236-
window.createFloatingXP = function (e) {
236+
window.createFloatingXP = (e) => {
237237
// Prevent "spam" firing from high-speed mouse movement
238238
if (isProcessingXP) return;
239239
isProcessingXP = true;
@@ -758,7 +758,7 @@ document
758758
/**
759759
* 7. SELF DESTRUCT ENGINE
760760
*/
761-
window.startSelfDestruct = function () {
761+
window.startSelfDestruct = () => {
762762
const btn = document.getElementById("self-destruct-btn");
763763
const devPanel = document.getElementById("dev-tools");
764764

@@ -886,7 +886,7 @@ function scrollToRandomUser() {
886886
/**
887887
* UTILITY: SCREENSHOT MODE
888888
*/
889-
window.toggleScreenshotMode = function () {
889+
window.toggleScreenshotMode = () => {
890890
const devPanel = document.getElementById("dev-tools");
891891
const header = document.querySelector("header");
892892
const footer = document.querySelector("footer");
@@ -1002,7 +1002,7 @@ document.addEventListener("keydown", (e) => {
10021002

10031003
async function addExperience(amount) {
10041004
// 1. Force strict numeric types to prevent "1" + "1" = "11"
1005-
let xpToAdd = Number(amount) || 0;
1005+
const xpToAdd = Number(amount) || 0;
10061006
currentXP = Number(currentXP) || 0;
10071007
currentLevel = Number(currentLevel) || 0;
10081008
const XP_THRESHOLD = 45;
@@ -1064,7 +1064,7 @@ function updateInventoryCounts(lvl) {
10641064
const levelEntry = LEVELS[i];
10651065
if (levelEntry && levelEntry.rarity) {
10661066
const r = levelEntry.rarity.toLowerCase();
1067-
if (counts.hasOwnProperty(r)) {
1067+
if (Object.hasOwn(counts, r)) {
10681068
counts[r]++;
10691069
}
10701070
}
@@ -1199,7 +1199,7 @@ function initProfileTracker() {
11991199

12001200
// Only increment if the link text contains "Profile"
12011201
if (targetLink && targetLink.textContent.includes("Profile")) {
1202-
let currentCount = parseInt(
1202+
const currentCount = parseInt(
12031203
localStorage.getItem("profile_view_count") || 0,
12041204
);
12051205
localStorage.setItem("profile_view_count", currentCount + 1);

0 commit comments

Comments
 (0)