Skip to content

Commit

Permalink
feat: Add more type definitions (#81)
Browse files Browse the repository at this point in the history
Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
  • Loading branch information
nzakas and mdjermanovic committed Jul 8, 2024
1 parent b3a22fa commit df3263b
Showing 1 changed file with 47 additions and 3 deletions.
50 changes: 47 additions & 3 deletions packages/core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,56 @@ export interface Position {
// Config
//------------------------------------------------------------------------------

export type RuleSeverity = 0 | 1 | 2 | "off" | "warn" | "error";
/**
* The human readable severity level used in a configuration.
*/
export type SeverityName = "off" | "warn" | "error";

/**
* The numeric severity level for a rule.
*
* - `0` means off.
* - `1` means warn.
* - `2` means error.
*
*/
export type SeverityLevel = 0 | 1 | 2;

/**
* The severity of a rule in a configuration.
*/
export type Severity = SeverityName | SeverityLevel;

/**
* Represents the configuration options for the core linter.
*/
export interface LinterOptionsConfig {
/**
* Indicates whether or not inline configuration is evaluated.
*/
noInlineConfig?: boolean;

/**
* Indicates what to do when an unused disable directive is found.
*/
reportUnusedDisableDirectives?: boolean | Severity;
}

/**
* Shared settings that are accessible from within plugins.
*/
export type SettingsConfig = Record<string, unknown>;

export type RuleConfig = RuleSeverity | [RuleSeverity, ...any[]];
/**
* The configuration for a rule.
*/
export type RuleConfig = Severity | [Severity, ...any[]];

/**
* A collection of rules and their configurations.
*/
export interface RulesConfig {
[key: string]: RuleConfig;
[ruleId: string]: RuleConfig;
}

//------------------------------------------------------------------------------
Expand Down

0 comments on commit df3263b

Please sign in to comment.