Skip to content

⬅️ Back to Table of Contents

📄 types.ts

📊 Analysis Summary

Metric Count
📦 Imports 16
📐 Interfaces 4
📑 Type Aliases 3

📚 Table of Contents

🛠️ File Location:

📂 packages/eslint-plugin/src/rules/naming-convention-utils/types.ts

📦 Imports

Name Source
TSESLint @typescript-eslint/utils
TSESTree @typescript-eslint/utils
MessageIds ../naming-convention
Options ../naming-convention
IndividualAndMetaSelectorsString ./enums
MetaSelectors ./enums
Modifiers ./enums
ModifiersString ./enums
PredefinedFormats ./enums
PredefinedFormatsString ./enums
Selectors ./enums
SelectorsString ./enums
TypeModifiers ./enums
TypeModifiersString ./enums
UnderscoreOptions ./enums
UnderscoreOptionsString ./enums

Interfaces

MatchRegex

Interface Code
export interface MatchRegex {
  match: boolean;
  regex: string;
}

Properties

Name Type Optional Description
match boolean
regex string

Selector

Interface Code
export interface Selector {
  custom?: MatchRegex;
  filter?: string | MatchRegex;
  // format options
  format: PredefinedFormatsString[] | null;
  leadingUnderscore?: UnderscoreOptionsString;
  modifiers?: ModifiersString[];
  prefix?: string[];
  // selector options
  selector:
    | IndividualAndMetaSelectorsString
    | IndividualAndMetaSelectorsString[];
  suffix?: string[];
  trailingUnderscore?: UnderscoreOptionsString;
  types?: TypeModifiersString[];
}

Properties

Name Type Optional Description
custom MatchRegex
filter string | MatchRegex
format PredefinedFormatsString[] | null
leadingUnderscore UnderscoreOptionsString
modifiers ModifiersString[]
prefix string[]
selector ` IndividualAndMetaSelectorsString
IndividualAndMetaSelectorsString[]`
suffix string[]
trailingUnderscore UnderscoreOptionsString
types TypeModifiersString[]

NormalizedMatchRegex

Interface Code
export interface NormalizedMatchRegex {
  match: boolean;
  regex: RegExp;
}

Properties

Name Type Optional Description
match boolean
regex RegExp

NormalizedSelector

Interface Code
export interface NormalizedSelector {
  custom: NormalizedMatchRegex | null;
  filter: NormalizedMatchRegex | null;
  // format options
  format: PredefinedFormats[] | null;
  leadingUnderscore: UnderscoreOptions | null;
  modifiers: Modifiers[] | null;
  // calculated ordering weight based on modifiers
  modifierWeight: number;
  prefix: string[] | null;
  // selector options
  selector: MetaSelectors | Selectors;
  suffix: string[] | null;
  trailingUnderscore: UnderscoreOptions | null;
  types: TypeModifiers[] | null;
}

Properties

Name Type Optional Description
custom NormalizedMatchRegex | null
filter NormalizedMatchRegex | null
format PredefinedFormats[] | null
leadingUnderscore UnderscoreOptions | null
modifiers Modifiers[] | null
modifierWeight number
prefix string[] | null
selector MetaSelectors | Selectors
suffix string[] | null
trailingUnderscore UnderscoreOptions | null
types TypeModifiers[] | null

Type Aliases

ValidatorFunction

type ValidatorFunction = (
  node: TSESTree.Identifier | TSESTree.Literal | TSESTree.PrivateIdentifier,
  modifiers?: Set<Modifiers>,
) => void;

ParsedOptions

type ParsedOptions = Record<SelectorsString, ValidatorFunction>;

Context

type Context = Readonly<TSESLint.RuleContext<MessageIds, Options>>;