From edae45062f8841b9732cb53eabafe17ff3583284 Mon Sep 17 00:00:00 2001 From: khubaib rashid Date: Sun, 22 Jun 2025 23:22:17 +0500 Subject: [PATCH 1/9] Add linting config and Github Action workflow --- .github/workflows/ci-develop.yaml | 26 ++++++++++++++++++++++++++ .htmlhintrc.json | 7 +++++++ .stylelintrc.json | 10 ++++++++++ 3 files changed, 43 insertions(+) create mode 100644 .github/workflows/ci-develop.yaml create mode 100644 .htmlhintrc.json create mode 100644 .stylelintrc.json diff --git a/.github/workflows/ci-develop.yaml b/.github/workflows/ci-develop.yaml new file mode 100644 index 0000000..b29c763 --- /dev/null +++ b/.github/workflows/ci-develop.yaml @@ -0,0 +1,26 @@ +name: Lint HTML and CSS + +on: + pull_request: + branches: [develop] + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: '18' + + - name: Install linters + run: | + npm install -g htmlhint stylelint stylelint-config-standard + + - name: Lint HTML + run: htmlhint src/**/*.html + + - name: Lint CSS + run: stylelint "styles/**/*.css" diff --git a/.htmlhintrc.json b/.htmlhintrc.json new file mode 100644 index 0000000..41a78e7 --- /dev/null +++ b/.htmlhintrc.json @@ -0,0 +1,7 @@ +{ + "tagname-lowercase": true, + "attr-lowercase": true, + "alt-require": true, + "id-unique": true, + "tag-pair": true +} diff --git a/.stylelintrc.json b/.stylelintrc.json new file mode 100644 index 0000000..05785c1 --- /dev/null +++ b/.stylelintrc.json @@ -0,0 +1,10 @@ +{ + "rules": { + "declaration-block-no-duplicate-properties": true, + "no-duplicate-selectors": true, + "property-case": "lower", + "value-keyword-case": "lower", + "selector-type-case": "lower", + "block-no-empty": true + } +} From 49af578baccd63f92d26237b506bd35a77d357e1 Mon Sep 17 00:00:00 2001 From: khubaib rashid Date: Sun, 22 Jun 2025 23:41:59 +0500 Subject: [PATCH 2/9] Add valid HTML and CSS files for Home page --- src/home.html | 11 +++++++++++ styles/home.css | 3 +++ 2 files changed, 14 insertions(+) create mode 100644 src/home.html create mode 100644 styles/home.css diff --git a/src/home.html b/src/home.html new file mode 100644 index 0000000..a717307 --- /dev/null +++ b/src/home.html @@ -0,0 +1,11 @@ + + + + Home + + + +

Welcome to My Portfolio

