Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@typescript-eslint/utils

Package Overview
Dependencies
Maintainers
2
Versions
2220
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@typescript-eslint/utils - npm Package Compare versions

Comparing version 8.2.1-alpha.7 to 8.2.1-alpha.8

2

dist/ast-utils/eslint-utils/astUtilities.d.ts

@@ -72,2 +72,3 @@ import type * as TSESLint from '../../ts-eslint';

declare const isParenthesized: {
(times: number, node: TSESTree.Node, sourceCode: TSESLint.SourceCode): boolean;
/**

@@ -83,5 +84,4 @@ * Check whether a given node is parenthesized or not.

(node: TSESTree.Node, sourceCode: TSESLint.SourceCode): boolean;
(times: number, node: TSESTree.Node, sourceCode: TSESLint.SourceCode): boolean;
};
export { getFunctionHeadLocation, getFunctionNameWithKind, getPropertyName, getStaticValue, getStringIfConstant, hasSideEffect, isParenthesized, };
//# sourceMappingURL=astUtilities.d.ts.map
interface PatternMatcher {
/**
* Iterate all matched parts in a given string.
*
* @see {@link https://eslint-community.github.io/eslint-utils/api/ast-utils.html#matcher-execall}
*/
execAll(str: string): IterableIterator<RegExpExecArray>;
/**
* Check whether this pattern matches a given string or not.
*
* @see {@link https://eslint-community.github.io/eslint-utils/api/ast-utils.html#matcher-test}
*/
test(str: string): boolean;
/**
* Replace all matched parts by a given replacer.

@@ -36,3 +24,15 @@ *

*/
[Symbol.replace](str: string, replacer: string | ((...strs: string[]) => string)): string;
[Symbol.replace](str: string, replacer: ((...strs: string[]) => string) | string): string;
/**
* Iterate all matched parts in a given string.
*
* @see {@link https://eslint-community.github.io/eslint-utils/api/ast-utils.html#matcher-execall}
*/
execAll(str: string): IterableIterator<RegExpExecArray>;
/**
* Check whether this pattern matches a given string or not.
*
* @see {@link https://eslint-community.github.io/eslint-utils/api/ast-utils.html#matcher-test}
*/
test(str: string): boolean;
}

@@ -39,0 +39,0 @@ /**

import type { TSESTree } from '../../ts-estree';
type IsSpecificTokenFunction<SpecificToken extends TSESTree.Token> = (token: TSESTree.Token) => token is SpecificToken;
type IsNotSpecificTokenFunction<SpecificToken extends TSESTree.Token> = (token: TSESTree.Token) => token is Exclude<TSESTree.Token, SpecificToken>;
type PunctuatorTokenWithValue<Value extends string> = TSESTree.PunctuatorToken & {
type PunctuatorTokenWithValue<Value extends string> = {
value: Value;
};
} & TSESTree.PunctuatorToken;
type IsPunctuatorTokenWithValueFunction<Value extends string> = IsSpecificTokenFunction<PunctuatorTokenWithValue<Value>>;

@@ -8,0 +8,0 @@ type IsNotPunctuatorTokenWithValueFunction<Value extends string> = IsNotSpecificTokenFunction<PunctuatorTokenWithValue<Value>>;

@@ -10,9 +10,2 @@ import type * as TSESLint from '../../ts-eslint';

* Iterate the references that the given `traceMap` determined.
* This method starts to search from global variables.
*
* @see {@link https://eslint-community.github.io/eslint-utils/api/scope-utils.html#tracker-iterateglobalreferences}
*/
iterateGlobalReferences<T>(traceMap: ReferenceTracker.TraceMap<T>): IterableIterator<ReferenceTracker.FoundReference<T>>;
/**
* Iterate the references that the given `traceMap` determined.
* This method starts to search from `require()` expression.

@@ -30,6 +23,20 @@ *

iterateEsmReferences<T>(traceMap: ReferenceTracker.TraceMap<T>): IterableIterator<ReferenceTracker.FoundReference<T>>;
/**
* Iterate the references that the given `traceMap` determined.
* This method starts to search from global variables.
*
* @see {@link https://eslint-community.github.io/eslint-utils/api/scope-utils.html#tracker-iterateglobalreferences}
*/
iterateGlobalReferences<T>(traceMap: ReferenceTracker.TraceMap<T>): IterableIterator<ReferenceTracker.FoundReference<T>>;
}
interface ReferenceTrackerStatic {
readonly CALL: typeof ReferenceTrackerCALL;
readonly CONSTRUCT: typeof ReferenceTrackerCONSTRUCT;
readonly ESM: typeof ReferenceTrackerESM;
new (globalScope: TSESLint.Scope.Scope, options?: {
/**
* The name list of Global Object. Optional. Default is `["global", "globalThis", "self", "window"]`.
*/
globalObjectNames?: readonly string[];
/**
* The mode which determines how the `tracker.iterateEsmReferences()` method scans CommonJS modules.

@@ -40,11 +47,4 @@ * If this is `"strict"`, the method binds CommonJS modules to the default export. Otherwise, the method binds

mode?: 'legacy' | 'strict';
/**
* The name list of Global Object. Optional. Default is `["global", "globalThis", "self", "window"]`.
*/
globalObjectNames?: readonly string[];
}): ReferenceTracker;
readonly READ: typeof ReferenceTrackerREAD;
readonly CALL: typeof ReferenceTrackerCALL;
readonly CONSTRUCT: typeof ReferenceTrackerCONSTRUCT;
readonly ESM: typeof ReferenceTrackerESM;
}

@@ -59,13 +59,13 @@ declare namespace ReferenceTracker {

interface TraceMapElement<T> {
[ReferenceTrackerREAD]?: T;
[key: string]: TraceMapElement<T>;
[ReferenceTrackerCALL]?: T;
[ReferenceTrackerCONSTRUCT]?: T;
[ReferenceTrackerESM]?: true;
[key: string]: TraceMapElement<T>;
[ReferenceTrackerREAD]?: T;
}
interface FoundReference<T = any> {
info: T;
node: TSESTree.Node;
path: readonly string[];
type: ReferenceType;
info: T;
}

@@ -72,0 +72,0 @@ }

@@ -13,5 +13,5 @@ import type { AST_NODE_TYPES, AST_TOKEN_TYPES, TSESTree } from '../ts-estree';

type: TokenType;
}>, Conditions extends Partial<TSESTree.Token & {
}>, Conditions extends Partial<{
type: TokenType;
}>>(tokenType: TokenType, conditions: Conditions) => ((token: TSESTree.Token | null | undefined) => token is Conditions & ExtractedToken);
} & TSESTree.Token>>(tokenType: TokenType, conditions: Conditions) => ((token: TSESTree.Token | null | undefined) => token is Conditions & ExtractedToken);
export declare const isNotTokenOfTypeWithConditions: <TokenType extends AST_TOKEN_TYPES, ExtractedToken extends Extract<TSESTree.Token, {

@@ -18,0 +18,0 @@ type: TokenType;

@@ -95,3 +95,3 @@ import type { TSESTree } from '../ts-estree';

}>;
export { isAwaitExpression, isAwaitKeyword, isConstructor, isClassOrTypeElement, isFunction, isFunctionOrFunctionType, isFunctionType, isIdentifier, isImportKeyword, isLoop, isLogicalOrOperator, isNonNullAssertionPunctuator, isNotNonNullAssertionPunctuator, isNotOptionalChainPunctuator, isOptionalChainPunctuator, isOptionalCallExpression, isSetter, isTSConstructorType, isTSFunctionType, isTypeAssertion, isTypeKeyword, isVariableDeclarator, };
export { isAwaitExpression, isAwaitKeyword, isClassOrTypeElement, isConstructor, isFunction, isFunctionOrFunctionType, isFunctionType, isIdentifier, isImportKeyword, isLogicalOrOperator, isLoop, isNonNullAssertionPunctuator, isNotNonNullAssertionPunctuator, isNotOptionalChainPunctuator, isOptionalCallExpression, isOptionalChainPunctuator, isSetter, isTSConstructorType, isTSFunctionType, isTypeAssertion, isTypeKeyword, isVariableDeclarator, };
//# sourceMappingURL=predicates.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isVariableDeclarator = exports.isTypeKeyword = exports.isTypeAssertion = exports.isTSFunctionType = exports.isTSConstructorType = exports.isOptionalCallExpression = exports.isOptionalChainPunctuator = exports.isNotOptionalChainPunctuator = exports.isNotNonNullAssertionPunctuator = exports.isNonNullAssertionPunctuator = exports.isLogicalOrOperator = exports.isLoop = exports.isImportKeyword = exports.isIdentifier = exports.isFunctionType = exports.isFunctionOrFunctionType = exports.isFunction = exports.isClassOrTypeElement = exports.isConstructor = exports.isAwaitKeyword = exports.isAwaitExpression = void 0;
exports.isVariableDeclarator = exports.isTypeKeyword = exports.isTypeAssertion = exports.isTSFunctionType = exports.isTSConstructorType = exports.isOptionalChainPunctuator = exports.isOptionalCallExpression = exports.isNotOptionalChainPunctuator = exports.isNotNonNullAssertionPunctuator = exports.isNonNullAssertionPunctuator = exports.isLoop = exports.isLogicalOrOperator = exports.isImportKeyword = exports.isIdentifier = exports.isFunctionType = exports.isFunctionOrFunctionType = exports.isFunction = exports.isConstructor = exports.isClassOrTypeElement = exports.isAwaitKeyword = exports.isAwaitExpression = void 0;
exports.isSetter = isSetter;

@@ -5,0 +5,0 @@ const ts_estree_1 = require("../ts-estree");

export * from './applyDefault';
export * from './deepMerge';
export * from './getParserServices';
export * from './InferTypesFromRule';
export * from './nullThrows';
export * from './RuleCreator';
export * from './deepMerge';
export * from './nullThrows';
//# sourceMappingURL=index.d.ts.map

@@ -18,7 +18,7 @@ "use strict";

__exportStar(require("./applyDefault"), exports);
__exportStar(require("./deepMerge"), exports);
__exportStar(require("./getParserServices"), exports);
__exportStar(require("./InferTypesFromRule"), exports);
__exportStar(require("./nullThrows"), exports);
__exportStar(require("./RuleCreator"), exports);
__exportStar(require("./deepMerge"), exports);
__exportStar(require("./nullThrows"), exports);
//# sourceMappingURL=index.js.map

@@ -10,3 +10,3 @@ import type { RuleCreateFunction, RuleModule } from '../ts-eslint';

type InferMessageIdsTypeFromRule<T> = T extends RuleModule<infer MessageIds, infer _TOptions> ? MessageIds : T extends RuleCreateFunction<infer MessageIds, infer _TOptions> ? MessageIds : unknown;
export { InferOptionsTypeFromRule, InferMessageIdsTypeFromRule };
export { InferMessageIdsTypeFromRule, InferOptionsTypeFromRule };
//# sourceMappingURL=InferTypesFromRule.d.ts.map
import type { RuleContext, RuleListener, RuleMetaData, RuleMetaDataDocs, RuleModule } from '../ts-eslint/Rule';
export type { RuleListener, RuleModule };
export type NamedCreateRuleMetaDocs = Omit<RuleMetaDataDocs, 'url'>;
export type NamedCreateRuleMeta<MessageIds extends string, PluginDocs = unknown> = Omit<RuleMetaData<MessageIds, PluginDocs>, 'docs'> & {
docs: RuleMetaDataDocs & PluginDocs;
};
export type NamedCreateRuleMeta<MessageIds extends string, PluginDocs = unknown> = {
docs: PluginDocs & RuleMetaDataDocs;
} & Omit<RuleMetaData<MessageIds, PluginDocs>, 'docs'>;
export interface RuleCreateAndOptions<Options extends readonly unknown[], MessageIds extends string> {

@@ -24,3 +24,3 @@ create: (context: Readonly<RuleContext<MessageIds, Options>>, optionsWithDefault: Readonly<Options>) => RuleListener;

*/
export declare function RuleCreator<PluginDocs = unknown>(urlCreator: (ruleName: string) => string): <Options extends readonly unknown[], MessageIds extends string>({ name, meta, ...rule }: Readonly<RuleWithMetaAndName<Options, MessageIds, PluginDocs>>) => RuleModule<MessageIds, Options, PluginDocs>;
export declare function RuleCreator<PluginDocs = unknown>(urlCreator: (ruleName: string) => string): <Options extends readonly unknown[], MessageIds extends string>({ meta, name, ...rule }: Readonly<RuleWithMetaAndName<Options, MessageIds, PluginDocs>>) => RuleModule<MessageIds, Options, PluginDocs>;
export declare namespace RuleCreator {

@@ -27,0 +27,0 @@ var withoutDocs: <Options extends readonly unknown[], MessageIds extends string>(args: Readonly<RuleWithMeta<Options, MessageIds>>) => RuleModule<MessageIds, Options>;

@@ -14,3 +14,3 @@ "use strict";

// TODO - when the above PR lands; add type checking for the context.report `data` property
return function createNamedRule({ name, meta, ...rule }) {
return function createNamedRule({ meta, name, ...rule }) {
return createRule({

@@ -17,0 +17,0 @@ meta: {

@@ -15,3 +15,3 @@ /**

export type JSONSchema4Type = boolean | number | string | null;
export type JSONSchema4TypeExtended = JSONSchema4Type | JSONSchema4Array | JSONSchema4Object;
export type JSONSchema4TypeExtended = JSONSchema4Array | JSONSchema4Object | JSONSchema4Type;
export interface JSONSchema4Object {

@@ -42,8 +42,6 @@ [key: string]: JSONSchema4TypeExtended;

interface JSONSchema4Base {
id?: string | undefined;
$schema?: JSONSchema4Version | undefined;
/**
* A single type, or a union of simple types
* Reusable definitions that can be referenced via `$ref`
*/
type?: JSONSchema4TypeName | JSONSchema4TypeName[] | undefined;
$defs?: Record<string, JSONSchema4> | undefined;
/**

@@ -65,17 +63,16 @@ * Path to a schema defined in `definitions`/`$defs` that will form the base

$ref?: string | undefined;
$schema?: JSONSchema4Version | undefined;
/**
* This attribute is a string that provides a short description of the
* instance property.
*
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.21
* (AND) Must be valid against all of the sub-schemas
*/
title?: string | undefined;
allOf?: JSONSchema4[] | undefined;
/**
* This attribute is a string that provides a full description of the of
* purpose the instance property.
*
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.22
* (OR) Must be valid against any of the sub-schemas
*/
description?: string | undefined;
anyOf?: JSONSchema4[] | undefined;
/**
* The default value for the item if not present
*/
default?: JSONSchema4TypeExtended | undefined;
/**
* Reusable definitions that can be referenced via `$ref`

@@ -85,5 +82,8 @@ */

/**
* Reusable definitions that can be referenced via `$ref`
* This attribute is a string that provides a full description of the of
* purpose the instance property.
*
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.22
*/
$defs?: Record<string, JSONSchema4> | undefined;
description?: string | undefined;
/**

@@ -106,7 +106,12 @@ * The value of this property MUST be another schema which will provide

extends?: string[] | string | undefined;
id?: string | undefined;
/**
* The default value for the item if not present
* (NOT) Must not be valid against the given schema
*/
default?: JSONSchema4TypeExtended | undefined;
not?: JSONSchema4 | undefined;
/**
* (XOR) Must be valid against exactly one of the sub-schemas
*/
oneOf?: JSONSchema4[] | undefined;
/**
* This attribute indicates if the instance must have a value, and not

@@ -120,36 +125,30 @@ * be undefined. This is false by default, making the instance

/**
* (NOT) Must not be valid against the given schema
* This attribute is a string that provides a short description of the
* instance property.
*
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.21
*/
not?: JSONSchema4 | undefined;
title?: string | undefined;
/**
* (AND) Must be valid against all of the sub-schemas
* A single type, or a union of simple types
*/
allOf?: JSONSchema4[] | undefined;
/**
* (OR) Must be valid against any of the sub-schemas
*/
anyOf?: JSONSchema4[] | undefined;
/**
* (XOR) Must be valid against exactly one of the sub-schemas
*/
oneOf?: JSONSchema4[] | undefined;
type?: JSONSchema4TypeName | JSONSchema4TypeName[] | undefined;
}
export interface JSONSchema4RefSchema extends JSONSchema4Base {
$ref: string;
type?: undefined;
$ref: string;
}
export interface JSONSchema4AllOfSchema extends JSONSchema4Base {
allOf: JSONSchema4[];
type?: undefined;
allOf: JSONSchema4[];
}
export interface JSONSchema4AnyOfSchema extends JSONSchema4Base {
anyOf: JSONSchema4[];
type?: undefined;
anyOf: JSONSchema4[];
}
export interface JSONSchema4OneOfSchema extends JSONSchema4Base {
oneOf: JSONSchema4[];
type?: undefined;
oneOf: JSONSchema4[];
}
export interface JSONSchema4MultiSchema extends Omit<JSONSchema4ObjectSchema, 'enum' | 'type'>, Omit<JSONSchema4ArraySchema, 'enum' | 'type'>, Omit<JSONSchema4StringSchema, 'enum' | 'type'>, Omit<JSONSchema4NumberSchema, 'enum' | 'type'>, Omit<JSONSchema4BooleanSchema, 'enum' | 'type'>, Omit<JSONSchema4NullSchema, 'enum' | 'type'>, Omit<JSONSchema4AnySchema, 'enum' | 'type'> {
type: JSONSchema4TypeName[];
/**

@@ -165,2 +164,3 @@ * This provides an enumeration of all possible values that are valid

enum?: JSONSchema4Type[];
type: JSONSchema4TypeName[];
}

@@ -171,3 +171,2 @@ /**

export interface JSONSchema4ObjectSchema extends JSONSchema4Base {
type: 'object';
/**

@@ -185,16 +184,16 @@ * This attribute defines a schema for all properties that are not

/**
* This attribute is an object with property definitions that define the
* valid values of instance object property values. When the instance
* value is an object, the property values of the instance object MUST
* conform to the property definitions in this object. In this object,
* each property definition's value MUST be a schema, and the property's
* name MUST be the name of the instance property that it defines. The
* instance property value MUST be valid according to the schema from
* the property definition. Properties are considered unordered, the
* order of the instance properties MAY be in any order.
*
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.2
* The `dependencies` keyword conditionally applies a sub-schema when a given
* property is present. This schema is applied in the same way `allOf` applies
* schemas. Nothing is merged or extended. Both schemas apply independently.
*/
properties?: Record<string, JSONSchema4> | undefined;
dependencies?: Record<string, JSONSchema4 | string[]> | undefined;
/**
* The maximum number of properties allowed for record-style schemas
*/
maxProperties?: number | undefined;
/**
* The minimum number of properties required for record-style schemas
*/
minProperties?: number | undefined;
/**
* This attribute is an object that defines the schema for a set of

@@ -212,15 +211,16 @@ * property names of an object instance. The name of each property of

/**
* The `dependencies` keyword conditionally applies a sub-schema when a given
* property is present. This schema is applied in the same way `allOf` applies
* schemas. Nothing is merged or extended. Both schemas apply independently.
* This attribute is an object with property definitions that define the
* valid values of instance object property values. When the instance
* value is an object, the property values of the instance object MUST
* conform to the property definitions in this object. In this object,
* each property definition's value MUST be a schema, and the property's
* name MUST be the name of the instance property that it defines. The
* instance property value MUST be valid according to the schema from
* the property definition. Properties are considered unordered, the
* order of the instance properties MAY be in any order.
*
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.2
*/
dependencies?: Record<string, JSONSchema4 | string[]> | undefined;
/**
* The maximum number of properties allowed for record-style schemas
*/
maxProperties?: number | undefined;
/**
* The minimum number of properties required for record-style schemas
*/
minProperties?: number | undefined;
properties?: Record<string, JSONSchema4> | undefined;
type: 'object';
}

@@ -231,3 +231,2 @@ /**

export interface JSONSchema4ArraySchema extends JSONSchema4Base {
type: 'array';
/**

@@ -272,2 +271,3 @@ * May only be defined when "items" is defined, and is a tuple of JSONSchemas.

minItems?: number | undefined;
type: 'array';
/**

@@ -282,4 +282,16 @@ * Enforces that all items in the array are unique

export interface JSONSchema4StringSchema extends JSONSchema4Base {
type: 'string';
enum?: string[] | undefined;
/**
* The `format` keyword allows for basic semantic identification of certain
* kinds of string values that are commonly used.
*
* For example, because JSON doesn’t have a “DateTime” type, dates need to be
* encoded as strings. `format` allows the schema author to indicate that the
* string value should be interpreted as a date.
*
* ajv v6 provides a few built-in formats - all other strings will cause AJV
* to throw during schema compilation
*/
format?: 'date' | 'date-time' | 'email' | 'hostname' | 'ipv4' | 'ipv6' | 'json-pointer' | 'json-pointer-uri-fragment' | 'regex' | 'relative-json-pointer' | 'time' | 'uri' | 'uri-reference' | 'uri-template' | 'url' | 'uuid' | undefined;
/**
* The maximum allowed length for the string

@@ -306,15 +318,3 @@ */

pattern?: string | undefined;
/**
* The `format` keyword allows for basic semantic identification of certain
* kinds of string values that are commonly used.
*
* For example, because JSON doesn’t have a “DateTime” type, dates need to be
* encoded as strings. `format` allows the schema author to indicate that the
* string value should be interpreted as a date.
*
* ajv v6 provides a few built-in formats - all other strings will cause AJV
* to throw during schema compilation
*/
format?: 'date-time' | 'date' | 'email' | 'hostname' | 'ipv4' | 'ipv6' | 'json-pointer-uri-fragment' | 'json-pointer' | 'regex' | 'relative-json-pointer' | 'time' | 'uri-reference' | 'uri-template' | 'uri' | 'url' | 'uuid' | undefined;
enum?: string[] | undefined;
type: 'string';
}

@@ -325,17 +325,13 @@ /**

export interface JSONSchema4NumberSchema extends JSONSchema4Base {
type: 'integer' | 'number';
/**
* Numbers can be restricted to a multiple of a given number, using the
* `multipleOf` keyword. It may be set to any positive number.
* This provides an enumeration of all possible values that are valid
* for the instance property. This MUST be an array, and each item in
* the array represents a possible value for the instance value. If
* this attribute is defined, the instance value MUST be one of the
* values in the array in order for the schema to be valid.
*
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.19
*/
multipleOf?: number | undefined;
enum?: number[] | undefined;
/**
* The maximum allowed value for the number
*/
maximum?: number | undefined;
/**
* The minimum allowed value for the number
*/
minimum?: number | undefined;
/**
* The exclusive minimum allowed value for the number

@@ -357,11 +353,15 @@ * - `true` = `x < maximum`

/**
* This provides an enumeration of all possible values that are valid
* for the instance property. This MUST be an array, and each item in
* the array represents a possible value for the instance value. If
* this attribute is defined, the instance value MUST be one of the
* values in the array in order for the schema to be valid.
*
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.19
* The maximum allowed value for the number
*/
enum?: number[] | undefined;
maximum?: number | undefined;
/**
* The minimum allowed value for the number
*/
minimum?: number | undefined;
/**
* Numbers can be restricted to a multiple of a given number, using the
* `multipleOf` keyword. It may be set to any positive number.
*/
multipleOf?: number | undefined;
type: 'integer' | 'number';
}

@@ -372,3 +372,2 @@ /**

export interface JSONSchema4BooleanSchema extends JSONSchema4Base {
type: 'boolean';
/**

@@ -384,2 +383,3 @@ * This provides an enumeration of all possible values that are valid

enum?: boolean[] | undefined;
type: 'boolean';
}

@@ -390,3 +390,2 @@ /**

export interface JSONSchema4NullSchema extends JSONSchema4Base {
type: 'null';
/**

@@ -402,2 +401,3 @@ * This provides an enumeration of all possible values that are valid

enum?: null[] | undefined;
type: 'null';
}

@@ -404,0 +404,0 @@ export interface JSONSchema4AnySchema extends JSONSchema4Base {

@@ -13,4 +13,4 @@ import type { Parser as ParserType } from './Parser';

type RulesRecord = Partial<Record<string, RuleEntry>>;
type GlobalVariableOptionBase = 'off' | 'readonly' | 'writable' | /** @deprecated use `'writable'` */ 'writeable' | /** @deprecated use `'readonly'` */ 'readable';
type GlobalVariableOptionBoolean = /** @deprecated use `'writable'` */ true | /** @deprecated use `'readonly'` */ false;
type GlobalVariableOptionBase = 'off' | 'readable' | 'readonly' | /** @deprecated use `'writable'` */ 'writable' | /** @deprecated use `'readonly'` */ 'writeable';
type GlobalVariableOptionBoolean = /** @deprecated use `'writable'` */ false | /** @deprecated use `'readonly'` */ true;
type GlobalVariableOption = GlobalVariableOptionBase | GlobalVariableOptionBoolean;

@@ -128,3 +128,3 @@ interface GlobalsConfig {

type SeverityString = SharedConfig.SeverityString;
type SourceType = ParserOptionsTypes.SourceType | 'commonjs';
type SourceType = 'commonjs' | ParserOptionsTypes.SourceType;
interface SharedConfigs {

@@ -221,10 +221,6 @@ [key: string]: Config;

/**
* An string to identify the configuration object. Used in error messages and inspection tools.
*/
name?: string;
/**
* An array of glob patterns indicating the files that the configuration object should apply to.
* If not specified, the configuration object applies to all files matched by any other configuration object.
*/
files?: (string | string[])[];
files?: (string[] | string)[];
/**

@@ -244,2 +240,6 @@ * An array of glob patterns indicating the files that the configuration object should not apply to.

/**
* An string to identify the configuration object. Used in error messages and inspection tools.
*/
name?: string;
/**
* An object containing a name-value mapping of plugin names to plugin objects.

@@ -254,3 +254,3 @@ * When `files` is specified, these plugins are only available to the matching files.

*/
processor?: string | Processor;
processor?: Processor | string;
/**

@@ -257,0 +257,0 @@ * An object containing the configured rules.

@@ -0,1 +1,3 @@

export { FlatESLint } from './eslint/FlatESLint';
export { FlatESLint as ESLint } from './eslint/FlatESLint';
export {

@@ -6,4 +8,2 @@ /**

LegacyESLint, } from './eslint/LegacyESLint';
export { FlatESLint } from './eslint/FlatESLint';
export { FlatESLint as ESLint } from './eslint/FlatESLint';
//# sourceMappingURL=ESLint.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ESLint = exports.FlatESLint = exports.LegacyESLint = void 0;
exports.LegacyESLint = exports.ESLint = exports.FlatESLint = void 0;
var FlatESLint_1 = require("./eslint/FlatESLint");
Object.defineProperty(exports, "FlatESLint", { enumerable: true, get: function () { return FlatESLint_1.FlatESLint; } });
var FlatESLint_2 = require("./eslint/FlatESLint");
Object.defineProperty(exports, "ESLint", { enumerable: true, get: function () { return FlatESLint_2.FlatESLint; } });
var LegacyESLint_1 = require("./eslint/LegacyESLint");

@@ -10,6 +14,2 @@ // TODO(eslint@v10) - remove this in the next major

Object.defineProperty(exports, "LegacyESLint", { enumerable: true, get: function () { return LegacyESLint_1.LegacyESLint; } });
var FlatESLint_1 = require("./eslint/FlatESLint");
Object.defineProperty(exports, "FlatESLint", { enumerable: true, get: function () { return FlatESLint_1.FlatESLint; } });
var FlatESLint_2 = require("./eslint/FlatESLint");
Object.defineProperty(exports, "ESLint", { enumerable: true, get: function () { return FlatESLint_2.FlatESLint; } });
//# sourceMappingURL=ESLint.js.map

@@ -119,3 +119,3 @@ import type { Linter } from '../Linter';

*/
cacheStrategy?: 'metadata' | 'content';
cacheStrategy?: 'content' | 'metadata';
/**

@@ -137,3 +137,3 @@ * The working directory. This must be an absolute path.

*/
fix?: boolean | ((message: LintMessage) => boolean);
fix?: ((message: LintMessage) => boolean) | boolean;
/**

@@ -169,9 +169,9 @@ * The types of the rules that the `eslint.lintFiles()` and `eslint.lintText()` methods use for autofix.

/**
* The rule IDs that replace this deprecated rule.
*/
replacedBy: string[];
/**
* The rule ID.
*/
ruleId: string;
/**
* The rule IDs that replace this deprecated rule.
*/
replacedBy: string[];
}

@@ -217,2 +217,9 @@ /**

/**
* Timing information of the lint run.
* This exists if and only if the `--stats` CLI flag was added or the `stats: true`
* option was passed to the ESLint class
* @since 9.0.0
*/
stats?: LintStats;
/**
* The array of SuppressedLintMessage objects.

@@ -229,9 +236,2 @@ */

warningCount: number;
/**
* Timing information of the lint run.
* This exists if and only if the `--stats` CLI flag was added or the `stats: true`
* option was passed to the ESLint class
* @since 9.0.0
*/
stats?: LintStats;
}

@@ -252,2 +252,6 @@ export interface LintStats {

/**
* The total time that is spent on applying fixes to the code.
*/
fix: LintStatsFixTime;
/**
* The total time that is spent when parsing a file.

@@ -261,6 +265,2 @@ */

/**
* The total time that is spent on applying fixes to the code.
*/
fix: LintStatsFixTime;
/**
* The cumulative total

@@ -352,9 +352,9 @@ */

/**
* The free text description added after the `--` in the comment
*/
justification: string;
/**
* Right now, this is always `directive`
*/
kind: string;
/**
* The free text description added after the `--` in the comment
*/
justification: string;
}[];

@@ -361,0 +361,0 @@ }

@@ -47,3 +47,3 @@ import type { FlatConfig } from '../Config';

*/
overrideConfigFile?: string | boolean;
overrideConfigFile?: boolean | string;
/**

@@ -50,0 +50,0 @@ * A predicate function that filters rules to be run.

@@ -9,2 +9,6 @@ import type { ClassicConfig, FlatConfig, SharedConfig } from './Config';

/**
* The version from package.json.
*/
readonly version: string;
/**
* Initialize the Linter.

@@ -52,2 +56,6 @@ * @param config the config object

/**
* The version from package.json.
*/
static readonly version: string;
/**
* Performs multiple autofix passes over the text until as many fixes as possible have been applied.

@@ -60,10 +68,2 @@ * @param code The source text to apply fixes to.

verifyAndFix(code: string, config: Linter.ConfigType, options: Linter.FixOptions): Linter.FixReport;
/**
* The version from package.json.
*/
readonly version: string;
/**
* The version from package.json.
*/
static readonly version: string;
}

@@ -198,9 +198,9 @@ declare namespace Linter {

/**
* Collection of all messages for the given code
*/
messages: LintMessage[];
/**
* Fixed code text (might be the same as input if no fixes were applied).
*/
output: string;
/**
* Collection of all messages for the given code
*/
messages: LintMessage[];
}

@@ -207,0 +207,0 @@ /** @deprecated use Parser.ParserModule */

@@ -30,5 +30,7 @@ import type { ParserServices, TSESTree } from '../ts-estree';

/**
* Parses the given text into an ESTree AST
* Parses the given text into an AST
*/
parse(text: string, options?: unknown): unknown;
parseForESLint(text: string, options?: unknown): {
[k in keyof ParseResult]: unknown;
};
} | {

@@ -42,7 +44,5 @@ /**

/**
* Parses the given text into an AST
* Parses the given text into an ESTree AST
*/
parseForESLint(text: string, options?: unknown): {
[k in keyof ParseResult]: unknown;
};
parse(text: string, options?: unknown): unknown;
};

@@ -55,5 +55,5 @@ type ParserModule = {

/**
* Parses the given text into an ESTree AST
* Parses the given text into an AST
*/
parse(text: string, options?: ParserOptions): TSESTree.Program;
parseForESLint(text: string, options?: ParserOptions): ParseResult;
} | {

@@ -65,5 +65,5 @@ /**

/**
* Parses the given text into an AST
* Parses the given text into an ESTree AST
*/
parseForESLint(text: string, options?: ParserOptions): ParseResult;
parse(text: string, options?: ParserOptions): TSESTree.Program;
};

@@ -76,2 +76,8 @@ interface ParseResult {

/**
* A `ScopeManager` object.
* Custom parsers can use customized scope analysis for experimental/enhancement syntaxes.
* The default is the `ScopeManager` object which is created by `eslint-scope`.
*/
scopeManager?: Scope.ScopeManager;
/**
* Any parser-dependent services (such as type checkers for nodes).

@@ -83,8 +89,2 @@ * The value of the services property is available to rules as `context.sourceCode.parserServices`.

/**
* A `ScopeManager` object.
* Custom parsers can use customized scope analysis for experimental/enhancement syntaxes.
* The default is the `ScopeManager` object which is created by `eslint-scope`.
*/
scopeManager?: Scope.ScopeManager;
/**
* An object to customize AST traversal.

@@ -91,0 +91,0 @@ * The keys of the object are the type of AST nodes.

@@ -13,6 +13,6 @@ import type { Linter } from './Linter';

}
type PreProcess = (text: string, filename: string) => (string | {
type PreProcess = (text: string, filename: string) => ({
filename: string;
text: string;
filename: string;
})[];
} | string)[];
type PostProcess = (messagesList: Linter.LintMessage[][], filename: string) => Linter.LintMessage[];

@@ -25,2 +25,6 @@ interface ProcessorModule {

/**
* The function to merge messages.
*/
postprocess?: PostProcess;
/**
* The function to extract code blocks.

@@ -30,6 +34,2 @@ */

/**
* The function to merge messages.
*/
postprocess?: PostProcess;
/**
* If `true` then it means the processor supports autofix.

@@ -54,2 +54,6 @@ */

/**
* The function to merge messages.
*/
postprocess?: (messagesList: any, filename: string) => any;
/**
* The function to extract code blocks.

@@ -59,6 +63,2 @@ */

/**
* The function to merge messages.
*/
postprocess?: (messagesList: any, filename: string) => any;
/**
* If `true` then it means the processor supports autofix.

@@ -65,0 +65,0 @@ */

@@ -47,9 +47,2 @@ import type { JSONSchema4 } from '../json-schema';

/**
* The type of rule.
* - `"problem"` means the rule is identifying code that either will cause an error or may cause a confusing behavior. Developers should consider this a high priority to resolve.
* - `"suggestion"` means the rule is identifying something that could be done in a better way but no errors will occur if the code isn’t changed.
* - `"layout"` means the rule cares primarily about whitespace, semicolons, commas, and parentheses, all the parts of the program that determine how the code looks rather than how it executes. These rules work on parts of the code that aren’t specified in the AST.
*/
type: 'problem' | 'suggestion' | 'layout';
/**
* The name of the rule this rule was replaced by, if it was deprecated.

@@ -62,2 +55,9 @@ */

schema: JSONSchema4 | readonly JSONSchema4[];
/**
* The type of rule.
* - `"problem"` means the rule is identifying code that either will cause an error or may cause a confusing behavior. Developers should consider this a high priority to resolve.
* - `"suggestion"` means the rule is identifying something that could be done in a better way but no errors will occur if the code isn’t changed.
* - `"layout"` means the rule cares primarily about whitespace, semicolons, commas, and parentheses, all the parts of the program that determine how the code looks rather than how it executes. These rules work on parts of the code that aren’t specified in the AST.
*/
type: 'layout' | 'problem' | 'suggestion';
}

@@ -87,3 +87,3 @@ export interface RuleMetaDataWithDocs<MessageIds extends string, PluginDocs = unknown> extends RuleMetaData<MessageIds, PluginDocs> {

}
export type ReportFixFunction = (fixer: RuleFixer) => IterableIterator<RuleFix> | RuleFix | readonly RuleFix[] | null;
export type ReportFixFunction = (fixer: RuleFixer) => IterableIterator<RuleFix> | readonly RuleFix[] | RuleFix | null;
export type ReportSuggestionArray<MessageIds extends string> = SuggestionReportDescriptor<MessageIds>[];

@@ -113,9 +113,9 @@ export type ReportDescriptorMessageData = Readonly<Record<string, unknown>>;

/**
* An override of the location of the report
*/
readonly loc?: Readonly<TSESTree.Position> | Readonly<TSESTree.SourceLocation>;
/**
* The Node or AST Token which the report is being attached to
*/
readonly node: TSESTree.Node | TSESTree.Token;
/**
* An override of the location of the report
*/
readonly loc?: Readonly<TSESTree.Position> | Readonly<TSESTree.SourceLocation>;
}

@@ -128,3 +128,3 @@ interface ReportDescriptorLocOnly {

}
export type ReportDescriptor<MessageIds extends string> = ReportDescriptorWithSuggestion<MessageIds> & (ReportDescriptorLocOnly | ReportDescriptorNodeOptionalLoc);
export type ReportDescriptor<MessageIds extends string> = (ReportDescriptorLocOnly | ReportDescriptorNodeOptionalLoc) & ReportDescriptorWithSuggestion<MessageIds>;
/**

@@ -143,2 +143,6 @@ * Plugins can add their settings using declaration

/**
* The language options configured for this run
*/
languageOptions: FlatConfig.LanguageOptions;
/**
* An array of the configured options for this rule.

@@ -149,2 +153,6 @@ * This array does not include the rule severity.

/**
* The parser options configured for this run
*/
parserOptions: Linter.ParserOptions;
/**
* The name of the parser from configuration, if in eslintrc (legacy) config.

@@ -154,10 +162,2 @@ */

/**
* The language options configured for this run
*/
languageOptions: FlatConfig.LanguageOptions;
/**
* The parser options configured for this run
*/
parserOptions: Linter.ParserOptions;
/**
* An object containing parser-provided services for rules

@@ -259,3 +259,13 @@ *

export interface CodePath {
/** Code paths of functions this code path contains. */
childCodePaths: CodePath[];
/**
* Segments of the current traversal position.
*
* @deprecated
*/
currentSegments: CodePathSegment[];
/** The final segments which includes both returned and thrown. */
finalSegments: CodePathSegment[];
/**
* A unique string. Respective rules can use `id` to save additional

@@ -266,4 +276,2 @@ * information for each code path.

initialSegment: CodePathSegment;
/** The final segments which includes both returned and thrown. */
finalSegments: CodePathSegment[];
/** The final segments which includes only returned. */

