fix: linting errors and file permissions#18
Conversation
luigimorel
commented
Sep 13, 2025
- add github action and linter
- refactor: improve file permissions and fix lint errors
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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.
|
|
||
| switch framework { | ||
| case "react", "vue", "svelte", "solidjs": | ||
| case react, vue, svelte, solidjs: |
There was a problem hiding this comment.
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.
| case "angular": | ||
| if runtime == "bun" { | ||
| return exec.Command(runtime, "add", "tailwindcss", "@tailwindcss/postcss", "postcss", "--force").Run() | ||
| case angular: |
There was a problem hiding this comment.
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.
| return exec.Command(runtime, "add", "tailwindcss", "@tailwindcss/postcss", "postcss", "--force").Run() | ||
| case angular: | ||
| angularArgs := []string{"tailwindcss", "@tailwindcss/postcss", "postcss", "--force"} | ||
| if runtime == bun { |
There was a problem hiding this comment.
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.
| } | ||
|
|
||
| if runtime != "" && runtime != "node" { | ||
| if runtime != "" && runtime != node { |
There was a problem hiding this comment.
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.
|
|
||
| func (pg *ProjectGenerator) CreateEnvConfig(dirName, framework string, useTypeScript bool) error { | ||
| if framework == "angular" { | ||
| if framework == angular { |
There was a problem hiding this comment.
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.
| // Runtime constants | ||
| const ( | ||
| node = "node" | ||
| bun = "bun" | ||
| ) |
There was a problem hiding this comment.
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.
| // Runtime constants | |
| const ( | |
| node = "node" | |
| bun = "bun" | |
| ) | |
| // Runtime constants are now defined in the internal package as internal.Node and internal.Bun |