Skip to content

fix: linting errors and file permissions#18

Merged
luigimorel merged 2 commits intomainfrom
fix-lint-errors
Sep 13, 2025
Merged

fix: linting errors and file permissions#18
luigimorel merged 2 commits intomainfrom
fix-lint-errors

Conversation

@luigimorel
Copy link
Owner

  • add github action and linter
  • refactor: improve file permissions and fix lint errors

@luigimorel luigimorel requested a review from Copilot September 13, 2025 17:07
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes linting errors and improves file permissions by refactoring string literals into constants and changing file permissions from 644 to 600. The changes enhance code maintainability and security by eliminating magic strings and making files more restrictive.

  • Replace hardcoded string literals with named constants for frameworks, runtimes, and platforms
  • Change all file permissions from 0644 to 0600 for better security
  • Improve error handling for os.Chdir operations

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
internal/tailwindcss.go Replace string literals with constants, update file permissions, improve error handling
internal/project.go Update file permissions and enhance error handling for directory changes
internal/llm.go Replace framework/runtime string literals with constants, update file permissions
internal/env-file.go Replace string literals with constants, update file permissions
internal/create_frontend.go Define framework/runtime constants, replace literals, add input validation
cmd/router.go Define router type constants, replace string literals, update file permissions
cmd/new.go Define template constants, replace string literals, improve error handling
cmd/install.go Define platform constants, replace string literals, add URL validation
cmd/frontend.go Define runtime constants, replace string literals
Makefile Enhanced formatting command
.golangci.yml Add comprehensive linter configuration
.github/workflows/lint.yml Add GitHub Actions workflow for linting

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.


func (tc *TailwindConfig) tailwindLibInstall(framework, runtime string) error {
if runtime == "node" {
if runtime == node {
Copy link

Copilot AI Sep 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The constant node is not defined. This should reference the constant defined in internal/create_frontend.go, but it's not accessible here. Either define the constant in this file or use a shared package-level constant.

Copilot uses AI. Check for mistakes.

switch framework {
case "react", "vue", "svelte", "solidjs":
case react, vue, svelte, solidjs:
Copy link

Copilot AI Sep 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The constants react, vue, svelte, solidjs are not defined in this file. These constants are defined in internal/create_frontend.go but are not accessible here. Either define these constants in this file or use a shared package-level constant.

Copilot uses AI. Check for mistakes.
case "angular":
if runtime == "bun" {
return exec.Command(runtime, "add", "tailwindcss", "@tailwindcss/postcss", "postcss", "--force").Run()
case angular:
Copy link

Copilot AI Sep 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The constants angular and bun are not defined in this file. These are defined in internal/create_frontend.go but not accessible here. Either define these constants in this file or use a shared package-level constant.

Copilot uses AI. Check for mistakes.
return exec.Command(runtime, "add", "tailwindcss", "@tailwindcss/postcss", "postcss", "--force").Run()
case angular:
angularArgs := []string{"tailwindcss", "@tailwindcss/postcss", "postcss", "--force"}
if runtime == bun {
Copy link

Copilot AI Sep 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The constants angular and bun are not defined in this file. These are defined in internal/create_frontend.go but not accessible here. Either define these constants in this file or use a shared package-level constant.

Copilot uses AI. Check for mistakes.
}

if runtime != "" && runtime != "node" {
if runtime != "" && runtime != node {
Copy link

Copilot AI Sep 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The constant node is not defined in this file. This constant is defined in other files but is not accessible here. Either define the constant in this file or use a shared package-level constant.

Copilot uses AI. Check for mistakes.

func (pg *ProjectGenerator) CreateEnvConfig(dirName, framework string, useTypeScript bool) error {
if framework == "angular" {
if framework == angular {
Copy link

Copilot AI Sep 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The constant angular is not defined in this file. This constant is defined in internal/create_frontend.go but is not accessible here. Either define the constant in this file or use a shared package-level constant.

Copilot uses AI. Check for mistakes.
Comment on lines +13 to 17
// Runtime constants
const (
node = "node"
bun = "bun"
)
Copy link

Copilot AI Sep 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These constants are duplicated across multiple files (internal/create_frontend.go and cmd/frontend.go). Consider moving all shared constants to a common package to avoid duplication and maintain consistency.

Suggested change
// Runtime constants
const (
node = "node"
bun = "bun"
)
// Runtime constants are now defined in the internal package as internal.Node and internal.Bun

Copilot uses AI. Check for mistakes.
@luigimorel luigimorel merged commit edecb00 into main Sep 13, 2025
2 checks passed
@luigimorel luigimorel deleted the fix-lint-errors branch September 13, 2025 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant