Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linter added for go and javascript #259

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**/*
!**/*.js
7 changes: 7 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports ={
files: ["**/*.js"],
rules: {
"semi": "error",
"no-unused-vars": "error"
}
};
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.PHONY: lint
lint: lint-js lint-go

.PHONY: lint-js
lint-js:
./js-lint.sh

.PHONY: lint-go
lint-go:
./go-lint.sh
11 changes: 11 additions & 0 deletions go-lint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

GO_FILES=$(find . -type f -name "*.go")

if [ -n "$GO_FILES" ]; then
gofmt -s -w $GO_FILES
else
echo "No Go files found for formatting check."
fi

echo "Formatting check complete!"
13 changes: 13 additions & 0 deletions js-lint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

JS_FILES=$(find . -type f \( -name "*.js" -or -name "package.json" \))

echo "Linting JavaScript files..."
npx eslint -c .eslintrc.js ${JS_FILES}

if [ $? -ne 0 ]; then
echo "ESLint found errors. Please fix them before continuing."
exit 1
fi