From 7663914fa46f0d8adab6f10ba92d1b2c0f26156b Mon Sep 17 00:00:00 2001 From: kaitoozawa Date: Wed, 31 Dec 2025 14:44:40 +1000 Subject: [PATCH] JSlint workflow --- .github/workflows/eslint.yml | 82 ++++++++++++++++++++++++++++++++++++ package.json | 4 +- 2 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/eslint.yml diff --git a/.github/workflows/eslint.yml b/.github/workflows/eslint.yml new file mode 100644 index 000000000..cfd83503e --- /dev/null +++ b/.github/workflows/eslint.yml @@ -0,0 +1,82 @@ +name: JavaScript Linting + +on: + pull_request: + branches: [ master ] + +permissions: + contents: read + pull-requests: read + +jobs: + lint-changed-files: + name: Lint Changed JavaScript Files (Blocking) + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20.x' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Get changed JavaScript files + id: changed-js-files + uses: tj-actions/changed-files@v45 + with: + files: '**/*.js' + files_ignore: | + node_modules/** + core/main/client/lib/** + **/*.min.js + extensions/admin_ui/media/javascript-min/** + separator: ' ' + + - name: Lint changed JavaScript files + if: steps.changed-js-files.outputs.any_changed == 'true' + run: | + echo "Linting ${{ steps.changed-js-files.outputs.all_changed_files_count }} changed JavaScript file(s)" + npx eslint ${{ steps.changed-js-files.outputs.all_changed_files }} + + - name: No JavaScript files changed + if: steps.changed-js-files.outputs.any_changed == 'false' + run: | + echo "No JavaScript files were changed in this PR. Skipping ESLint." + + lint-all-files: + name: Lint All JavaScript Files (Non-blocking Report) + runs-on: ubuntu-latest + continue-on-error: true + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20.x' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Lint all JavaScript files (report-only) + run: | + echo "Running ESLint on entire codebase" + echo "This is a report-only job and will not block the PR." + npx eslint "**/*.js" || true + + - name: Summary + if: always() + run: | + echo "Full codebase linting completed. Check the logs above for details." + echo "This job does not affect PR merge status." diff --git a/package.json b/package.json index 7bb6b79b3..e8c1ef461 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,9 @@ "version": "0.6.0.0", "description": "The Browser Exploitation Framework Project", "scripts": { - "docs": "./node_modules/.bin/jsdoc -c conf.json" + "docs": "./node_modules/.bin/jsdoc -c conf.json", + "lint": "eslint", + "lint:fix": "eslint --fix" }, "author": "Wade Alcorn", "license": "GNU General Public License v2.0",