Skip to content

Commit 3ba0ca3

Browse files
committed
JSlint workflow
1 parent ed164f6 commit 3ba0ca3

File tree

2 files changed

+85
-1
lines changed

2 files changed

+85
-1
lines changed

.github/workflows/eslint.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: JavaScript Linting
2+
3+
on:
4+
pull_request:
5+
branches: [ master ]
6+
7+
permissions:
8+
contents: read
9+
pull-requests: read
10+
11+
jobs:
12+
lint-changed-files:
13+
name: Lint Changed JavaScript Files (Blocking)
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Setup Node.js
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: '20.x'
26+
cache: 'npm'
27+
28+
- name: Install dependencies
29+
run: npm ci
30+
31+
- name: Get changed JavaScript files
32+
id: changed-js-files
33+
uses: tj-actions/changed-files@v45
34+
with:
35+
files: '**/*.js'
36+
files_ignore: |
37+
node_modules/**
38+
core/main/client/lib/**
39+
**/*.min.js
40+
extensions/admin_ui/media/javascript-min/**
41+
separator: ' '
42+
43+
- name: Lint changed JavaScript files
44+
if: steps.changed-js-files.outputs.any_changed == 'true'
45+
run: |
46+
echo "Linting ${{ steps.changed-js-files.outputs.all_changed_files_count }} changed JavaScript file(s)"
47+
npx eslint ${{ steps.changed-js-files.outputs.all_changed_files }}
48+
49+
- name: No JavaScript files changed
50+
if: steps.changed-js-files.outputs.any_changed == 'false'
51+
run: |
52+
echo "No JavaScript files were changed in this PR. Skipping ESLint."
53+
54+
lint-all-files:
55+
name: Lint All JavaScript Files (Non-blocking Report)
56+
runs-on: ubuntu-latest
57+
continue-on-error: true
58+
59+
steps:
60+
- name: Checkout repository
61+
uses: actions/checkout@v4
62+
63+
- name: Setup Node.js
64+
uses: actions/setup-node@v4
65+
with:
66+
node-version: '20.x'
67+
cache: 'npm'
68+
69+
- name: Install dependencies
70+
run: npm ci
71+
72+
- name: Lint all JavaScript files (report-only)
73+
run: |
74+
echo "Running ESLint on entire codebase"
75+
echo "This is a report-only job and will not block the PR."
76+
npx eslint "**/*.js" || true
77+
78+
- name: Summary
79+
if: always()
80+
run: |
81+
echo "Full codebase linting completed. Check the logs above for details."
82+
echo "This job does not affect PR merge status."

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
"version": "0.6.0.0",
44
"description": "The Browser Exploitation Framework Project",
55
"scripts": {
6-
"docs": "./node_modules/.bin/jsdoc -c conf.json"
6+
"docs": "./node_modules/.bin/jsdoc -c conf.json",
7+
"lint": "eslint",
8+
"lint:fix": "eslint --fix"
79
},
810
"author": "Wade Alcorn",
911
"license": "GNU General Public License v2.0",

0 commit comments

Comments
 (0)