UNPKG

xo

Version:

JavaScript/TypeScript linter (ESLint wrapper) with great defaults

45 lines (37 loc) 1.91 kB
import { type Linter } from 'eslint'; import { typescriptParser } from 'eslint-config-xo'; import { type XoConfigItem } from './types.js'; export { typescriptParser }; /** 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 - The XO config item to convert. @returns The equivalent ESLint config item. */ export declare const xoToEslintConfigItem: (xoConfig: XoConfigItem) => Linter.Config; /** 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[] | undefined, globs: string[], ignores: string[]) => string[]; /** Validate an XO config array for legacy ESLint config properties that are not supported in flat config. @param xoConfig - The flat XO config to validate. */ export declare const validateXoConfig: (xoConfig: XoConfigItem[]) => void; /** 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[]; };