xo

  • Version 4.0.0
  • Published
  • 93.8 kB
  • 19 dependencies
  • MIT license

Install

npm i xo
yarn add xo
pnpm add xo

Overview

JavaScript/TypeScript linter (ESLint wrapper) with great defaults

Index

Variables

variable ignoredFileWarningMessage

const ignoredFileWarningMessage: string;

    variable noFilesFoundErrorMessage

    const noFilesFoundErrorMessage: string;

      Classes

      class Xo

      class Xo {}

        constructor

        constructor(_linterOptions: LinterOptions, _baseXoConfig?: XoConfigOptions);

          method calculateConfigForFile

          calculateConfigForFile: (filePath: string) => Promise<Linter.Config>;

            method ensureCacheDirectory

            ensureCacheDirectory: () => Promise<void>;
            • Ensures the cache directory exists. This needs to run once before both tsconfig handling and running ESLint occur.

            method getFormatter

            getFormatter: (name: string) => Promise<ESLint.LoadedFormatter>;

              method getProjectEslintConfig

              getProjectEslintConfig: () => Promise<Linter.Config[]>;
              • Create an ESLint flat config for editor integrations using the same XO pipeline as the CLI.

              method handleUnincludedTsFiles

              handleUnincludedTsFiles: (files?: string[]) => Promise<void>;
              • Checks every TS file to ensure it is included in the tsconfig. Any that are not included are routed through a generated tsconfig (tsconfig.generated.json) so that autofix works correctly across multiple ESLint passes.

                Parameter files

                The TypeScript files being linted.

              method initEslint

              initEslint: (
              files?: string[],
              cliIgnores?: string[],
              shouldStripDefaultIgnores?: boolean
              ) => Promise<void>;
              • Initializes the ESLint instance on the XO instance.

              method lintFiles

              static lintFiles: (
              globs: string | undefined,
              options: LinterOptions & XoConfigOptions
              ) => Promise<XoLintResult>;
              • Static helper for backwards compatibility and use in editor extensions and other tools.

              • Lints the files on the XO instance.

                Parameter globs

                Glob pattern to pass to globby.

                Throws

                Error

              method lintText

              static lintText: (
              code: string,
              options: LintTextOptions & LinterOptions & XoConfigOptions
              ) => Promise<XoLintResult>;
              • Static helper for backwards compatibility and use in editor extensions and other tools.

              • Lints the text on the XO instance.

              method outputFixes

              static outputFixes: (results: XoLintResult) => Promise<void>;
              • Write the fixes to disk.

              method setEslintConfig

              setEslintConfig: (
              cliIgnores?: string[],
              shouldStripDefaultIgnores?: boolean
              ) => void;

                method setXoConfig

                setXoConfig: () => Promise<void>;
                • Sets the XO config on the XO instance.

                Package Files (1)

                Dependencies (19)

                Dev Dependencies (9)

                Peer Dependencies (0)

                No peer dependencies.

                Badge

                To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/xo.

                • Markdown
                  [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/xo)
                • HTML
                  <a href="https://www.jsdocs.io/package/xo"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>