« get me outta code hell

lots of fixes from eslint - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2022-06-26 20:57:06 -0300
committer(quasar) nebula <qznebula@protonmail.com>2022-06-26 20:57:06 -0300
commit08b700bb14e5e12c1dff283e2eef729816a97f15 (patch)
tree0494ff87d7ede3e0d7f561063c08c74011204486 /src
parentc6e9aba1f6d1239b3d884c2749d1f0d15c7662a1 (diff)
lots of fixes from eslint
Diffstat (limited to 'src')
-rw-r--r--src/gen-thumbs.js16
-rw-r--r--src/listing-spec.js2
-rw-r--r--src/misc-templates.js5
-rw-r--r--src/page/album-commentary.js5
-rw-r--r--src/page/album.js29
-rw-r--r--src/page/artist-alias.js4
-rw-r--r--src/page/artist.js7
-rw-r--r--src/page/flash.js3
-rw-r--r--src/page/group.js1
-rw-r--r--src/page/listing.js2
-rw-r--r--src/page/news.js2
-rw-r--r--src/page/static.js4
-rw-r--r--src/page/tag.js17
-rw-r--r--src/page/track.js14
-rw-r--r--src/repl.js9
-rw-r--r--src/static/client.js41
-rw-r--r--src/static/lazy-loading.js5
-rwxr-xr-xsrc/upd8.js38
-rw-r--r--src/util/find.js19
-rw-r--r--src/util/html.js2
-rw-r--r--src/util/io.js8
-rw-r--r--src/util/replacer.js20
-rw-r--r--src/util/sugar.js13
-rw-r--r--src/util/urls.js6
-rw-r--r--src/util/wiki-data.js2
25 files changed, 71 insertions, 203 deletions
diff --git a/src/gen-thumbs.js b/src/gen-thumbs.js
index 82ddb34b..b5b918fd 100644
--- a/src/gen-thumbs.js
+++ b/src/gen-thumbs.js
@@ -110,7 +110,7 @@ function traverse(
             filterDir(name)
               ? recursive(names, path.join(subDirPath, name))
               : [],
-          (err) => (filterFile(name) ? [path.join(subDirPath, name)] : [])
+          () => (filterFile(name) ? [path.join(subDirPath, name)] : [])
         )
       )
     ).then((pathArrays) => pathArrays.flatMap((x) => x));
@@ -123,7 +123,7 @@ function readFileMD5(filePath) {
     const md5 = createHash('md5');
     const stream = createReadStream(filePath);
     stream.on('data', (data) => md5.update(data));
-    stream.on('end', (data) => resolve(md5.digest('hex')));
+    stream.on('end', () => resolve(md5.digest('hex')));
     stream.on('error', (err) => reject(err));
   });
 }
@@ -195,14 +195,6 @@ function generateImageThumbnails(filePath, {spawnConvert}) {
     promisifyProcess(convert('.medium', {size: 400, quality: 95}), false),
     promisifyProcess(convert('.small', {size: 250, quality: 85}), false),
   ]);
-
-  return new Promise((resolve, reject) => {
-    if (Math.random() < 0.2) {
-      reject(new Error(`Them's the 8r8ks, kiddo!`));
-    } else {
-      resolve();
-    }
-  });
 }
 
 export default async function genThumbs(
@@ -248,8 +240,7 @@ export default async function genThumbs(
   }
 
   let cache,
-    firstRun = false,
-    failedReadingCache = false;
+    firstRun = false;
   try {
     cache = JSON.parse(await readFile(path.join(mediaPath, CACHE_FILE)));
     quietInfo`Cache file successfully read.`;
@@ -258,7 +249,6 @@ export default async function genThumbs(
     if (error.code === 'ENOENT') {
       firstRun = true;
     } else {
-      failedReadingCache = true;
       logWarn`Malformed or unreadable cache file: ${error}`;
       logWarn`You may want to cancel and investigate this!`;
       logWarn`All-new thumbnails and cache will be generated for this run.`;
diff --git a/src/listing-spec.js b/src/listing-spec.js
index e08fd639..28f4b1ae 100644
--- a/src/listing-spec.js
+++ b/src/listing-spec.js
@@ -967,7 +967,7 @@ const listingSpec = [
 
     html: (
       {officialAlbumData, fandomAlbumData},
-      {getLinkThemeString, language}
+      {getLinkThemeString}
     ) => fixWS`
             <p>Choose a link to go to a random page in that category or album! If your browser doesn't support relatively modern JavaScript or you've disabled it, these links won't work - sorry.</p>
             <p class="js-hide-once-data">(Data files are downloading in the background! Please wait for data to load.)</p>
diff --git a/src/misc-templates.js b/src/misc-templates.js
index 0ff4c429..53a05950 100644
--- a/src/misc-templates.js
+++ b/src/misc-templates.js
@@ -107,7 +107,7 @@ export function getArtistString(
 ) {
   return language.formatConjunctionList(
     artists.map(({who, what}) => {
-      const {urls, directory, name} = who;
+      const {urls} = who;
       return [
         link.artist(who),
         showContrib && what && `(${what})`,
@@ -135,11 +135,8 @@ export function generateChronologyLinks(
     link,
     linkAnythingMan,
     language,
-    wikiData,
   }
 ) {
-  const {albumData} = wikiData;
-
   const contributions = currentThing[contribKey];
   if (!contributions) {
     return '';
diff --git a/src/page/album-commentary.js b/src/page/album-commentary.js
index 8a5ba069..255a6584 100644
--- a/src/page/album-commentary.js
+++ b/src/page/album-commentary.js
@@ -18,9 +18,7 @@ export function targets({wikiData}) {
   return filterAlbumsByCommentary(wikiData.albumData);
 }
 
-export function write(album, {wikiData}) {
-  const {wikiInfo} = wikiData;
-
+export function write(album) {
   const entries = [album, ...album.tracks]
     .filter((x) => x.commentary)
     .map((x) => x.commentary);
@@ -35,7 +33,6 @@ export function write(album, {wikiData}) {
       getThemeString,
       link,
       language,
-      to,
       transformMultiline,
     }) => ({
       title: language.$('albumCommentaryPage.title', {album: album.name}),
diff --git a/src/page/album.js b/src/page/album.js
index 5b7bc975..12755ae9 100644
--- a/src/page/album.js
+++ b/src/page/album.js
@@ -23,8 +23,6 @@ export function targets({wikiData}) {
 }
 
 export function write(album, {wikiData}) {
-  const {wikiInfo} = wikiData;
-
   const unbound_trackToListItem = (
     track,
     {getArtistString, getLinkThemeString, link, language}
@@ -262,7 +260,6 @@ export function write(album, {wikiData}) {
                                   .map(
                                     ({
                                       name,
-                                      color,
                                       startIndex,
                                       tracks,
                                     }) => fixWS`
@@ -383,21 +380,23 @@ export function write(album, {wikiData}) {
 
 // Utility functions
 
-export function generateAlbumSidebar(
-  album,
-  currentTrack,
-  {fancifyURL, getLinkThemeString, link, language, transformMultiline, wikiData}
-) {
+export function generateAlbumSidebar(album, currentTrack, {
+  fancifyURL,
+  getLinkThemeString,
+  link,
+  language,
+  transformMultiline,
+}) {
   const listTag = getAlbumListTag(album);
 
   /*
-    const trackGroups = album.trackGroups || [{
-        name: language.$('albumSidebar.trackList.fallbackGroupName'),
-        color: album.color,
-        startIndex: 0,
-        tracks: album.tracks
-    }];
-    */
+  const trackGroups = album.trackGroups || [{
+      name: language.$('albumSidebar.trackList.fallbackGroupName'),
+      color: album.color,
+      startIndex: 0,
+      tracks: album.tracks
+  }];
+  */
 
   const {trackGroups} = album;
 
diff --git a/src/page/artist-alias.js b/src/page/artist-alias.js
index 46ad1a34..3d882f65 100644
--- a/src/page/artist-alias.js
+++ b/src/page/artist-alias.js
@@ -7,9 +7,7 @@ export function targets({wikiData}) {
   return wikiData.artistAliasData;
 }
 
-export function write(aliasArtist, {wikiData}) {
-  // This function doesn't actually use wikiData, 8ut, um, consistency?
-
+export function write(aliasArtist) {
   const {aliasedArtist} = aliasArtist;
 
   const redirect = {
diff --git a/src/page/artist.js b/src/page/artist.js
index eb57f5cf..481b4e36 100644
--- a/src/page/artist.js
+++ b/src/page/artist.js
@@ -16,8 +16,6 @@ import {
   chunkByProperties,
   getTotalDuration,
   sortAlbumsTracksChronologically,
-  sortByDate,
-  sortByDirectory,
   sortChronologically,
 } from '../util/wiki-data.js';
 
@@ -357,7 +355,6 @@ export function write(artist, {wikiData}) {
       getArtistString,
       link,
       language,
-      to,
       transformMultiline,
     }) => {
       const generateTrackList = bindOpts(unbound_generateTrackList, {
@@ -514,7 +511,6 @@ export function write(artist, {wikiData}) {
                                         ${chunk
                                           .map(
                                             ({
-                                              album,
                                               track,
                                               key,
                                               ...props
@@ -629,7 +625,7 @@ export function write(artist, {wikiData}) {
                                     )}</dt>
                                     <dd><ul>
                                         ${chunk
-                                          .map(({album, track, ...props}) =>
+                                          .map(({track}) =>
                                             track
                                               ? language.$(
                                                   'artistPage.creditList.entry.track',
@@ -673,7 +669,6 @@ export function write(artist, {wikiData}) {
       getTrackCover,
       link,
       language,
-      to,
     }) => ({
       title: language.$('artistGalleryPage.title', {artist: name}),
 
diff --git a/src/page/flash.js b/src/page/flash.js
index 340927d6..a4b3b9b0 100644
--- a/src/page/flash.js
+++ b/src/page/flash.js
@@ -34,7 +34,6 @@ export function write(flash, {wikiData}) {
       getThemeString,
       link,
       language,
-      transformInline,
     }) => ({
       title: language.$('flashPage.title', {flash: flash.name}),
       theme: getThemeString(flash.color, [
@@ -188,7 +187,7 @@ function generateNavForFlash(
   flash,
   {generateChronologyLinks, generatePreviousNextLinks, link, language, wikiData}
 ) {
-  const {flashData, wikiInfo} = wikiData;
+  const {flashData} = wikiData;
 
   const previousNextLinks = generatePreviousNextLinks(flash, {
     data: flashData,
diff --git a/src/page/group.js b/src/page/group.js
index c7de2fbc..5a6b611e 100644
--- a/src/page/group.js
+++ b/src/page/group.js
@@ -292,7 +292,6 @@ function generateGroupNav(
     return {simple: true};
   }
 
-  const urlKey = isGallery ? 'localized.groupGallery' : 'localized.groupInfo';
   const linkKey = isGallery ? 'groupGallery' : 'groupInfo';
 
   const infoGalleryLinks = generateInfoGalleryLinks(currentGroup, isGallery, {
diff --git a/src/page/listing.js b/src/page/listing.js
index 90415ded..5db6c916 100644
--- a/src/page/listing.js
+++ b/src/page/listing.js
@@ -33,8 +33,6 @@ export function write(listing, {wikiData}) {
     return null;
   }
 
-  const {wikiInfo} = wikiData;
-
   const data = listing.data ? listing.data({wikiData}) : null;
 
   const page = {
diff --git a/src/page/news.js b/src/page/news.js
index bf581e43..478ff9d0 100644
--- a/src/page/news.js
+++ b/src/page/news.js
@@ -104,7 +104,7 @@ function generateNewsEntryNav(
   entry,
   {generatePreviousNextLinks, link, language, wikiData}
 ) {
-  const {wikiInfo, newsData} = wikiData;
+  const {newsData} = wikiData;
 
   // The newsData list is sorted reverse chronologically (newest ones first),
   // so the way we find next/previous entries is flipped from normal.
diff --git a/src/page/static.js b/src/page/static.js
index f4a81972..2a49ff87 100644
--- a/src/page/static.js
+++ b/src/page/static.js
@@ -14,11 +14,11 @@ export function targets({wikiData}) {
   return wikiData.staticPageData;
 }
 
-export function write(staticPage, {wikiData}) {
+export function write(staticPage) {
   const page = {
     type: 'page',
     path: ['staticPage', staticPage.directory],
-    page: ({language, transformMultiline}) => ({
+    page: ({transformMultiline}) => ({
       title: staticPage.name,
       stylesheet: staticPage.stylesheet,
 
diff --git a/src/page/tag.js b/src/page/tag.js
index 4b2322d0..38f7e213 100644
--- a/src/page/tag.js
+++ b/src/page/tag.js
@@ -17,7 +17,6 @@ export function targets({wikiData}) {
 }
 
 export function write(tag, {wikiData}) {
-  const {wikiInfo} = wikiData;
   const {taggedInThings: things} = tag;
 
   // Display things featuring this art tag in reverse chronological order,
@@ -30,14 +29,12 @@ export function write(tag, {wikiData}) {
     type: 'page',
     path: ['tag', tag.directory],
     page: ({
-      generatePreviousNextLinks,
       getAlbumCover,
       getGridHTML,
       getThemeString,
       getTrackCover,
       link,
       language,
-      to,
     }) => ({
       title: language.$('tagPage.title', {tag: tag.name}),
       theme: getThemeString(tag.color),
@@ -68,7 +65,6 @@ export function write(tag, {wikiData}) {
       },
 
       nav: generateTagNav(tag, {
-        generatePreviousNextLinks,
         link,
         language,
         wikiData,
@@ -83,13 +79,8 @@ export function write(tag, {wikiData}) {
 
 function generateTagNav(
   tag,
-  {generatePreviousNextLinks, link, language, wikiData}
+  {link, language, wikiData}
 ) {
-  const previousNextLinks = generatePreviousNextLinks(tag, {
-    data: wikiData.artTagData.filter((tag) => !tag.isContentWarning),
-    linkKey: 'tag',
-  });
-
   return {
     linkContainerClasses: ['nav-links-hierarchy'],
     links: [
@@ -103,12 +94,6 @@ function generateTagNav(
           tag: link.tag(tag, {class: 'current'}),
         }),
       },
-      /*
-            previousNextLinks && {
-                divider: false,
-                html: `(${previousNextLinks})`
-            }
-            */
     ],
   };
 }
diff --git a/src/page/track.js b/src/page/track.js
index a9758ec2..29a07431 100644
--- a/src/page/track.js
+++ b/src/page/track.js
@@ -30,7 +30,7 @@ export function targets({wikiData}) {
 }
 
 export function write(track, {wikiData}) {
-  const {groupData, wikiInfo} = wikiData;
+  const {wikiInfo} = wikiData;
   const {album, referencedByTracks, referencedTracks, otherReleases} = track;
 
   const listTag = getAlbumListTag(album);
@@ -61,17 +61,6 @@ export function write(track, {wikiData}) {
       })
     );
 
-  const unbound_generateTrackList = (
-    tracks,
-    {getArtistString, link, language}
-  ) =>
-    html.tag(
-      'ul',
-      tracks.map((track) =>
-        unbound_getTrackItem(track, {getArtistString, link, language})
-      )
-    );
-
   const hasCommentary =
     track.commentary || otherReleases.some((t) => t.commentary);
   const generateCommentary = ({link, language, transformMultiline}) =>
@@ -182,7 +171,6 @@ export function write(track, {wikiData}) {
       getTrackCover,
       link,
       language,
-      transformInline,
       transformLyrics,
       transformMultiline,
       to,
diff --git a/src/repl.js b/src/repl.js
index 5a6334a1..bd447bec 100644
--- a/src/repl.js
+++ b/src/repl.js
@@ -3,32 +3,23 @@
 import * as os from 'os';
 import * as path from 'path';
 import * as repl from 'repl';
-import {fileURLToPath} from 'url';
-import {promisify} from 'util';
 
 import {quickLoadAllFromYAML} from './data/yaml.js';
 import {logError, parseOptions} from './util/cli.js';
 import {showAggregate} from './util/sugar.js';
 
-const __dirname = path.dirname(fileURLToPath(import.meta.url));
-
 async function main() {
   const miscOptions = await parseOptions(process.argv.slice(2), {
     'data-path': {
       type: 'value',
     },
 
-    'show-traces': {
-      type: 'flag',
-    },
-
     'no-history': {
       type: 'flag',
     },
   });
 
   const dataPath = miscOptions['data-path'] || process.env.HSMUSIC_DATA;
-  const showAggregateTraces = miscOptions['show-traces'] ?? false;
   const disableHistory = miscOptions['no-history'] ?? false;
 
   if (!dataPath) {
diff --git a/src/static/client.js b/src/static/client.js
index 8342eb15..1ffcb939 100644
--- a/src/static/client.js
+++ b/src/static/client.js
@@ -11,8 +11,8 @@ import {getColors} from '../util/colors.js';
 
 import {getArtistNumContributions} from '../util/wiki-data.js';
 
-let albumData, artistData, flashData;
-let officialAlbumData, fandomAlbumData, artistNames;
+let albumData, artistData;
+let officialAlbumData, fandomAlbumData;
 
 let ready = false;
 
@@ -73,43 +73,12 @@ function getAlbum(el) {
   return albumData.find((album) => album.directory === directory);
 }
 
-function getFlash(el) {
-  const directory = cssProp(el, '--flash-directory');
-  return flashData.find((flash) => flash.directory === directory);
-}
-
 // TODO: These should pro8a8ly access some shared urlSpec path. We'd need to
 // separ8te the tooling around that into common-shared code too.
 const getLinkHref = (type, directory) => rebase(`${type}/${directory}`);
 const openAlbum = (d) => rebase(`album/${d}`);
 const openTrack = (d) => rebase(`track/${d}`);
 const openArtist = (d) => rebase(`artist/${d}`);
-const openFlash = (d) => rebase(`flash/${d}`);
-
-function getTrackListAndIndex() {
-  const album = getAlbum(document.body);
-  const directory = cssProp(document.body, '--track-directory');
-  if (!directory && !album) return {};
-  if (!directory) return {list: album.tracks};
-  const trackIndex = album.tracks.findIndex(
-    (track) => track.directory === directory
-  );
-  return {list: album.tracks, index: trackIndex};
-}
-
-function openRandomTrack() {
-  const {list} = getTrackListAndIndex();
-  if (!list) return;
-  return openTrack(pick(list));
-}
-
-function getFlashListAndIndex() {
-  const list = flashData.filter((flash) => !flash.act8r8k);
-  const flash = getFlash(document.body);
-  if (!flash) return {list};
-  const flashIndex = list.indexOf(flash);
-  return {list, index: flashIndex};
-}
 
 // TODO: This should also use urlSpec.
 function fetchData(type, directory) {
@@ -230,7 +199,6 @@ fetch(rebase('data.json', 'rebaseShared'))
   .then((data) => {
     albumData = data.albumData;
     artistData = data.artistData;
-    flashData = data.flashData;
 
     officialAlbumData = albumData.filter((album) =>
       album.groups.includes('group:official')
@@ -238,9 +206,6 @@ fetch(rebase('data.json', 'rebaseShared'))
     fandomAlbumData = albumData.filter(
       (album) => !album.groups.includes('group:official')
     );
-    artistNames = artistData
-      .filter((artist) => !artist.alias)
-      .map((artist) => artist.name);
 
     for (const element of elements1) element.style.display = 'none';
     for (const element of elements2) element.style.display = 'block';
@@ -436,7 +401,7 @@ function makeInfoCardLinkHandlers(type) {
       infoCard.cancelHide();
     },
 
-    mouseleave(evt) {
+    mouseleave() {
       clearTimeout(hoverTimeout);
 
       if (fastHover && !endFastHoverTimeout) {
diff --git a/src/static/lazy-loading.js b/src/static/lazy-loading.js
index 8f3e8cf5..1b779d26 100644
--- a/src/static/lazy-loading.js
+++ b/src/static/lazy-loading.js
@@ -33,16 +33,17 @@ function lazyLoadMain() {
   }
 
   var lazyElements = document.getElementsByClassName('lazy');
+  var i;
   if (window.IntersectionObserver) {
     observer = new IntersectionObserver(lazyLoad, {
       rootMargin: '200px',
       threshold: 1.0,
     });
-    for (var i = 0; i < lazyElements.length; i++) {
+    for (i = 0; i < lazyElements.length; i++) {
       observer.observe(lazyElements[i]);
     }
   } else {
-    for (var i = 0; i < lazyElements.length; i++) {
+    for (i = 0; i < lazyElements.length; i++) {
       var element = lazyElements[i];
       var original = element.getAttribute('data-original');
       element.setAttribute('src', original);
diff --git a/src/upd8.js b/src/upd8.js
index 72708efa..462507e8 100755
--- a/src/upd8.js
+++ b/src/upd8.js
@@ -33,7 +33,6 @@
 // node.js and you'll 8e fine. ...Within the project root. O8viously.
 
 import * as path from 'path';
-import {promisify} from 'util';
 import {fileURLToPath} from 'url';
 
 // I made this dependency myself! A long, long time ago. It is pro8a8ly my
@@ -55,8 +54,6 @@ import {
   unlink,
 } from 'fs/promises';
 
-import {inspect as nodeInspect} from 'util';
-
 import genThumbs from './gen-thumbs.js';
 import {listingSpec, listingTargetSpec} from './listing-spec.js';
 import urlSpec from './url-spec.js';
@@ -112,25 +109,18 @@ import {
   logError,
   parseOptions,
   progressPromiseAll,
-  ENABLE_COLOR,
 } from './util/cli.js';
 
 import {validateReplacerSpec, transformInline} from './util/replacer.js';
 
 import {
-  chunkByConditions,
-  chunkByProperties,
   getAlbumCover,
-  getAlbumListTag,
-  getAllTracks,
   getArtistAvatar,
-  getArtistNumContributions,
   getFlashCover,
-  getKebabCase,
-  getTotalDuration,
   getTrackCover,
 } from './util/wiki-data.js';
 
+/*
 import {
   serializeContribs,
   serializeCover,
@@ -139,30 +129,20 @@ import {
   serializeImagePaths,
   serializeLink,
 } from './util/serialize.js';
+*/
 
 import {
   bindOpts,
-  decorateErrorWithIndex,
-  filterAggregateAsync,
   filterEmptyLines,
-  mapAggregate,
-  mapAggregateAsync,
-  openAggregate,
   queue,
   showAggregate,
-  splitArray,
-  unique,
-  withAggregate,
   withEntries,
 } from './util/sugar.js';
 
 import {generateURLs, thumb} from './util/urls.js';
 
 // Pensive emoji!
-import {
-  FANDOM_GROUP_DIRECTORY,
-  OFFICIAL_GROUP_DIRECTORY,
-} from './util/magic-constants.js';
+import { OFFICIAL_GROUP_DIRECTORY } from './util/magic-constants.js';
 
 import FileSizePreloader from './file-size-preloader.js';
 
@@ -191,10 +171,6 @@ const OEMBED_JSON_FILE = 'oembed.json';
 // Automatically copied (if present) from media directory to site root.
 const FAVICON_FILE = 'favicon.ico';
 
-function inspect(value) {
-  return nodeInspect(value, {colors: ENABLE_COLOR});
-}
-
 // Shared varia8les! These are more efficient to access than a shared varia8le
 // (or at least I h8pe so), and are easier to pass across functions than a
 // 8unch of specific arguments.
@@ -1044,8 +1020,6 @@ writePage.html = (
   const navLinkParts = [];
   for (let i = 0; i < links.length; i++) {
     let cur = links[i];
-    const prev = links[i - 1];
-    const next = links[i + 1];
 
     let {title: linkTitle} = cur;
 
@@ -1616,7 +1590,7 @@ async function wrapLanguages(fn, {languages, writeOneLanguage = null}) {
   );
 
   for (let i = 0; i < entries.length; i++) {
-    const [key, language] = entries[i];
+    const [_key, language] = entries[i];
 
     await fn(language, i, entries);
   }
@@ -2264,7 +2238,7 @@ async function main() {
       `Writing ${language.code}`,
       queue(
         [
-          ...pageWrites.map(({type, ...props}) => () => {
+          ...pageWrites.map((props) => () => {
             const {path, page} = props;
 
             // TODO: This only supports one <>-style argument.
@@ -2276,7 +2250,7 @@ async function main() {
                 .filter(
                   ([key, language]) => key !== 'default' && !language.hidden
                 )
-                .map(([key, language]) => [
+                .map(([_key, language]) => [
                   language.code,
                   writePage.paths(
                     language === finalDefaultLanguage ? '' : language.code,
diff --git a/src/util/find.js b/src/util/find.js
index 460a4fad..71026fa2 100644
--- a/src/util/find.js
+++ b/src/util/find.js
@@ -1,18 +1,19 @@
 /** @format */
 
-import {color, logError, logWarn} from './cli.js';
+import {color, logWarn} from './cli.js';
 
 import {inspect} from 'util';
 
 function warnOrThrow(mode, message) {
-  switch (mode) {
-    case 'error':
-      throw new Error(message);
-    case 'warn':
-      logWarn(message);
-    default:
-      return null;
+  if (mode === 'error') {
+    throw new Error(message);
   }
+
+  if (mode === 'warn') {
+    logWarn(message);
+  }
+
+  return null;
 }
 
 function findHelper(keys, findFns = {}) {
@@ -80,7 +81,7 @@ function findHelper(keys, findFns = {}) {
   };
 }
 
-function matchDirectory(ref, data, mode) {
+function matchDirectory(ref, data) {
   return data.find(({directory}) => directory === ref);
 }
 
diff --git a/src/util/html.js b/src/util/html.js
index f5b7bdcc..0ba923b3 100644
--- a/src/util/html.js
+++ b/src/util/html.js
@@ -102,7 +102,7 @@ export function attributes(attribs) {
           `Attribute value for ${key} should be primitive or array, got ${typeof val}`
         );
     })
-    .filter(([key, val, keep]) => keep)
+    .filter(([_key, _val, keep]) => keep)
     .map(([key, val]) =>
       typeof val === 'boolean'
         ? `${key}`
diff --git a/src/util/io.js b/src/util/io.js
index 5c1ab240..4a6e95f3 100644
--- a/src/util/io.js
+++ b/src/util/io.js
@@ -6,10 +6,10 @@
 import {readdir} from 'fs/promises';
 import * as path from 'path';
 
-export async function findFiles(
-  dataPath,
-  {filter = (f) => true, joinParentDirectory = true} = {}
-) {
+export async function findFiles(dataPath, {
+  filter = () => true,
+  joinParentDirectory = true,
+} = {}) {
   return (await readdir(dataPath))
     .filter((file) => filter(file))
     .map((file) => (joinParentDirectory ? path.join(dataPath, file) : file));
diff --git a/src/util/replacer.js b/src/util/replacer.js
index 6f4d0e9b..70c17e5f 100644
--- a/src/util/replacer.js
+++ b/src/util/replacer.js
@@ -1,5 +1,7 @@
 /** @format */
 
+import fixWS from 'fix-whitespace';
+
 import {logError, logWarn} from './cli.js';
 import {escapeRegex} from './sugar.js';
 
@@ -8,7 +10,7 @@ export function validateReplacerSpec(replacerSpec, {find, link}) {
 
   for (const [
     key,
-    {link: linkKey, find: findKey, value, html},
+    {link: linkKey, find: findKey, html},
   ] of Object.entries(replacerSpec)) {
     if (!html && !link[linkKey]) {
       logError`The replacer spec ${key} has invalid link key ${linkKey}! Specify it in link specs or fix typo.`;
@@ -58,7 +60,7 @@ const endOfInput = (i, comment) =>
 // These are 8asically stored on the glo8al scope, which might seem odd
 // for a recursive function, 8ut the values are only ever used immediately
 // after they're set.
-let stopped, stop_iMatch, stop_iParse, stop_literal;
+let stopped, stop_iParse, stop_literal;
 
 function parseOneTextNode(input, i, stopAt) {
   return parseNodes(input, i, stopAt, true)[0];
@@ -66,7 +68,6 @@ function parseOneTextNode(input, i, stopAt) {
 
 function parseNodes(input, i, stopAt, textOnly) {
   let nodes = [];
-  let escapeNext = false;
   let string = '';
   let iString = 0;
 
@@ -103,7 +104,7 @@ function parseNodes(input, i, stopAt, textOnly) {
   // 8ut it's a pain to hard-code them all, so we dynamically gener8te
   // and cache them for reuse instead.
   let regexp;
-  if (regexpCache.hasOwnProperty(regexpSource)) {
+  if (Object.hasOwn(regexpCache, regexpSource)) {
     regexp = regexpCache[regexpSource];
   } else {
     regexp = new RegExp(regexpSource);
@@ -151,7 +152,6 @@ function parseNodes(input, i, stopAt, textOnly) {
 
     if (stopHere) {
       stopped = true;
-      stop_iMatch = closestMatchIndex;
       stop_iParse = i;
       stop_literal = closestMatch;
       break;
@@ -332,15 +332,15 @@ export function parseInput(input) {
     const cursor = i - lineStart;
 
     throw new SyntaxError(fixWS`
-            Parse error (at pos ${i}): ${message}
-            ${line}
-            ${'-'.repeat(cursor) + '^'}
-        `);
+      Parse error (at pos ${i}): ${message}
+      ${line}
+      ${'-'.repeat(cursor) + '^'}
+    `);
   }
 }
 
 function evaluateTag(node, opts) {
-  const {find, input, language, link, replacerSpec, to, wikiData} = opts;
+  const {find, input, language, link, replacerSpec, to} = opts;
 
   const source = input.slice(node.i, node.iEnd);
 
diff --git a/src/util/sugar.js b/src/util/sugar.js
index 0a5de482..2883d949 100644
--- a/src/util/sugar.js
+++ b/src/util/sugar.js
@@ -90,7 +90,7 @@ export function delay(ms) {
 // There's a proposal for a native JS function like this, 8ut it's not even
 // past stage 1 yet: https://github.com/tc39/proposal-regex-escaping
 export function escapeRegex(string) {
-  return string.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
+  return string.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
 }
 
 export function bindOpts(fn, bind) {
@@ -319,13 +319,6 @@ function _filterAggregate(mode, promiseAll, array, fn, aggregateOpts) {
     return value === aggregateOpts.returnOnFail ? value : value.input;
   }
 
-  function wrapperFunction(x, ...rest) {
-    return {
-      input: x,
-      output: fn(x, ...rest),
-    };
-  }
-
   if (mode === 'sync') {
     const result = array
       .map(
@@ -426,9 +419,7 @@ export function showAggregate(
         error.errors
           .map((error) => recursive(error, {level: level + 1}))
           .flatMap((str) => str.split('\n'))
-          .map((line, i, lines) =>
-            i === 0 ? ` ${head} ${line}` : ` ${bar} ${line}`
-          )
+          .map((line, i) => i === 0 ? ` ${head} ${line}` : ` ${bar} ${line}`)
           .join('\n')
       );
     } else {
diff --git a/src/util/urls.js b/src/util/urls.js
index ce747df2..45ec4c85 100644
--- a/src/util/urls.js
+++ b/src/util/urls.js
@@ -14,19 +14,19 @@ import * as path from 'path';
 import {withEntries} from './sugar.js';
 
 export function generateURLs(urlSpec) {
-  const getValueForFullKey = (obj, fullKey, prop = null) => {
+  const getValueForFullKey = (obj, fullKey) => {
     const [groupKey, subKey] = fullKey.split('.');
     if (!groupKey || !subKey) {
       throw new Error(`Expected group key and subkey (got ${fullKey})`);
     }
 
-    if (!obj.hasOwnProperty(groupKey)) {
+    if (!Object.hasOwn(obj, groupKey)) {
       throw new Error(`Expected valid group key (got ${groupKey})`);
     }
 
     const group = obj[groupKey];
 
-    if (!group.hasOwnProperty(subKey)) {
+    if (!Object.hasOwn(group, subKey)) {
       throw new Error(
         `Expected valid subkey (got ${subKey} for group ${groupKey})`
       );
diff --git a/src/util/wiki-data.js b/src/util/wiki-data.js
index 65eb7d7c..3e564b96 100644
--- a/src/util/wiki-data.js
+++ b/src/util/wiki-data.js
@@ -9,7 +9,7 @@ export function getKebabCase(name) {
     .split(' ')
     .join('-')
     .replace(/&/g, 'and')
-    .replace(/[^a-zA-Z0-9\-]/g, '')
+    .replace(/[^a-zA-Z0-9-]/g, '')
     .replace(/-{2,}/g, '-')
     .replace(/^-+|-+$/g, '')
     .toLowerCase();