@@ -273,12 +281,4 @@ returnedSegments: CodePathSegment[];

thrownSegments: CodePathSegment[];
/**
* Segments of the current traversal position.
*
* @deprecated
*/
currentSegments: CodePathSegment[];
/** The code path of the upper function/global scope. */
upper: CodePath | null;
/** Code paths of functions this code path contains. */
childCodePaths: CodePath[];
}

@@ -498,2 +498,7 @@ /**

/**
* Function which returns an object with methods that ESLint calls to “visit”
* nodes while traversing the abstract syntax tree.
*/
create(context: Readonly<RuleContext<MessageIds, Options>>): ExtendedRuleListener;
/**
* Default options the rule will be run with

@@ -506,7 +511,2 @@ */

meta: RuleMetaData<MessageIds, Docs>;
/**
* Function which returns an object with methods that ESLint calls to “visit”
* nodes while traversing the abstract syntax tree.
*/
create(context: Readonly<RuleContext<MessageIds, Options>>): ExtendedRuleListener;
}

@@ -533,6 +533,6 @@ export type AnyRuleModule = RuleModule<string, readonly unknown[]>;

*/
export type LooseRuleDefinition = LooseRuleCreateFunction | {
export type LooseRuleDefinition = {
create: LooseRuleCreateFunction;
meta?: object | undefined;
create: LooseRuleCreateFunction;
};
} | LooseRuleCreateFunction;
export type LooseRuleCreateFunction = (context: any) => Record<string, Function | undefined>;

