lintstaged

package
v0.1.0-alpha.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 1, 2024 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const PatchUnstaged = "lint-staged_unstaged.patch"

Variables

View Source
var (
	ErrApplyEmptyCommit       = fmt.Errorf("apply empty commit error")
	ErrConfigNotFound         = fmt.Errorf("configuration could not be found")
	ErrConfigFormat           = fmt.Errorf("configuration should be an object or a function") // TODO
	ErrConfigEmpty            = fmt.Errorf("configuration should not be empty")
	ErrGetBackupStash         = fmt.Errorf("get backup stash error")
	ErrGetStagedFiles         = fmt.Errorf("get staged files error")
	ErrGitRepo                = fmt.Errorf("git repo error")
	ErrIgnore                 = fmt.Errorf("load ignore rules error")
	ErrHideUnstagedChanges    = fmt.Errorf("hide unstaged changes error")
	ErrInvalidOptions         = fmt.Errorf("invalid options")
	ErrRestoreMergeStatus     = fmt.Errorf("restore merge status error")
	ErrRestoreOriginalState   = fmt.Errorf("restore original state error")
	ErrRestoreUnstagedChanges = fmt.Errorf("restore unstaged changes error")
)

Functions

func Commands

func Commands() []*cobra.Command

func Run

func Run(options *Options) error

Types

type Command

type Command struct {
	Command string // command show to user

	Dir      bool // use dir instead of file
	Absolute bool
	NoArgs   bool
	Prepend  string // prepend to each file
	// contains filtered or unexported fields
}

type Config

type Config struct {
	Path  string
	Rules []*Rule
}

type File

type File struct {
	// contains filtered or unexported fields
}

File

it's underlying data is the path relative to the git root

func NewFile

func NewFile(ctx *State, gitRelativePath string) *File

func (File) AbsolutePath

func (f File) AbsolutePath() string

func (File) GitRelativePath

func (f File) GitRelativePath() string

func (File) RelativePathToGitRoot

func (f File) RelativePathToGitRoot() string

type Files

type Files []*File

Files is a slice of File

func NewFiles

func NewFiles(ctx *State, relativePathsToGitRoot []string) Files

func (Files) AbsolutePaths

func (files Files) AbsolutePaths() []string

func (Files) GitRelativePaths

func (files Files) GitRelativePaths() []string

func (Files) RelativePathsToGitRoot

func (files Files) RelativePathsToGitRoot() []string

type IgnoreChecker

type IgnoreChecker struct {
	// contains filtered or unexported fields
}

func NewIgnoreChecker

func NewIgnoreChecker(repoRoot string) (*IgnoreChecker, error)

func (*IgnoreChecker) ShouldIgnore

func (c *IgnoreChecker) ShouldIgnore(gitRelativePath string) bool

type Options

type Options struct {
	AllowEmpty bool
	ConfigPath string
	Diff       string
	DiffFilter string
	Stash      bool
	Shell      string
	Verbose    bool
}

type Rule

type Rule struct {
	Glob       glob.Glob
	GlobString string
	Commands   []*Command
}

type State

type State struct {
	// contains filtered or unexported fields
}

type TaskResult

type TaskResult struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL