@eslint/config-array
Advanced tools
| /** | ||
| * @fileoverview Types for the config-array package. | ||
| * @author Nicholas C. Zakas | ||
| */ | ||
| /** | ||
| * A file matcher used in `files` and `ignores`. | ||
| */ | ||
| export type FileMatcher = string | ((filePath: string) => boolean); | ||
| /** | ||
| * An entry in a config's `files` array. | ||
| * | ||
| * A subarray means all matchers must match. | ||
| */ | ||
| export type FilesMatcher = FileMatcher | FileMatcher[]; | ||
| /** | ||
| * The config types allowed in the `extraConfigTypes` option. | ||
| */ | ||
| export type ExtraConfigType = "array" | "function"; | ||
| export interface ConfigObject { | ||
| /** | ||
| * The base path for files and ignores. | ||
| */ | ||
| basePath?: string; | ||
| /** | ||
| * The files to include. | ||
| */ | ||
| files?: FilesMatcher[]; | ||
| /** | ||
| * The files to exclude. | ||
| */ | ||
| ignores?: FileMatcher[]; | ||
| /** | ||
| * The name of the config object. | ||
| */ | ||
| name?: string; | ||
| // may also have any number of other properties | ||
| [key: string]: unknown; | ||
| } |
+151
-2
@@ -1,2 +0,151 @@ | ||
| import type * as types from "../esm/index.js" with { "resolution-mode": "import" }; | ||
| export = types; | ||
| export { ObjectSchema } from "@eslint/object-schema"; | ||
| export type PropertyDefinition = $eslintobjectschema.PropertyDefinition; | ||
| export type ObjectDefinition = $eslintobjectschema.ObjectDefinition; | ||
| export type ConfigObject = $typests.ConfigObject; | ||
| export type FileMatcher = $typests.FileMatcher; | ||
| export type FilesMatcher = $typests.FilesMatcher; | ||
| export type ExtraConfigType = $typests.ExtraConfigType; | ||
| export type MinimatchOptions = $minimatch.MinimatchOptions; | ||
| export type ObjectSchemaInstance = ObjectSchema; | ||
| /** | ||
| * Represents an array of config objects and provides method for working with | ||
| * those config objects. | ||
| */ | ||
| export class ConfigArray extends Array<any> { | ||
| /** | ||
| * Creates a new instance of ConfigArray. | ||
| * @param {Iterable|Function|Object} configs An iterable yielding config | ||
| * objects, or a config function, or a config object. | ||
| * @param {Object} options The options for the ConfigArray. | ||
| * @param {string} [options.basePath="/"] The absolute path of the config file directory. | ||
| * Defaults to `"/"`. | ||
| * @param {boolean} [options.normalized=false] Flag indicating if the | ||
| * configs have already been normalized. | ||
| * @param {ObjectDefinition} [options.schema] The additional schema | ||
| * definitions to use for the ConfigArray schema. | ||
| * @param {ReadonlyArray<ExtraConfigType>} [options.extraConfigTypes] List of config types supported. | ||
| * @throws {TypeError} When the `basePath` is not a non-empty string, | ||
| */ | ||
| constructor(configs: Iterable<any> | Function | any, { basePath, normalized, schema: customSchema, extraConfigTypes, }?: { | ||
| basePath?: string; | ||
| normalized?: boolean; | ||
| schema?: ObjectDefinition; | ||
| extraConfigTypes?: ReadonlyArray<ExtraConfigType>; | ||
| }); | ||
| /** | ||
| * The path of the config file that this array was loaded from. | ||
| * This is used to calculate filename matches. | ||
| * @property basePath | ||
| * @type {string} | ||
| */ | ||
| basePath: string; | ||
| /** | ||
| * The supported config types. | ||
| * @type {ReadonlyArray<ExtraConfigType>} | ||
| */ | ||
| extraConfigTypes: ReadonlyArray<ExtraConfigType>; | ||
| /** | ||
| * Returns the `files` globs from every config object in the array. | ||
| * This can be used to determine which files will be matched by a | ||
| * config array or to use as a glob pattern when no patterns are provided | ||
| * for a command line interface. | ||
| * @returns {Array<FilesMatcher>} An array of matchers. | ||
| */ | ||
| get files(): Array<FilesMatcher>; | ||
| /** | ||
| * Returns ignore matchers that should always be ignored regardless of | ||
| * the matching `files` fields in any configs. This is necessary to mimic | ||
| * the behavior of things like .gitignore and .eslintignore, allowing a | ||
| * globbing operation to be faster. | ||
| * @returns {Array<{ basePath?: string, name?: string, ignores: FileMatcher[] }>} An array of config objects representing global ignores. | ||
| */ | ||
| get ignores(): Array<{ | ||
| basePath?: string; | ||
| name?: string; | ||
| ignores: FileMatcher[]; | ||
| }>; | ||
| /** | ||
| * Indicates if the config array has been normalized. | ||
| * @returns {boolean} True if the config array is normalized, false if not. | ||
| */ | ||
| isNormalized(): boolean; | ||
| /** | ||
| * Normalizes a config array by flattening embedded arrays and executing | ||
| * config functions. | ||
| * @param {Object} [context] The context object for config functions. | ||
| * @returns {Promise<ConfigArray>} The current ConfigArray instance. | ||
| */ | ||
| normalize(context?: any): Promise<ConfigArray>; | ||
| /** | ||
| * Normalizes a config array by flattening embedded arrays and executing | ||
| * config functions. | ||
| * @param {Object} [context] The context object for config functions. | ||
| * @returns {ConfigArray} The current ConfigArray instance. | ||
| */ | ||
| normalizeSync(context?: any): ConfigArray; | ||
| /** | ||
| * Returns the config object for a given file path and a status that can be used to determine why a file has no config. | ||
| * @param {string} filePath The path of a file to get a config for. | ||
| * @returns {{ config?: Object, status: "ignored"|"external"|"unconfigured"|"matched" }} | ||
| * An object with an optional property `config` and property `status`. | ||
| * `config` is the config object for the specified file as returned by {@linkcode ConfigArray.getConfig}, | ||
| * `status` a is one of the constants returned by {@linkcode ConfigArray.getConfigStatus}. | ||
| */ | ||
| getConfigWithStatus(filePath: string): { | ||
| config?: any; | ||
| status: "ignored" | "external" | "unconfigured" | "matched"; | ||
| }; | ||
| /** | ||
| * Returns the config object for a given file path. | ||
| * @param {string} filePath The path of a file to get a config for. | ||
| * @returns {Object|undefined} The config object for this file or `undefined`. | ||
| */ | ||
| getConfig(filePath: string): any | undefined; | ||
| /** | ||
| * Determines whether a file has a config or why it doesn't. | ||
| * @param {string} filePath The path of the file to check. | ||
| * @returns {"ignored"|"external"|"unconfigured"|"matched"} One of the following values: | ||
| * * `"ignored"`: the file is ignored | ||
| * * `"external"`: the file is outside the base path | ||
| * * `"unconfigured"`: the file is not matched by any config | ||
| * * `"matched"`: the file has a matching config | ||
| */ | ||
| getConfigStatus(filePath: string): "ignored" | "external" | "unconfigured" | "matched"; | ||
| /** | ||
| * Determines if the given filepath is ignored based on the configs. | ||
| * @param {string} filePath The path of a file to check. | ||
| * @returns {boolean} True if the path is ignored, false if not. | ||
| * @deprecated Use `isFileIgnored` instead. | ||
| */ | ||
| isIgnored(filePath: string): boolean; | ||
| /** | ||
| * Determines if the given filepath is ignored based on the configs. | ||
| * @param {string} filePath The path of a file to check. | ||
| * @returns {boolean} True if the path is ignored, false if not. | ||
| */ | ||
| isFileIgnored(filePath: string): boolean; | ||
| /** | ||
| * Determines if the given directory is ignored based on the configs. | ||
| * This checks only default `ignores` that don't have `files` in the | ||
| * same config. A pattern such as `/foo` be considered to ignore the directory | ||
| * while a pattern such as `/foo/**` is not considered to ignore the | ||
| * directory because it is matching files. | ||
| * @param {string} directoryPath The path of a directory to check. | ||
| * @returns {boolean} True if the directory is ignored, false if not. Will | ||
| * return true for any directory that is not inside of `basePath`. | ||
| * @throws {Error} When the `ConfigArray` is not normalized. | ||
| */ | ||
| isDirectoryIgnored(directoryPath: string): boolean; | ||
| #private; | ||
| } | ||
| export namespace ConfigArraySymbol { | ||
| let isNormalized: symbol; | ||
| let configCache: symbol; | ||
| let schema: symbol; | ||
| let finalizeConfig: symbol; | ||
| let preprocessConfig: symbol; | ||
| } | ||
| import type * as $eslintobjectschema from "@eslint/object-schema"; | ||
| import type * as $typests from "./types.cts"; | ||
| import type * as $minimatch from "minimatch"; | ||
| import { ObjectSchema } from '@eslint/object-schema'; |
+2
-2
| { | ||
| "name": "@eslint/config-array", | ||
| "version": "0.23.4", | ||
| "version": "0.23.5", | ||
| "description": "General purpose glob-based configuration matching.", | ||
@@ -54,3 +54,3 @@ "author": "Nicholas C. Zakas", | ||
| "dependencies": { | ||
| "@eslint/object-schema": "^3.0.4", | ||
| "@eslint/object-schema": "^3.0.5", | ||
| "debug": "^4.3.1", | ||
@@ -57,0 +57,0 @@ "minimatch": "^10.2.4" |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
328752
2.45%14
7.69%35
2.94%Updated