Skip to main contentreport-toolkit

common/src/config.d

Index

Type aliases

Variables

Functions

Type aliases

BuiltinConfigAliases

Ƭ BuiltinConfigAliases: “rtk:recommended”

A list of built-in config aliases. (This is intended to be a union type if/when other built-in configs are added.)


BuiltinConfigModule

Ƭ BuiltinConfigModule: object

The exports of a builtin config file.

Type declaration:

  • config: object | object | “rtk:recommended” | object[]

CommandDefaultsConfig

Ƭ CommandDefaultsConfig: object

Command-specific defaults. Command-line arguments will always override these.

Type declaration:

  • diff: any

  • inspect: any

  • redact: any

  • transform: any


CommandName

Ƭ CommandName: “redact” | “inspect” | “transform” | “diff”

Valid command names for commands (used with CommandDefaultsConfig).


Config

Ƭ Config: object | ConfigProps

A configuration object. Each configuration file exports an ExportedConfig array containing one or more of these.


ConfigListItem

Ƭ ConfigListItem: Partial‹object› | Partial‹ConfigProps› | ConfigModule | “rtk:recommended”

An item in the config prop of a config file or ConfigModule.


ConfigModule

Ƭ ConfigModule: object

The exports of a config file. There should be only one; config, which may be a Config or ExportedConfig.

Type declaration:

  • config: object | ConfigModule | “rtk:recommended” | object[]

ConfigProps

Ƭ ConfigProps: object

Properties of a Config object.

Type declaration:

  • commands: Partial‹object›

  • plugins: string[]

  • rules: Partial‹object›

  • transformers: Partial‹object›


ExportedConfig

Ƭ ExportedConfig: object | object | “rtk:recommended” | object[]

Alias for the config prop of a config file or ConfigModule. See ConfigListItem.


FlattenedConfigMarker

Ƭ FlattenedConfigMarker: object

The symbol attached to a flattened Config.

Type declaration:

  • __computed? : true

Observable

Ƭ Observable: Observable‹T›


RuleConfig

Ƭ RuleConfig: object

Rule-specific configuration. severity and enable will always be usable, otherwise the rest of the properties are defined by the rule.

Type declaration:

  • [ key: string]: any

RulesConfig

Ƭ RulesConfig: object

Per-rule configuration.

Type declaration:

  • [ key: string]: boolean | object

Severity

Ƭ Severity: “error” | “warning” | “info”

Valid severity levels.


TransformerDefaultsConfig

Ƭ TransformerDefaultsConfig: object

Per-transformer defaults, keyed on transformer name.

Type declaration:

  • csv: any

  • filter: any

  • json: any

  • newline: any

  • redact: any

  • stack-hash: any

  • table: any


TransformerName

Ƭ TransformerName: “table” | “filter” | “json” | “csv” | “newline” | “redact” | “stack-hash”

A valid transformer name.

Variables

Const BUILTIN_CONFIGS

BUILTIN_CONFIGS: Map‹BuiltinConfigAliases, ExportedConfig

type {Map<BuiltinConfigAliases,ExportedConfig>}

todo move this


RECOMMENDED_CONFIG_ALIAS: “rtk:recommended”

Functions

filterEnabledRules

filterEnabledRules(config: object | ConfigProps): string[]

Given a Config, return a list of rules that are enabled.

Parameters:

NameTypeDescription
configobject | ConfigPropsParsed config

Returns: string[]

List of rule IDs


normalizeFlattenedConfig

normalizeFlattenedConfig(config: Partial‹object› | Partial‹ConfigProps›): object | ConfigProps

Assign the “flattened config” symbol to complete the config. Add default fields.

Parameters:

NameTypeDescription
configPartial‹object› | Partial‹ConfigPropsConfig to mark flattened

Returns: object | ConfigProps

The “final” config


parseConfig

parseConfig(): OperatorFunction‹Partial‹object› | Partial‹ConfigProps› | ConfigModule | “rtk:recommended” | object | object | “rtk:recommended” | object[], object | ConfigProps

Given an Observable of ExportedConfig arrays, return a single, flattened Config object. Config object will have a kFlattenedConfig Symbol property set to true.

todo Eliminate extra empty properties

Returns: OperatorFunction‹Partial‹object› | Partial‹ConfigProps› | ConfigModule | “rtk:recommended” | object | object | “rtk:recommended” | object[], object | ConfigProps