diff --git a/.editorconfig b/.editorconfig index b901702..34b2953 100644 --- a/.editorconfig +++ b/.editorconfig @@ -12,6 +12,7 @@ charset = utf-8 [{*.py,*.js,*.vue,*.css,*.scss,*.html}] indent_style = tab indent_size = 4 +tab_width = 4 max_line_length = 99 # JSON files - mostly doctype schema files diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b429878..fb8d508 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,15 +1,18 @@ -exclude: 'node_modules|.git' +exclude: '(^|/)(node_modules|\\.git)(/|$)' default_stages: [pre-commit] +default_install_hook_types: [pre-commit, commit-msg] fail_fast: false repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v5.0.0 + rev: v6.0.0 hooks: - id: trailing-whitespace files: "one_lms.*" exclude: ".*json$|.*txt$|.*csv|.*md|.*svg" + - id: no-commit-to-branch + args: ['--branch', 'staging', '--branch', 'test-production', '--branch', 'version-15'] - id: check-merge-conflict - id: check-ast - id: check-json @@ -18,7 +21,7 @@ repos: - id: debug-statements - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.8.1 + rev: v0.14.10 hooks: - id: ruff name: "Run ruff import sorter" @@ -63,6 +66,13 @@ repos: one_lms/public/js/lib/.* )$ + - repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook + rev: v9.23.0 + hooks: + - id: commitlint + stages: [commit-msg] + additional_dependencies: ['conventional-changelog-conventionalcommits'] + ci: autoupdate_schedule: weekly skip: [] diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..f43658d --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,35 @@ +# AGENTS.md + +This repository hosts the `one_lms` Frappe app. + +## Commit Format + +All commits must use conventional commit titles so `commitlint.config.js`, the +commit-msg pre-commit hook, and CI linting can validate them. + +Use this format: + +```text +(): +``` + +Allowed types are: + +- `build` +- `chore` +- `ci` +- `docs` +- `feat` +- `fix` +- `perf` +- `refactor` +- `revert` +- `style` +- `test` +- `deprecate` + +For sprint work, use the work item ID as the scope: + +```text +chore(WI-000795): align commitlint with Frappe +``` diff --git a/commitlint.config.js b/commitlint.config.js new file mode 100644 index 0000000..7730163 --- /dev/null +++ b/commitlint.config.js @@ -0,0 +1,26 @@ +module.exports = { + parserPreset: "conventional-changelog-conventionalcommits", + rules: { + "subject-empty": [2, "never"], + "type-case": [2, "always", "lower-case"], + "type-empty": [2, "never"], + "type-enum": [ + 2, + "always", + [ + "build", + "chore", + "ci", + "docs", + "feat", + "fix", + "perf", + "refactor", + "revert", + "style", + "test", + "deprecate", + ], + ], + }, +}; diff --git a/package.json b/package.json new file mode 100644 index 0000000..1c888f2 --- /dev/null +++ b/package.json @@ -0,0 +1,10 @@ +{ + "name": "one_lms", + "version": "15.0.0", + "private": true, + "devDependencies": { + "@commitlint/cli": "^19.0.0", + "@commitlint/config-conventional": "^19.0.0", + "conventional-changelog-conventionalcommits": "^7.0.0" + } +}