Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .githooks/pre-commit.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package main

import (
"fmt"
"os"
"os/exec"
"runtime"
)

func main() {
fmt.Println("ESLintを実行します...")
var cmd *exec.Cmd
if runtime.GOOS == "windows" {
cmd = exec.Command("cmd", "/C", "npx eslint")
} else {
cmd = exec.Command("sh", "-c", "npx eslint")
}
output, err := cmd.Output()
if err != nil {
fmt.Println(string(output))
fmt.Println("\033[91m[Error] コミットを中断します...\033[0m\n")
os.Exit(1)
}
fmt.Println(string(output))
fmt.Println("\033[92m[Success] Lint check passed! \033[0m\n")
}
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ init:
@echo "\033[94m[INFO]\033[0m Building Git hooks..."
@printf "\033[91m[-]\033[0m commit-msg\r"
@go build -o ./.git/hooks/commit-msg ./.githooks/commit-msg.go && printf "\033[92m[✔]\033[0m commit-msg\n"
@printf "\033[91m[-]\033[0m psot-checkout\r"
@printf "\033[91m[-]\033[0m pre-commit\r"
@go build -o ./.git/hooks/pre-commit ./.githooks/pre-commit.go && printf "\033[92m[✔]\033[0m pre-commit\n"
@printf "\033[91m[-]\033[0m post-checkout\r"
@go build -o ./.git/hooks/post-checkout ./.githooks/post-checkout.go && printf "\033[92m[✔]\033[0m post-checkout\n"
@echo "\033[94m[INFO]\033[0m Git hooks build completed successfully!"
@echo "\033[94m[INFO]\033[0m Installing npm dependencies..."
Expand All @@ -12,4 +14,4 @@ init:
@echo "\033[94m[INFO]\033[0m 🎉 Directory initialization completed successfully 🎉"

tree:
@tree -da -I "node_modules|.git|.react-router"
@tree -da -I "node_modules|.git|.react-router"
22 changes: 22 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { defineConfig } from "eslint/config";
import globals from "globals";
import js from "@eslint/js";
import tseslint from "typescript-eslint";
import pluginReact from "eslint-plugin-react";


export default defineConfig([
{ files: ["**/*.{js,mjs,cjs,ts,jsx,tsx}"] },
{ files: ["**/*.{js,mjs,cjs,ts,jsx,tsx}"], languageOptions: { globals: globals.browser } },
{ files: ["**/*.{js,mjs,cjs,ts,jsx,tsx}"], plugins: { js }, extends: ["js/recommended"] },
tseslint.configs.recommended,
pluginReact.configs.flat.recommended,
{
rules: {
"react/jsx-uses-react": "off",
"react/react-in-jsx-scope": "off",
"react/no-unescaped-entities": "off",
"no-empty-pattern": "off",
},
},
]);
Loading