Skip to content

Commit

Permalink
add linting for the READMEs (#170)
Browse files Browse the repository at this point in the history
  • Loading branch information
evilsoft authored Dec 25, 2017
1 parent 7ba53ad commit c110fff
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
node_modules
build
coverage

README.md
!src/**/README.md
3 changes: 3 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ module.exports = {
"parserOptions": {
"sourceType": "module"
},
"plugins": [
'markdown'
],
"rules": {
"array-bracket-spacing": [ "error", "always" ],
"arrow-spacing": [ "error" ],
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"build:publish": "npm test && ./bin/publish",
"build:dist": "webpack && uglifyjs build/dist/crocks.js -c \"warnings=false\" -m -o build/dist/crocks.min.js",
"build": "rm -rf build && buble -i src -o build && npm run build:dist",
"lint": "eslint .",
"lint": "eslint --ext .md,.js .",
"spec:coverage": "nyc npm run spec:build",
"spec:dev": "nodemon -q -e js -w src -x 'npm run spec:src -s | tap-spec'",
"spec:build": "npm run build && tape build/**/*.spec.js build/*.spec.js",
Expand Down Expand Up @@ -51,6 +51,7 @@
"buble": "^0.18.0",
"coveralls": "^3.0.0",
"eslint": "^4.13.1",
"eslint-plugin-markdown": "^1.0.0-beta.6",
"nodemon": "^1.9.2",
"nyc": "^11.4.1",
"sinon": "^4.1.3",
Expand Down
9 changes: 9 additions & 0 deletions src/All/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ conjunction (AND) on their coerced `Boolean` values, mapping truth-y values to

```js
const All = require('crocks/All')

const mconcat = require('crocks/helpers/mconcat')

const trueNum = All(13)
Expand Down Expand Up @@ -46,6 +47,8 @@ the case of `All` the result of `empty` is `true`. `empty` is available on both
the Constructor and the Instance for convenience.

```js
const All = require('crocks/All')

All.empty() //=> All true

All(true).concat(All.empty()) //=> All true
Expand All @@ -67,6 +70,8 @@ the boilerplate. `type` is available on both the Constructor and the Instance
for convenience.

```js
const All = require('crocks/All')

const Maybe = require('crocks/Maybe')
const isSameType = require('crocks/predicates/isSameType')

Expand All @@ -90,6 +95,8 @@ specified by the `Semigroup`. In the case of `All`, it will combine the two
using logical AND (conjunction).

```js
const All = require('crocks/All')

All(true).concat(All(true)) //=> All true
All(true).concat(All(false)) //=> All false
All(false).concat(All(true)) //=> All false
Expand All @@ -108,6 +115,8 @@ helper functions that ship with `crocks`. Calling `valueOf` on an `All` instance
will result in the underlying `Boolean` value.

```js
const All = require('crocks/All')

All(0).value() //=> false
All('string').valueOf() //=> true

Expand Down
13 changes: 11 additions & 2 deletions src/Any/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ disjunction (OR) on their coerced `Boolean` values, mapping truth-y values to

```js
const Any = require('crocks/Any')

const isNumber = require('crocks/predicates/isNumber')
const mconcatMap = require('crocks/helpers/mconcat')

Expand Down Expand Up @@ -47,6 +48,8 @@ the case of `Any` the result of `empty` is `false`. `empty` is available on both
the Constructor and the Instance for convenience.

```js
const Any = require('crocks/Any')

Any.empty() //=> Any false

Any(true).concat(Any.empty()) //=> Any true
Expand All @@ -68,6 +71,8 @@ the boilerplate. `type` is available on both the Constructor and the Instance
for convenience.

```js
const Any = require('crocks/Any')

const Assign = require('crocks/Assign')
const isSameType = require('crocks/predicates/isSameType')

Expand All @@ -93,6 +98,8 @@ specified by the `Semigroup`. In the case of `Any`, it will combine the two
using logical OR (disjunction).

```js
const Any = require('crocks/Any')

Any(true).concat(Any(true)) //=> Any true
Any(true).concat(Any(false)) //=> Any true
Any(false).concat(Any(true)) //=> Any true
Expand All @@ -111,11 +118,13 @@ helper functions that ship with `crocks`. Calling `value` on an `Any` instance
will result in the underlying `Boolean` value.

```js
const Any = require('crocks/Any')

Any(0).valueOf() //=> false
Any('string').valueOf() //=> true

//=> true
Any(45)
.concat('')
.valueOf()
.concat('')
.valueOf()
```
2 changes: 1 addition & 1 deletion src/Arrow/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ Arrow.type() //=> "Arrow"

isSameType(Arrow, Arrow(x => x + 3)) //=> true
isSameType(Arrow, Arrow) //=> true
isSameType(Arrow, Idenity(0)) //=> false
isSameType(Arrow, Identity(0)) //=> false
isSameType(Arrow(I), Identity) //=> false
```

Expand Down
7 changes: 7 additions & 0 deletions src/Equiv/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ comparison.

```js
const Equiv = require('crocks/Equiv')

const equals = require('crocks/pointfree/equals')

// toString :: a -> String
Expand Down Expand Up @@ -62,6 +63,7 @@ convenience.

```js
const Equiv = require('crocks/Equiv')

const equals = require('crocks/pointfree/equals')

const eq =
Expand Down Expand Up @@ -100,6 +102,8 @@ the boilerplate. `type` is available on both the Constructor and the Instance
for convenience.

```js
const Equiv = require('crocks/Equiv')

const Endo = require('crocks/Endo')
const equals = require('crocks/pointfree/equals')
const isSameType = require('crocks/predicates/isSameType')
Expand All @@ -125,6 +129,7 @@ specified by the `Semigroup`. In the case of `Equiv`, the results of both

```js
const Equiv = require('crocks/Equiv')

const compareWith = require('crocks/pointfree/compareWith')
const equals = require('crocks/pointfree/equals')
const isSameType = require('crocks/predicates/isSameType')
Expand Down Expand Up @@ -195,6 +200,7 @@ function.

```js
const Equiv = require('crocks/Equiv')

const equals = require('crocks/pointfree/equals')

// length :: String -> Number
Expand Down Expand Up @@ -243,6 +249,7 @@ instance will result in the underlying curried equivalence function.

```js
const Equiv = require('crocks/Equiv')

const compose = require('crocks/helpers/compose')
const equals = require('crocks/pointfree/equals')
const propOr = require('crocks/helpers/propOr')
Expand Down
4 changes: 2 additions & 2 deletions src/Pred/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ const empty =
const notEmpty =
Pred(not(isEmpty))

empty
.runWith('')
empty
.runWith('')
//=> true

notEmpty
Expand Down
7 changes: 4 additions & 3 deletions src/Reader/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ Reader.type() //=> 'Reader'

isSameType(Reader, Reader.of(76)) //=> true
isSameType(Reader, Reader) //=> true
isSameType(Reader, Idenity(0)) //=> false
isSameType(Reader, Identity(0)) //=> false
isSameType(Reader(I), Identity) //=> false
```

Expand Down Expand Up @@ -192,7 +192,7 @@ const lengthObj =

// addLength :: Object -> Redaer Array Object
const addLength = x =>
ask(propOr('list', []))
ask(propOr('list', []))
.map(B(assign(x), lengthObj))

Reader.of({ num: 27 })
Expand Down Expand Up @@ -454,6 +454,7 @@ the form of `a -> m b` into a function that can be `chain`ed with the `ReaderT`.
Although, [`liftFn`](#liftfn) can be used to remove the composition boilerplate
and promote and `a -> m b` function.

<!-- eslint-disable no-console -->
```js
const ReaderT = require('crocks/Reader/ReaderT')
const Async = require('crocks/Async')
Expand Down Expand Up @@ -629,7 +630,7 @@ envToUpper
//=> Nothing

envToUpper
.runWith("hola")
.runWith('hola')
//=> Just "HOLA"

```
Expand Down

0 comments on commit c110fff

Please sign in to comment.