Skip to content

Commit

Permalink
add a bunch of review rules and conform to them
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianHicks committed May 13, 2020
1 parent eeb9d70 commit 94b65cd
Show file tree
Hide file tree
Showing 9 changed files with 738 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .gitignore
@@ -1,6 +1,6 @@
/.cache
/data
/dist
/elm-stuff
/log.txt
/node_modules
elm-stuff
652 changes: 652 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Expand Up @@ -16,6 +16,7 @@
"devDependencies": {
"elm-format": "^0.8.3",
"elm-hot": "^1.1.4",
"elm-review": "^2.0.2",
"node-elm-compiler": "^5.0.4",
"parcel-bundler": "^1.12.4",
"pouchdb-server": "^4.2.0",
Expand Down
37 changes: 37 additions & 0 deletions review/elm.json
@@ -0,0 +1,37 @@
{
"type": "application",
"source-directories": [
"src"
],
"elm-version": "0.19.1",
"dependencies": {
"direct": {
"elm/core": "1.0.5",
"elm/json": "1.1.3",
"elm/project-metadata-utils": "1.0.1",
"jfmengels/elm-review": "2.0.1",
"jfmengels/review-common": "1.0.0",
"stil4m/elm-syntax": "7.1.1"
},
"indirect": {
"elm/html": "1.0.0",
"elm/parser": "1.1.0",
"elm/random": "1.0.0",
"elm/time": "1.0.0",
"elm/url": "1.0.0",
"elm/virtual-dom": "1.0.2",
"elm-community/json-extra": "4.2.0",
"elm-community/list-extra": "8.2.4",
"elm-explorations/test": "1.2.2",
"rtfeldman/elm-hex": "1.0.0",
"rtfeldman/elm-iso8601-date-strings": "1.1.3",
"stil4m/structured-writer": "1.0.2"
}
},
"test-dependencies": {
"direct": {
"elm-explorations/test": "1.2.2"
},
"indirect": {}
}
}
32 changes: 32 additions & 0 deletions review/src/ReviewConfig.elm
@@ -0,0 +1,32 @@
module ReviewConfig exposing (config)

{-| Do not rename the ReviewConfig module or the config function, because
`elm-review` will look for these.
To add packages that contain rules, add them to this review project using
`elm install author/packagename`
when inside the directory containing this file.
TODO:
- jfmengels/review-debug
- sparksp/elm-review-ports
-}

import NoExposingEverything
import NoImportingEverything
import NoMissingTypeAnnotation
import Review.Rule exposing (Rule)


config : List Rule
config =
[ NoExposingEverything.rule
|> Review.Rule.ignoreErrorsForDirectories [ "tests/" ]
, NoImportingEverything.rule []
|> Review.Rule.ignoreErrorsForDirectories [ "tests/" ]
, NoMissingTypeAnnotation.rule
]
2 changes: 1 addition & 1 deletion src/Main.elm
@@ -1,4 +1,4 @@
port module Main exposing (..)
port module Main exposing (Effect(..), Model, Msg(..), init, main, update, view)

import Accessibility.Styled as Html exposing (Attribute, Html)
import Accessibility.Styled.Style exposing (invisible)
Expand Down
17 changes: 9 additions & 8 deletions src/Route.elm
@@ -1,11 +1,11 @@
module Route exposing (..)
module Route exposing (Route(..), parse, toString)

import Content exposing (Content)
import Database
import Database.ID as ID exposing (ID)
import Url exposing (Url)
import Url.Builder as Builder
import Url.Parser as Parser exposing (..)
import Url.Parser as Parser exposing ((</>), Parser, s, top)


type Route
Expand Down Expand Up @@ -36,19 +36,20 @@ parse url =
Maybe.withDefault NotFound (Parser.parse parser url)


parser : Parser (Route -> a) a
parser =
oneOf
[ map Root top
, map NodeById (s "node" </> id)
, map NodeByTitle (s "node" </> content)
Parser.oneOf
[ Parser.map Root top
, Parser.map NodeById (s "node" </> id)
, Parser.map NodeByTitle (s "node" </> content)
]


id : Parser (ID -> a) a
id =
custom "ID" (ID.fromString >> Result.toMaybe)
Parser.custom "ID" (ID.fromString >> Result.toMaybe)


content : Parser (Content -> a) a
content =
custom "CONTENT" (Url.percentDecode >> Maybe.andThen (Content.fromString >> Result.toMaybe))
Parser.custom "CONTENT" (Url.percentDecode >> Maybe.andThen (Content.fromString >> Result.toMaybe))
2 changes: 1 addition & 1 deletion src/Widgets/Text.elm
@@ -1,4 +1,4 @@
module Widgets.Text exposing (..)
module Widgets.Text exposing (h1, text)

import Css exposing (Style)
import Widgets.Colors as Colors
Expand Down
6 changes: 4 additions & 2 deletions tests/DatabaseTest.elm
Expand Up @@ -3,9 +3,9 @@ module DatabaseTest exposing (..)
import Array
import Content exposing (Content)
import Database exposing (..)
import Database.ID as ID
import Database.ID as ID exposing (ID)
import Expect
import Node
import Node exposing (Node)
import Random
import Test exposing (..)
import Time
Expand Down Expand Up @@ -456,9 +456,11 @@ plainContent string =
Content.fromList [ Content.text string ]


insert_ : Node -> Database -> ( Row, Database )
insert_ =
insert (Time.millisToPosix 0)


update_ : ID -> (Node -> Node) -> Database -> Database
update_ =
update (Time.millisToPosix 1)

0 comments on commit 94b65cd

Please sign in to comment.