@@ -539,0 +539,0 @@ export type RuleCreateFunction<MessageIds extends string = never, Options extends readonly unknown[] = unknown[]> = (context: Readonly<RuleContext<MessageIds, Options>>) => RuleListener;

@@ -11,6 +11,2 @@ import type { AST_NODE_TYPES, AST_TOKEN_TYPES } from '../ts-estree';

/**
* Name for the test case.
*/
readonly name?: string;
/**
* Code for the test case.

@@ -32,2 +28,10 @@ */

/**
* Name for the test case.
*/
readonly name?: string;
/**
* Run this case exclusively for debugging in supported test frameworks.
*/
readonly only?: boolean;
/**
* Options for the test case.

@@ -48,6 +52,2 @@ */

readonly settings?: Readonly<SharedConfigurationSettings>;
/**
* Run this case exclusively for debugging in supported test frameworks.
*/
readonly only?: boolean;
}

@@ -59,2 +59,6 @@ /**

/**
* The data used to fill the message template.
*/
readonly data?: ReportDescriptorMessageData;
/**
* Reported message ID.

@@ -64,6 +68,2 @@ */

/**
* The data used to fill the message template.
*/
readonly data?: ReportDescriptorMessageData;
/**
* NOTE: Suggestions will be applied as a stand-alone change, without triggering multi-pass fixes.

@@ -85,3 +85,3 @@ * Each individual error has its own suggestion, so you have to show the correct, _isolated_ output for each suggestion.

*/
readonly output?: string | string[] | null;
readonly output?: string[] | string | null;
}

@@ -134,4 +134,4 @@ /**

interface RunTests<MessageIds extends string, Options extends readonly unknown[]> {
readonly invalid: readonly InvalidTestCase<MessageIds, Options>[];
readonly valid: readonly (ValidTestCase<Options> | string)[];
readonly invalid: readonly InvalidTestCase<MessageIds, Options>[];
}

@@ -190,3 +190,3 @@ /**

}
export { InvalidTestCase, SuggestionOutput, RuleTester, RuleTesterConfig, RuleTesterTestFrameworkFunction, RunTests, TestCaseError, ValidTestCase, };
export { InvalidTestCase, RuleTester, RuleTesterConfig, RuleTesterTestFrameworkFunction, RunTests, SuggestionOutput, TestCaseError, ValidTestCase, };
//# sourceMappingURL=RuleTester.d.ts.map

@@ -322,3 +322,3 @@ import type { ParserServices, TSESTree } from '../ts-estree';

} ? GetFilterPredicateFromOptions<T, TSESTree.Token> : GetFilterPredicateFromOptions<T, Exclude<TSESTree.Token, TSESTree.Comment>>;
type CursorWithSkipOptions = FilterPredicate | number | {
type CursorWithSkipOptions = {
/**

@@ -336,5 +336,9 @@ * The predicate function to choose tokens.

skip?: number;
};
type CursorWithCountOptions = FilterPredicate | number | {
} | FilterPredicate | number;
type CursorWithCountOptions = {
/**
* The maximum count of tokens the cursor iterates.
*/
count?: number;
/**
* The predicate function to choose tokens.

@@ -347,7 +351,3 @@ */