+ My profile photo + + diff --git a/styles/home.css b/styles/home.css new file mode 100644 index 0000000..60f1eab --- /dev/null +++ b/styles/home.css @@ -0,0 +1,3 @@ +body { + color: red; +} From abba305a26784fc003aa4d4ca8ed4080d62768f8 Mon Sep 17 00:00:00 2001 From: khubaib rashid Date: Sun, 22 Jun 2025 23:48:54 +0500 Subject: [PATCH 3/9] Fix stylelint config by adding standard preset --- .stylelintrc.json | 1 + 1 file changed, 1 insertion(+) diff --git a/.stylelintrc.json b/.stylelintrc.json index 05785c1..2235fb9 100644 --- a/.stylelintrc.json +++ b/.stylelintrc.json @@ -1,4 +1,5 @@ { + "extends": "stylelint-config-standard", "rules": { "declaration-block-no-duplicate-properties": true, "no-duplicate-selectors": true, From f387e1dbc6c238a9c593bd010a2f5f18ea17c6e6 Mon Sep 17 00:00:00 2001 From: khubaib rashid Date: Sun, 22 Jun 2025 23:55:25 +0500 Subject: [PATCH 4/9] Update workflow to fix Stylelint rule error --- .github/workflows/ci-develop.yaml | 4 +++- .stylelintrc.json | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-develop.yaml b/.github/workflows/ci-develop.yaml index b29c763..71681dd 100644 --- a/.github/workflows/ci-develop.yaml +++ b/.github/workflows/ci-develop.yaml @@ -17,7 +17,9 @@ jobs: - name: Install linters run: | - npm install -g htmlhint stylelint stylelint-config-standard + npm init -y + npm install --save-dev htmlhint stylelint stylelint-config-standard + npm install -g htmlhint - name: Lint HTML run: htmlhint src/**/*.html diff --git a/.stylelintrc.json b/.stylelintrc.json index 2235fb9..4c18a5e 100644 --- a/.stylelintrc.json +++ b/.stylelintrc.json @@ -1,5 +1,5 @@ { - "extends": "stylelint-config-standard", + "extends": ["stylelint-config-standard"], "rules": { "declaration-block-no-duplicate-properties": true, "no-duplicate-selectors": true, @@ -9,3 +9,4 @@ "block-no-empty": true } } + From aa25f945b6e6ff53a3b35b3be2dce6c1d9b1c4a9 Mon Sep 17 00:00:00 2001 From: khubaib rashid Date: Mon, 23 Jun 2025 00:01:38 +0500 Subject: [PATCH 5/9] Fix use npx to run stylint correctly --- .github/workflows/ci-develop.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-develop.yaml b/.github/workflows/ci-develop.yaml index 71681dd..6c1ae85 100644 --- a/.github/workflows/ci-develop.yaml +++ b/.github/workflows/ci-develop.yaml @@ -7,6 +7,7 @@ on: jobs: lint: runs-on: ubuntu-latest + steps: - uses: actions/checkout@v2 @@ -18,11 +19,11 @@ jobs: - name: Install linters run: | npm init -y - npm install --save-dev htmlhint stylelint stylelint-config-standard + npm install --save-dev stylelint stylelint-config-standard npm install -g htmlhint - name: Lint HTML - run: htmlhint src/**/*.html + run: htmlhint "src/**/*.html" - name: Lint CSS - run: stylelint "styles/**/*.css" + run: npx stylelint "styles/**/*.css" From e6c195fe0c5d6dfd7e460a20e5aab84fad7a8531 Mon Sep 17 00:00:00 2001 From: khubaib rashid Date: Mon, 23 Jun 2025 00:10:03 +0500 Subject: [PATCH 6/9] Fix: update CI workflow and Stylelint config --- .github/workflows/ci-develop.yaml | 45 +++++++++++++++++++------------ 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci-develop.yaml b/.github/workflows/ci-develop.yaml index 6c1ae85..9aa6866 100644 --- a/.github/workflows/ci-develop.yaml +++ b/.github/workflows/ci-develop.yaml @@ -1,29 +1,40 @@ -name: Lint HTML and CSS +name: CI for Develop Branch on: pull_request: - branches: [develop] + branches: [ develop ] jobs: lint: runs-on: ubuntu-latest - + steps: - - uses: actions/checkout@v2 - - - name: Set up Node.js + - name: Checkout code + uses: actions/checkout@v3 + + - name: Setup Node.js uses: actions/setup-node@v3 with: node-version: '18' - - - name: Install linters + + - name: Install HTMLHint + run: npm install -g htmlhint + + - name: Install Stylelint + run: npm install -g stylelint stylelint-config-standard + + - name: Lint HTML files run: | - npm init -y - npm install --save-dev stylelint stylelint-config-standard - npm install -g htmlhint - - - name: Lint HTML - run: htmlhint "src/**/*.html" - - - name: Lint CSS - run: npx stylelint "styles/**/*.css" + if ls src/*.html 1> /dev/null 2>&1; then + htmlhint src/*.html + else + echo "No HTML files found to lint" + fi + + - name: Lint CSS files + run: | + if ls styles/*.css 1> /dev/null 2>&1; then + stylelint styles/*.css + else + echo "No CSS files found to lint" + fi \ No newline at end of file From 403a7625e5a9bf91bbdfdc45d6ba718836a8c904 Mon Sep 17 00:00:00 2001 From: khubaib rashid Date: Mon, 23 Jun 2025 00:13:01 +0500 Subject: [PATCH 7/9] Fix: update Styles --- styles/home.css | 3 --- 1 file changed, 3 deletions(-) diff --git a/styles/home.css b/styles/home.css index 60f1eab..e69de29 100644 --- a/styles/home.css +++ b/styles/home.css @@ -1,3 +0,0 @@ -body { - color: red; -} From b6f78ad945cec9bcb7c8eca6d262dfeaf3658475 Mon Sep 17 00:00:00 2001 From: khubaib rashid Date: Mon, 23 Jun 2025 00:20:51 +0500 Subject: [PATCH 8/9] Fix empty CSS file with proper content --- src/home.html | 17 ++++++++++++----- styles/home.css | 12 ++++++++++++ 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/home.html b/src/home.html index a717307..b85177c 100644 --- a/src/home.html +++ b/src/home.html @@ -1,11 +1,18 @@ - Home - + + my portfolio + -

Welcome to My Portfolio

- My profile photo +
+

welcome to my portfolio

+
+ +
+

this is my portfolio website

+ placeholder image +
- + \ No newline at end of file diff --git a/styles/home.css b/styles/home.css index e69de29..2ea0fdd 100644 --- a/styles/home.css +++ b/styles/home.css @@ -0,0 +1,12 @@ +body { + font-family: arial, sans-serif; + margin: 0; + padding: 0; + background-color: #f5f5f5; +} + +header { + background-color: #333; + color: white; + padding: 1rem; +} \ No newline at end of file From bf6a901f16157fb4e1a130c734d691e5f3cce598 Mon Sep 17 00:00:00 2001 From: khubaib rashid Date: Mon, 23 Jun 2025 00:25:32 +0500 Subject: [PATCH 9/9] Fix stylelint config and rules --- .github/workflows/ci-develop.yaml | 2 +- .stylelintrc.json | 2 -- styles/home.css | 5 +++++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-develop.yaml b/.github/workflows/ci-develop.yaml index 9aa6866..55920c2 100644 --- a/.github/workflows/ci-develop.yaml +++ b/.github/workflows/ci-develop.yaml @@ -20,7 +20,7 @@ jobs: - name: Install HTMLHint run: npm install -g htmlhint - - name: Install Stylelint + - name: Install Stylelint and Config run: npm install -g stylelint stylelint-config-standard - name: Lint HTML files diff --git a/.stylelintrc.json b/.stylelintrc.json index 4c18a5e..e20b84e 100644 --- a/.stylelintrc.json +++ b/.stylelintrc.json @@ -3,10 +3,8 @@ "rules": { "declaration-block-no-duplicate-properties": true, "no-duplicate-selectors": true, - "property-case": "lower", "value-keyword-case": "lower", "selector-type-case": "lower", "block-no-empty": true } } - diff --git a/styles/home.css b/styles/home.css index 2ea0fdd..a5a7acf 100644 --- a/styles/home.css +++ b/styles/home.css @@ -9,4 +9,9 @@ header { background-color: #333; color: white; padding: 1rem; +} + +h1 { + color: #333; + font-size: 2rem; } \ No newline at end of file