xo
Version:
JavaScript/TypeScript linter (ESLint wrapper) with great defaults
38 lines (31 loc) • 1.6 kB
TypeScript
import { type Linter } from 'eslint';
import { type SetRequired } from 'type-fest';
import { type XoConfigItem } from './types.js';
/**
Convert a `xo` config item to an ESLint config item.
In a flat structure these config items represent the config object items.
Files and rules will always be defined and all other ESLint config properties are preserved.
@param xoConfig
@returns eslintConfig
*/
export declare const xoToEslintConfigItem: (xoConfig: XoConfigItem) => SetRequired<Linter.Config, "rules" | "files">;
/**
Function used to match files which should be included in the `tsconfig.json` files.
@param cwd - The current working directory to resolve relative filepaths.
@param files - The _absolute_ file paths to match against the globs.
@param globs - The globs to match the files against.
@param ignores - The globs to ignore when matching the files.
@returns An array of file paths that match the globs and do not match the ignores.
*/
export declare const matchFilesForTsConfig: (cwd: string, files: string[], globs: string[], ignores: string[]) => string[];
/**
Once a config is resolved, it is pre-processed to ensure that all properties are set correctly.
This includes ensuring that user-defined properties can override XO defaults, and that files are parsed correctly and performantly based on the users XO config.
@param xoConfig - The flat XO config to pre-process.
@returns The pre-processed flat XO config.
*/
export declare const preProcessXoConfig: (xoConfig: XoConfigItem[]) => {
config: XoConfigItem[];
tsFilesGlob: string[];
tsFilesIgnoresGlob: string[];
};