Skip to content

Commit

Permalink
Feat/add formatting git hook (#77)
Browse files Browse the repository at this point in the history
* added few new devdependencies

* added husky and precommit hook

* updated hook
  • Loading branch information
teezzan authored Jan 22, 2022
1 parent 006af82 commit 5e40d76
Show file tree
Hide file tree
Showing 7 changed files with 133 additions and 13 deletions.
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

elm-format --yes . && git add -A .
109 changes: 109 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,20 @@
"build:dev:elm": "elm make src/Main.elm --debug --output=public/dist/elm.compiled.js || true",
"build:elm-spa": "elm-spa build .",
"dev:elm": "elm-live src/Main.elm -u -d public -- --debug --output=public/dist/elm.compiled.js",
"dev:elm-spa": "chokidar src/Pages -c \"elm-spa build .\""
"dev:elm-spa": "chokidar src/Pages -c \"elm-spa build .\"",
"prepare": "husky install"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"chokidar-cli": "2.1.0",
"elm": "0.19.1-3",
"elm-format": "^0.8.5",
"elm-live": "4.0.2",
"elm-spa": "5.0.3",
"elm-test": "0.19.1-revision2",
"husky": "^7.0.0",
"npm-run-all": "4.1.5"
}
}
8 changes: 5 additions & 3 deletions src/Game.elm
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ module Game exposing
, Model(..)
, Msg(..)
, Player(..)
, Turn(..)
, StatusMessage(..)
, Turn(..)
, currentStatus
, currentStatusMessage
, gameboard
, init
, nameToString
, pieceToString
, playerToString
, remainingPieces
, currentStatusMessage
, update
)

Expand Down Expand Up @@ -70,6 +70,7 @@ type GameStatus
| Won Winner
| Draw


type StatusMessage
= NoMessage
| SomePiecePlayedWhenNotPlayersTurn
Expand All @@ -89,7 +90,8 @@ initStatus =


initStatusMessage : StatusMessage
initStatusMessage = NoMessage
initStatusMessage =
NoMessage


init : Model
Expand Down
2 changes: 1 addition & 1 deletion src/Pages/Top.elm
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import Element
, spacing
, text
, width

)
import Element.Background as Background
import Element.Border as Border
Expand Down Expand Up @@ -260,6 +259,7 @@ viewRestartButton gamemodel =
in
if gamemodel /= Game.init then
button

else
Element.none

Expand Down
6 changes: 4 additions & 2 deletions tests/ProgramTests.elm
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
module ProgramTests exposing (tbd)

tbd: String
tbd = "To Be Determined"

tbd : String
tbd =
"To Be Determined"
12 changes: 6 additions & 6 deletions tests/TestGameLogic.elm
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ module TestGameLogic exposing (suite)
import Expect
import Test exposing (Test, describe, test)


suite : Test
suite =
describe "Dummy Default Test"
[
test "the empty list has 0 length"
<| \_ -> Expect.equal 0
<| List.length []
]

[ test "the empty list has 0 length" <|
\_ ->
Expect.equal 0 <|
List.length []
]

0 comments on commit 5e40d76

Please sign in to comment.