Skip to content

Commit

Permalink
chore: setup pre-commit linting
Browse files Browse the repository at this point in the history
  • Loading branch information
derrabauke committed Dec 20, 2023
1 parent 8342a83 commit 5485ca6
Show file tree
Hide file tree
Showing 5 changed files with 9,486 additions and 3,949 deletions.
8 changes: 8 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env sh
. "$(dirname "$0")/_/husky.sh"

# skip in CI
[ -n "$CI" ] && exit 0

# lint commit message
pnpm commitlint --edit "$1"
8 changes: 8 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

# skip in CI
[ -n "$CI" ] && exit 0

# lint staged files
pnpm lint-staged
6 changes: 6 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,15 @@

## Linting

Automatic linting via `husky` _pre-commit_ is setup. For manual linting use:

- `pnpm lint`
- `pnpm lint:fix`

## Formatting

Please stick to [conventional commit](https://www.conventionalcommits.org/en/v1.0.0/) messages to make our semantic release versioning work.

## Running tests

- `ember test` – Runs the test suite on the current Ember version
Expand Down
13 changes: 12 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"start": "ember serve",
"test": "concurrently \"npm:lint\" \"npm:test:*\" --names \"lint,test:\"",
"test:ember": "ember test",
"test:ember-compatibility": "ember try:each"
"test:ember-compatibility": "ember try:each",
"prepare": "husky install"
},
"dependencies": {
"@apollo/client": "^3.8.8",
Expand All @@ -46,6 +47,8 @@
"@adfinis/semantic-release-config": "4.1.0",
"@babel/eslint-parser": "7.23.3",
"@babel/plugin-proposal-decorators": "7.23.5",
"@commitlint/cli": "^18.4.3",
"@commitlint/config-conventional": "^18.4.3",
"@ember/optional-features": "2.0.0",
"@ember/string": "3.1.1",
"@ember/test-helpers": "3.2.1",
Expand Down Expand Up @@ -79,6 +82,8 @@
"eslint-plugin-qunit": "8.0.1",
"graphql": "16.8.1",
"graphql-tag": "2.12.6",
"husky": "^8.0.0",
"lint-staged": "^15.2.0",
"loader.js": "4.7.0",
"miragejs": "0.1.48",
"prettier": "3.1.0",
Expand Down Expand Up @@ -111,5 +116,11 @@
"extends": [
"@commitlint/config-conventional"
]
},
"lint-staged": {
"*.js": "eslint --cache --fix",
"*.hbs": "ember-template-lint --fix",
"*.scss": "stylelint --fix",
"*.{graphql,json,md,yaml}": "prettier --write"
}
}
Loading

0 comments on commit 5485ca6

Please sign in to comment.