Function runCli

  • Runs the CLI.

    Parameters

    • args: {
          apiArgs: {
              baseRef: string;
              checkoutBaseRef: boolean;
              cwd: string;
              pastSetupCommand: string;
              silent: boolean;
          };
          eslintArgString: string;
      }
      • apiArgs: {
            baseRef: string;
            checkoutBaseRef: boolean;
            cwd: string;
            pastSetupCommand: string;
            silent: boolean;
        }
        • baseRef: string

          The git ref from which to calculate a merge base with the current HEAD. This merge base is then used for calculating all "changes" to lint. Meaning, any file changes after that merge base are counted as changes for linting.

          If this value is not provided it will be determined in the following ways: - GitHub Actions: determined from the pull request merge target - API or CLI: determined by finding the most recent commit that is contained within a branch that does not contain the current git HEAD.

          Default

          ''
          
        • checkoutBaseRef: boolean

          If set to true, the lint command will attempt to checkout the changes base ref in order to lint it independently. Typically this is only done in CI environments, as doing so locally means you cannot edit any files while the process is running.

          If CI is set to true, this will automatically be set to true.

          Default

          false
          
        • cwd: string

          The directory within all commands will be run.

          Default

          process.cwd()
          
        • pastSetupCommand: string

          This command, whatever it is, will be run when the base ref is checked out for comparison linting. This only has any effect if checkoutBaseRef is set to true.

          Default

          'npm ci'
          
        • silent: boolean

          Remove all non-error logging.

      • eslintArgString: string
    • omitExit: boolean = false

      Set to true to prevent this function from calling process.exit when there's an error or failure.

    Returns Promise<boolean>

    true if ESLint passes. Otherwise, false.