Skip to content
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
85 changes: 85 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Lint Code

on: [push, pull_request]

jobs:
lint_js:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install ESLint globally
run: |
sudo apt-get update
sudo apt-get install -y eslint # Install ESLint globally

- name: Lint JavaScript
run: npx eslint .

lint_html:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install HTMLHint globally
run: |
sudo npm install -g htmlhint

- name: Lint HTML
run: npx htmlhint .

fix_html:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install HTML Tidy globally
run: |
sudo apt-get update
sudo apt-get install -y tidy

- name: Lint and Fix HTML files
run: |
tidy -qe **/*.html

lint_css:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install Stylelint globally
run: |
sudo npm install -g stylelint

- name: Lint CSS
run: npx stylelint "**/*.css"

lint_shell:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install ShellCheck globally
run: |
sudo apt-get install -y shellcheck

- name: Lint Shell scripts
run: shellcheck **/*.sh

lint_cpp:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install Clang-Tidy globally
run: |
sudo apt-get install -y clang-tidy

- name: Lint C++ code
run: clang-tidy **/*.cpp
25 changes: 25 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// eslint.config.js
module.exports = [
{
languageOptions: {
globals: {
// Define any global variables here (e.g., for browsers)
window: 'readonly',
document: 'readonly',
},
parserOptions: {
ecmaVersion: 12, // ES2021
sourceType: 'module', // Enable ES6 modules
},
},
rules: {
'no-console': 'warn', // Warn on console statements
'semi': ['error', 'always'], // Enforce semicolons
'quotes': ['error', 'single'], // Enforce single quotes
'eqeqeq': 'error', // Enforce strict equality (===)
'curly': 'error', // Enforce curly braces for control statements
'no-unused-vars': 'warn', // Warn about unused variables
'no-magic-numbers': 'off', // Optional: disable rule for magic numbers if you want
},
},
];