Skip to content

Commit a9c7be5

Browse files
Introduce purs-tidy formatter (#25)
* Add purs-tidy formatter * Run purs-tidy
1 parent 92c05c8 commit a9c7be5

File tree

5 files changed

+70
-53
lines changed

5 files changed

+70
-53
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ jobs:
1515

1616
- name: Set up PureScript toolchain
1717
uses: purescript-contrib/setup-purescript@main
18+
with:
19+
purs-tidy: "latest"
1820

1921
- name: Cache PureScript dependencies
2022
uses: actions/cache@v2
@@ -25,9 +27,9 @@ jobs:
2527
output
2628
2729
- name: Set up Node toolchain
28-
uses: actions/setup-node@v1
30+
uses: actions/setup-node@v2
2931
with:
30-
node-version: "12.x"
32+
node-version: "14.x"
3133

3234
- name: Cache NPM dependencies
3335
uses: actions/cache@v2
@@ -49,3 +51,6 @@ jobs:
4951

5052
- name: Run tests
5153
run: npm run test
54+
55+
- name: Check formatting
56+
run: purs-tidy check src test

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
!.gitignore
33
!.github
44
!.editorconfig
5+
!.tidyrc.json
56
!.eslintrc.json
67

78
output

.tidyrc.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"importSort": "source",
3+
"importWrap": "source",
4+
"indent": 2,
5+
"operatorsFile": null,
6+
"ribbon": 1,
7+
"typeArrowPlacement": "first",
8+
"unicode": "never",
9+
"width": null
10+
}

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ New features:
1111
Bugfixes:
1212

1313
Other improvements:
14+
- Added `purs-tidy` formatter (#25 by @thomashoneyman)
1415

1516
## [v5.0.0](https://github.com/purescript-contrib/purescript-js-timers/releases/tag/v5.0.0) - 2021-02-26
1617

test/Main.purs

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,51 @@
1-
module Test.Main where
2-
3-
import Prelude
4-
5-
import Effect (Effect)
6-
import Effect.Console as C
7-
import Effect.Ref as R
8-
import Effect.Timer as T
9-
import Test.Assert (assert)
10-
11-
main :: Effect Unit
12-
main = do
13-
counter <- R.new 0
14-
15-
void $ T.setTimeout 10 do
16-
C.log "timeout increment counter"
17-
void $ R.modify (_ + 1) counter
18-
19-
void $ T.setTimeout 50 do
20-
C.log "timeout check counter"
21-
n <- R.read counter
22-
assert $ n == 1
23-
24-
void $ T.setTimeout 100 do
25-
26-
t <- T.setTimeout 20 do
27-
void $ R.modify (_ + 1) counter
28-
29-
T.clearTimeout t
30-
31-
void $ T.setTimeout 50 do
32-
C.log "check timeout never ran"
33-
n <- R.read counter
34-
assert $ n == 1
35-
36-
void $ T.setTimeout 200 do
37-
38-
i <- T.setInterval 20 do
39-
C.log "interval increment counter"
40-
void $ R.modify (_ + 1) counter
41-
42-
void $ T.setTimeout 90 do
43-
T.clearInterval i
44-
C.log "interval check counter"
45-
n <- R.read counter
46-
assert $ n == 5
47-
48-
void $ T.setTimeout 150 do
49-
C.log "check interval has stopped"
50-
n <- R.read counter
51-
assert $ n == 5
1+
module Test.Main where
2+
3+
import Prelude
4+
5+
import Effect (Effect)
6+
import Effect.Console as C
7+
import Effect.Ref as R
8+
import Effect.Timer as T
9+
import Test.Assert (assert)
10+
11+
main :: Effect Unit
12+
main = do
13+
counter <- R.new 0
14+
15+
void $ T.setTimeout 10 do
16+
C.log "timeout increment counter"
17+
void $ R.modify (_ + 1) counter
18+
19+
void $ T.setTimeout 50 do
20+
C.log "timeout check counter"
21+
n <- R.read counter
22+
assert $ n == 1
23+
24+
void $ T.setTimeout 100 do
25+
26+
t <- T.setTimeout 20 do
27+
void $ R.modify (_ + 1) counter
28+
29+
T.clearTimeout t
30+
31+
void $ T.setTimeout 50 do
32+
C.log "check timeout never ran"
33+
n <- R.read counter
34+
assert $ n == 1
35+
36+
void $ T.setTimeout 200 do
37+
38+
i <- T.setInterval 20 do
39+
C.log "interval increment counter"
40+
void $ R.modify (_ + 1) counter
41+
42+
void $ T.setTimeout 90 do
43+
T.clearInterval i
44+
C.log "interval check counter"
45+
n <- R.read counter
46+
assert $ n == 5
47+
48+
void $ T.setTimeout 150 do
49+
C.log "check interval has stopped"
50+
n <- R.read counter
51+
assert $ n == 5

0 commit comments

Comments
 (0)