From 011adf79ec795af29e06f393c9eb774a4b09cce4 Mon Sep 17 00:00:00 2001
From: Luiz F. A. de PrĂ¡ <rawarkanis@gmail.com>
Date: Tue, 17 Mar 2026 19:58:47 +0000
Subject: [PATCH] Install tooling

---
 prettier.config.js               |   14 +++++++
 .gitignore                       |    2 +
 .prettierignore                  |    5 ++
 Makefile                         |   12 +++++
 stylelint.config.js              |    9 ++++
 package.json                     |   20 ++++++++++
 .github/pull_request_template.md |    1 
 .editorconfig                    |   33 +++++++---------
 .pre-commit-config.yaml          |    9 ++++
 9 files changed, 85 insertions(+), 20 deletions(-)

diff --git a/.editorconfig b/.editorconfig
index 51c74a1..caa2e49 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -1,29 +1,24 @@
-# https://editorconfig.org
-
-# this file is the top-most editorconfig file
 root = true
 
-# all files
 [*]
 charset = utf-8
 end_of_line = lf
-indent_style = space
-indent_size = 4
 insert_final_newline = true
+indent_style = space
+indent_size = 2
 trim_trailing_whitespace = true
 
-# markdown files
-[*.md]
-insert_final_newline = false
-trim_trailing_whitespace = false
-
-# configuration files
-[*.toml]
-indent_size = 2
-
-# web files
-[*.{html,css,scss}]
-indent_size = 2
-
 [Makefile]
 indent_style = tab
+
+[*.md]
+trim_trailing_whitespace = false
+
+[*.scss]
+indent_size = 2
+
+[*.js]
+indent_size = 2
+
+[*.html]
+indent_size = 2
diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md
index f690988..4b674b4 100644
--- a/.github/pull_request_template.md
+++ b/.github/pull_request_template.md
@@ -26,6 +26,7 @@
 
 #### Resources
 
+- [ ] If you changed templates or styles, run `make format`
 - [ ] If you have changed any SCSS code, run `make release` to regenerate all CSS files
 
 #### Contributors
diff --git a/.gitignore b/.gitignore
index 2be26dd..c05bbaf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,4 +3,6 @@
 exampleSite/public/
 exampleSite/resources/
 *.lock
+package-lock.json
+node_modules
 public
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 0000000..4d40ab6
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,9 @@
+repos:
+  - repo: local
+    hooks:
+      - id: lint
+        name: npm run lint
+        entry: npm run lint
+        language: system
+        pass_filenames: false
+        always_run: true
diff --git a/.prettierignore b/.prettierignore
new file mode 100644
index 0000000..b6ffc60
--- /dev/null
+++ b/.prettierignore
@@ -0,0 +1,5 @@
+node_modules/
+resources/
+exampleSite/resources/
+assets/scss/font-awesome/
+layouts/_markup/render-heading.html
diff --git a/Makefile b/Makefile
index 8e0c3e4..c2e8cf1 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 HUGO_BIN=hugo
 
-.PHONY: build demo release
+.PHONY: build demo release lint format setup
 
 build:
 	$(HUGO_BIN) --themesDir=../.. --source=exampleSite
@@ -10,3 +10,13 @@
 
 release: build
 	rm -rf ./resources && cp -r ./exampleSite/resources ./resources
+
+setup:
+	npm install
+	prek install
+
+lint:
+	npm run lint
+
+format:
+	npm run format
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..a96e69a
--- /dev/null
+++ b/package.json
@@ -0,0 +1,20 @@
+{
+  "name": "hugo-coder",
+  "private": true,
+  "scripts": {
+    "lint:html": "prettier --check \"layouts/**/*.html\" \"exampleSite/**/*.html\"",
+    "lint:scss": "stylelint \"assets/scss/**/*.scss\"",
+    "lint": "npm run lint:html && npm run lint:scss",
+    "format:html": "prettier --write \"layouts/**/*.html\" \"exampleSite/**/*.html\"",
+    "format:scss": "stylelint --fix \"assets/scss/**/*.scss\"",
+    "format": "npm run format:html && npm run format:scss"
+  },
+  "devDependencies": {
+    "postcss-scss": "^4.0.9",
+    "prettier": "^3.3.3",
+    "prettier-plugin-go-template": "^0.0.15",
+    "stylelint": "^16.5.0",
+    "stylelint-config-standard-scss": "^13.0.0",
+    "stylelint-scss": "^6.5.0"
+  }
+}
diff --git a/prettier.config.js b/prettier.config.js
new file mode 100644
index 0000000..307626f
--- /dev/null
+++ b/prettier.config.js
@@ -0,0 +1,14 @@
+module.exports = {
+  plugins: ["prettier-plugin-go-template"],
+  printWidth: 100,
+  tabWidth: 2,
+  useTabs: false,
+  overrides: [
+    {
+      files: ["*.html"],
+      options: {
+        parser: "go-template"
+      }
+    }
+  ]
+};
diff --git a/stylelint.config.js b/stylelint.config.js
new file mode 100644
index 0000000..923da2b
--- /dev/null
+++ b/stylelint.config.js
@@ -0,0 +1,9 @@
+module.exports = {
+  extends: ["stylelint-config-standard-scss"],
+  customSyntax: "postcss-scss",
+  ignoreFiles: [
+    "assets/scss/font-awesome/**/*.scss",
+    "resources/**/*.scss",
+    "exampleSite/resources/**/*.scss"
+  ]
+};

--
Gitblit v1.10.0