Add "error" as a rule/tag/default value in Configuration object, add tests for similar values, resolve some new type-checking issues.

This commit is contained in:
David Anson 2025-09-16 20:47:08 -07:00
parent c4b5d1f937
commit 1d2d3ed581
7 changed files with 1999 additions and 384 deletions

View file

@ -4,11 +4,13 @@ import fs from "node:fs/promises";
import path from "node:path";
import { fileURLToPath } from "node:url";
/* eslint-disable jsdoc/no-undefined-types */
/**
* Gets the file name of the current module.
* Shims import.meta.filename for Node 18.
*
* @param {Object} meta ESM import.meta object.
* @param {ImportMeta} meta ESM import.meta object.
* @returns {string} File name.
*/
// eslint-disable-next-line no-underscore-dangle
@ -18,7 +20,7 @@ export const __filename = (meta) => fileURLToPath(meta.url);
* Gets the directory name of the current module.
* Shims import.meta.dirname for Node 18.
*
* @param {Object} meta ESM import.meta object.
* @param {ImportMeta} meta ESM import.meta object.
* @returns {string} Directory name.
*/
// eslint-disable-next-line no-underscore-dangle
@ -28,9 +30,9 @@ export const __dirname = (meta) => path.dirname(__filename(meta));
* Imports a file as JSON.
* Avoids "ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time".
*
* @param {Object} meta ESM import.meta object.
* @param {ImportMeta} meta ESM import.meta object.
* @param {string} file JSON file to import.
* @returns {Promise<Object>} JSON object.
* @returns {Promise<any>} JSON object.
*/
export const importWithTypeJson = async(meta, file) => (
// @ts-ignore