Help us shape the future of Go! Take the 2026 Go Developer Survey

codemod

package
v0.20.5 Latest Latest
Warning

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

Go to latest
Published: May 29, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package codemod provides helpers for codemods and project automation.

Index

Constants

This section is empty.

Variables

View Source
var CodemodCmd = &cobra.Command{
	Use:   "codemod",
	Short: "Helpers for codemods and project automation",
	Long:  `Run codemods or setup helpers for various project types.`,
}

CodemodCmd is the root command for codemod-related helpers and automation.

View Source
var LintSetupCmd = &cobra.Command{
	Use:   "lint-setup",
	Short: "Setup linting and formatting for a Node.js project",
	Long:  `Install and configure linting, formatting, and pre-commit hooks for a Node.js project (eslint, prettier, husky, etc).`,
	Run: func(cmd *cobra.Command, args []string) {
		if _, err := os.Stat("package.json"); errors.Is(err, os.ErrNotExist) {
			log.Error("package.json not found in current directory")
			return
		}

		if err := installLintDependencies(); err != nil {
			log.Error("npm install failed: %v", err)
			return
		}

		if err := writeESLintConfig(); err != nil {
			log.Error("Failed to write eslint.config.mjs: %v", err)
			return
		}

		if err := updatePackageJSON(); err != nil {
			log.Error("Failed to update package.json: %v", err)
			return
		}

		if err := setupHusky(); err != nil {
			log.Error("Failed to set up Husky: %v", err)
			return
		}

		log.Success("Linting, formatting, and pre-commit hooks are set up!")
	},
}

LintSetupCmd sets up linting, formatting, and pre-commit hooks for a Node.js project.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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