Use eslint

This commit is contained in:
Ben Edgington
2025-05-24 20:48:15 +01:00
parent 422c2b9387
commit c177509cb5
7 changed files with 1003 additions and 1 deletions

26
eslint.config.js Normal file
View File

@@ -0,0 +1,26 @@
import js from '@eslint/js';
import globals from 'globals';
import css from '@eslint/css';
import { defineConfig } from 'eslint/config';
export default defineConfig([
{
files: ['**/*.{js,mjs,cjs}'],
plugins: { js },
extends: ['js/recommended'],
},
{
files: ['**/*.{js,mjs,cjs}'],
languageOptions: { globals: { ...globals.browser, ...globals.node } },
},
{
rules: {
'no-unused-vars': [
'error',
{
caughtErrors: 'none',
},
],
},
},
]);

View File

@@ -1,4 +1,5 @@
import { visit } from 'unist-util-visit';
import fs from 'fs';
// Add a tooltip to constant values in the text according to the mapping in the
// supplied file.

View File

@@ -1,3 +1,5 @@
import fs from 'fs';
// Write a .htaccess file to set the correct 404 page
function writeHtaccess(base, dir, logger) {

View File

@@ -8,7 +8,7 @@ const searchIndex = [];
function isExcludedFrontmatter(frontmatter, exclude) {
for (let i = 0; i < exclude.frontmatter.length; i++) {
const test = exclude.frontmatter[i];
const [key, ...rest] = Object.keys(test);
const key = Object.keys(test)[0];
if (
Object.prototype.hasOwnProperty.call(frontmatter, key) &&
frontmatter[key] == test[key]

View File

@@ -2,6 +2,7 @@ import { visit } from 'unist-util-visit';
import { optimize } from 'svgo';
import { getHashDigest } from 'loader-utils';
import path from 'path';
import fs from 'fs';
// Inline SVG files into the Markdown AST

967
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -34,5 +34,10 @@
"rehype-katex": "^7.0.1",
"remark-math": "^6.0.0",
"svgo": "^4.0.0-rc.4"
},
"devDependencies": {
"@eslint/js": "^9.27.0",
"eslint": "^9.27.0",
"globals": "^16.1.0"
}
}