Skip to content

Commit f9efb24

Browse files
committed
Replace Prettier with Biome for linting and formatting
1 parent 7ac5e01 commit f9efb24

4 files changed

Lines changed: 12 additions & 25 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: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -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/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)