includeComments?: boolean;
/**
* The maximum count of tokens the cursor iterates.
*/
count?: number;
};
} | FilterPredicate | number;
}

@@ -354,0 +354,0 @@ declare const SourceCode_base: typeof SourceCodeBase;

export { AST_NODE_TYPES, AST_TOKEN_TYPES, TSESTree, } from '@typescript-eslint/types';
export type { ParserServices, ParserServicesWithTypeInformation, ParserServicesWithoutTypeInformation, } from '@typescript-eslint/typescript-estree';
export type { ParserServices, ParserServicesWithoutTypeInformation, ParserServicesWithTypeInformation, } from '@typescript-eslint/typescript-estree';
//# sourceMappingURL=ts-estree.d.ts.map
{
"name": "@typescript-eslint/utils",
"version": "8.2.1-alpha.7",
"version": "8.2.1-alpha.8",
"description": "Utilities for working with TypeScript + ESLint together",

@@ -67,5 +67,5 @@ "files": [

"@eslint-community/eslint-utils": "^4.4.0",
"@typescript-eslint/scope-manager": "8.2.1-alpha.7",
"@typescript-eslint/types": "8.2.1-alpha.7",
"@typescript-eslint/typescript-estree": "8.2.1-alpha.7"
"@typescript-eslint/scope-manager": "8.2.1-alpha.8",
"@typescript-eslint/types": "8.2.1-alpha.8",
"@typescript-eslint/typescript-estree": "8.2.1-alpha.8"
},

@@ -72,0 +72,0 @@ "peerDependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc