Skip to content

Commit

Permalink
Added linters to the project for all lang
Browse files Browse the repository at this point in the history
  • Loading branch information
BassCoder2808 committed Jun 3, 2023
1 parent 888df10 commit 1e2c215
Show file tree
Hide file tree
Showing 9 changed files with 7,250 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module.exports = {
env: {
browser: true,
es2021: true,
},
extends: ["airbnb-base"],
parserOptions: {
ecmaVersion: 12,
sourceType: "module",
},
rules: {
"max-len": ["error", { code: 120 }], // Limit lines to 120 characters
indent: ["error", 2], // Use 2 spaces for indentation
"no-tabs": "error", // Disallow tabs
"linebreak-style": ["error", "unix"], // Enforce Unix line endings
"no-unused-vars": ["error", { argsIgnorePattern: "^_" }], // Ignore unused function arguments starting with underscore (_)
"no-console": "off", // Allow console statements
"comma-dangle": ["error", "never"], // Disallow trailing commas in arrays and objects
"arrow-parens": ["error", "as-needed"], // Require parentheses around arrow function parameters only when needed
"object-curly-spacing": ["error", "always"], // Require spaces inside curly braces of objects
quotes: ["error", "double", { avoidEscape: true }],
},
};
45 changes: 45 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Linting

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
lint:
runs-on: ubuntu-latest

steps:
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: 14

- name: Checkout code
uses: actions/checkout@v2

- name: Install dependencies
run: npm ci # For JavaScript linting (replace with your package manager command)

- name: Run ESLint
run: npx eslint . --ext .js

- name: Run HTMLHint
run: npx htmlhint .

- name: Run Stylelint
run: npx stylelint .

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9

- name: Install Python dependencies
run: pip install -r requirements.txt # For Python linting (replace with your command)

- name: Run Pylint
run: pylint .
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,5 @@ data/certbot/

container_logs

# node modules
node_modules/
21 changes: 21 additions & 0 deletions .htmlhintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"tagname-lowercase": true, // Enforce lowercase tag names
"attr-lowercase": true, // Enforce lowercase attribute names
"attr-value-double-quotes": true, // Require double quotes for attribute values
"attr-value-not-empty": true, // Disallow empty attribute values
"doctype-first": true, // Require the doctype declaration to be the first line
"tag-pair": true, // Require opening and closing tags to be paired
"tag-self-close": true, // Allow self-closing tags
"spec-char-escape": true, // Require escaping special characters
"id-unique": true, // Require unique IDs
"src-not-empty": true, // Disallow empty src attribute values
"alt-require": true, // Require alt attributes for images
"space-tab-mixed-disabled": "space", // Disallow mixed spaces and tabs, enforce spaces
"id-class-value": "dash", // Enforce dashes for ID and class names
"doctype-html5": true, // Enforce HTML5 doctype
"attr-no-duplication": true, // Disallow duplicate attributes
"title-require": true, // Require title tag in head section
"head-req-title": true, // Require title tag to be non-empty
"tag-req-attr": true, // Require attributes for specific tags
"attr-unsafe-chars": true // Disallow unsafe characters in attribute values
}
Loading

0 comments on commit 1e2c215

Please sign in to comment.