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
45 changes: 45 additions & 0 deletions CI/linters/eslint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
eslint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: npm ci
- name: Run ESLint
run: |
set -euo pipefail
ERROR_FOUND=0

CONFIG_FOUND=0
for config in ".eslintrc.json" ".eslintrc.js" ".eslintrc.yml" ".eslintrc.yaml" "eslint.config.js" "eslint.config.mjs" "eslint.config.cjs"; do
if [ -f "$config" ]; then
CONFIG_FOUND=1
break
fi
done

if [ $CONFIG_FOUND -eq 0 ]; then
echo "::error::No ESLint config file found"
exit 1
fi

mapfile -t js_files < <(find . -type f \( -name "*.js" -o -name "*.jsx" -o -name "*.ts" -o -name "*.tsx" -o -name "*.mjs" -o -name "*.cjs" \) \
-not -path "./_site/*" \
-not -path "./node_modules/*" \
-not -path "./.git/*")

if [ ${#js_files[@]} -eq 0 ]; then
echo "⚠️ No JS/TS files found. Skipping."
exit 0
fi

for file in "${js_files[@]}"; do
echo "ℹ️ Checking ${file#./}..."
npx eslint "$file" || ERROR_FOUND=1
done

if [[ $ERROR_FOUND -eq 0 ]]; then
echo "✅ All JS/TS files passed ESLint checks!"
else
echo "❌ ESLint found issues!"
exit 1
fi
3 changes: 2 additions & 1 deletion CI/linters/yamllint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ yamllint:
mapfile -t yaml_files < <(find . -type f \( -name "*.yml" -o -name "*.yaml" \) \
-not -path "./_site/*" \
-not -path "./node_modules/*" \
-not -path "./.git/*")
-not -path "./.git/*" \
-not -name ".yamllint.yml")

if [ ${#yaml_files[@]} -eq 0 ]; then
echo "⚠️ No YAML files found. Skipping."
Expand Down
8 changes: 8 additions & 0 deletions scripts/CI/linters/eslint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
eslint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: npm ci
- name: Run ESLint
run: bash scripts/shell/linters/eslint.sh
38 changes: 38 additions & 0 deletions scripts/shell/linters/eslint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bash
set -euo pipefail
ERROR_FOUND=0

CONFIG_FOUND=0
for config in ".eslintrc.json" ".eslintrc.js" ".eslintrc.yml" ".eslintrc.yaml" "eslint.config.js" "eslint.config.mjs" "eslint.config.cjs"; do
if [ -f "$config" ]; then
CONFIG_FOUND=1
break
fi
done

if [ $CONFIG_FOUND -eq 0 ]; then
echo "::error::No ESLint config file found"
exit 1
fi

mapfile -t js_files < <(find . -type f \( -name "*.js" -o -name "*.jsx" -o -name "*.ts" -o -name "*.tsx" -o -name "*.mjs" -o -name "*.cjs" \) \
-not -path "./_site/*" \
-not -path "./node_modules/*" \
-not -path "./.git/*")

if [ ${#js_files[@]} -eq 0 ]; then
echo "⚠️ No JS/TS files found. Skipping."
exit 0
fi

for file in "${js_files[@]}"; do
echo "ℹ️ Checking ${file#./}..."
npx eslint "$file" || ERROR_FOUND=1
done

if [[ $ERROR_FOUND -eq 0 ]]; then
echo "✅ All JS/TS files passed ESLint checks!"
else
echo "❌ ESLint found issues!"
exit 1
fi
3 changes: 2 additions & 1 deletion scripts/shell/linters/yamllint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ fi
mapfile -t yaml_files < <(find . -type f \( -name "*.yml" -o -name "*.yaml" \) \
-not -path "./_site/*" \
-not -path "./node_modules/*" \
-not -path "./.git/*")
-not -path "./.git/*" \
-not -name ".yamllint.yml")

if [ ${#yaml_files[@]} -eq 0 ]; then
echo "⚠️ No YAML files found. Skipping."
Expand Down