Skip to content

⬅️ Back to Table of Contents

📄 FlatESLint

📊 Analysis Summary

Metric Count
🔧 Functions 2
🧱 Classes 2
📦 Imports 3
📐 Interfaces 1
📑 Type Aliases 13

📚 Table of Contents

🛠️ File Location:

📂 packages/utils/src/ts-eslint/eslint/FlatESLint.ts

📦 Imports

Name Source
ESLint eslint
useAtYourOwnRisk eslint/use-at-your-own-risk
FlatConfig ../Config

Functions

FlatESLintBase.calculateConfigForFile(filePath: string): Promise<FlatConfig.Config>

Returns a configuration object for the given file based on the CLI options. This is the same logic used by the ESLint CLI executable to determine configuration for each file it processes.

Parameters:

  • filePath any: The path of the file to retrieve a config object for.

Returns: undefined A configuration object for the file or undefined if there is no configuration data for the object.

Raw JSDoc
/**
   * Returns a configuration object for the given file based on the CLI options.
   * This is the same logic used by the ESLint CLI executable to determine
   * configuration for each file it processes.
   * @param filePath The path of the file to retrieve a config object for.
   * @returns A configuration object for the file or `undefined` if there is no configuration data for the object.
   */
Code
calculateConfigForFile(filePath: string): Promise<FlatConfig.Config>;

FlatESLintBase.findConfigFile(): Promise<string | undefined>

Finds the config file being used by this instance based on the options passed to the constructor.

Returns: undefined The path to the config file being used or undefined if no config file is being used.

Raw JSDoc
/**
   * Finds the config file being used by this instance based on the options
   * passed to the constructor.
   * @returns The path to the config file being used or `undefined` if no config file is being used.
   */
Code
findConfigFile(): Promise<string | undefined>;

Classes

FlatESLintBase

Extends: `Shared.ESLintBase< FlatConfig.Config | FlatConfig.ConfigArray, FlatESLint.ESLintOptions

`

Class Code
declare class FlatESLintBase extends Shared.ESLintBase<
  FlatConfig.Config | FlatConfig.ConfigArray,
  FlatESLint.ESLintOptions
> {
  static readonly configType: 'flat';

  /**
   * Returns a configuration object for the given file based on the CLI options.
   * This is the same logic used by the ESLint CLI executable to determine
   * configuration for each file it processes.
   * @param filePath The path of the file to retrieve a config object for.
   * @returns A configuration object for the file or `undefined` if there is no configuration data for the object.
   */
  calculateConfigForFile(filePath: string): Promise<FlatConfig.Config>;

  /**
   * Finds the config file being used by this instance based on the options
   * passed to the constructor.
   * @returns The path to the config file being used or `undefined` if no config file is being used.
   */
  findConfigFile(): Promise<string | undefined>;
}

Methods (2) — full entries under Functions

Method Signature
calculateConfigForFile (filePath: string): Promise<FlatConfig.Config>
findConfigFile (): Promise<string \| undefined>

FlatESLint

The ESLint class is the primary class to use in Node.js applications. This class depends on the Node.js fs module and the file system, so you cannot use it in browsers.

If you want to lint code on browsers, use the Linter class instead.

Extends: ((useAtYourOwnRisk.FlatESLint ?? ESLint) as typeof FlatESLintBase)

Class Code
export class FlatESLint extends ((useAtYourOwnRisk.FlatESLint ??
  ESLint) as typeof FlatESLintBase) {}

Interfaces

ESLintOptions

Interface Code
export interface ESLintOptions extends Shared.ESLintOptions<FlatConfig.ConfigArray> {
    /**
     * If false is present, the eslint.lintFiles() method doesn't respect `ignorePatterns` ignorePatterns in your configuration.
     * @default true
     */
    ignore?: boolean;
    /**
     * Ignore file patterns to use in addition to config ignores. These patterns are relative to cwd.
     * @default null
     */
    ignorePatterns?: string[] | null;
    /**
     * The path to a configuration file. Overrides all configurations used with this instance.
     * The options.overrideConfig option is applied after this option is applied.
     *
     * - When falsy, searches for default config file.
     * - When `true`, does not do any config file lookup.
     * - When a string, considered to be a config file name.
     *
     * @default false
     */
    overrideConfigFile?: boolean | string;
    /**
     * A predicate function that filters rules to be run.
     * This function is called with an object containing `ruleId` and `severity`, and returns `true` if the rule should be run.
     * @default () => true
     */
    ruleFilter?: RuleFilter;
    /**
     * When set to true, additional statistics are added to the lint results.
     * @see {@link https://eslint.org/docs/latest/extend/stats}
     * @default false
     */
    stats?: boolean;
    /**
     * Show warnings when the file list includes ignored files.
     * @default true
     */
    warnIgnored?: boolean;
  }

Properties

Name Type Optional Description
ignore boolean not shown
ignorePatterns string[] \| null not shown
overrideConfigFile boolean \| string not shown
ruleFilter RuleFilter not shown
stats boolean not shown
warnIgnored boolean not shown

Type Aliases

DeprecatedRuleInfo

type DeprecatedRuleInfo = Shared.DeprecatedRuleInfo;

EditInfo

type EditInfo = Shared.EditInfo;

Formatter

type Formatter = Shared.Formatter;

LintMessage

type LintMessage = Shared.LintMessage;

LintResult

type LintResult = Shared.LintResult;

LintStats

type LintStats = Shared.LintStats;

LintStatsFixTime

type LintStatsFixTime = Shared.LintStatsFixTime;

LintStatsParseTime

type LintStatsParseTime = Shared.LintStatsParseTime;

LintStatsRuleTime

type LintStatsRuleTime = Shared.LintStatsRuleTime;

LintStatsTimePass

type LintStatsTimePass = Shared.LintStatsTimePass;

LintTextOptions

type LintTextOptions = Shared.LintTextOptions;

SuppressedLintMessage

type SuppressedLintMessage = Shared.SuppressedLintMessage;

RuleFilter

type RuleFilter = (rule: {
    ruleId: string;
    severity: number;
  }) => boolean;

Generated by Syntax Scribe