Skip to content

Commit

Permalink
Switch to my eslint config
Browse files Browse the repository at this point in the history
  • Loading branch information
zacanger committed Apr 21, 2018
1 parent a4e8604 commit 5e73d1e
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 24 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"extends": [ "eslint-config-jane", "plugin:flowtype/recommended" ],
"extends": [ "eslint-config-zacanger", "plugin:flowtype/recommended" ],
"plugins": [ "babel", "flowtype", "flowtype-errors" ],
"parser": "babel-eslint",
"rules": {
"func-style": 0,
"flowtype-errors/show-errors": [ 1 ],
"flowtype/boolean-style": [ 1, "bool" ],
"flowtype/no-weak-types": [ 1 ],
Expand Down
26 changes: 13 additions & 13 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"babel-tape-runner": "2.0.1",
"documentation": "6.1.0",
"eslint": "4.19.1",
"eslint-config-jane": "1.2.1",
"eslint-config-zacanger": "3.1.0",
"eslint-plugin-babel": "5.0.0",
"eslint-plugin-flowtype": "2.46.1",
"eslint-plugin-flowtype-errors": "3.5.1",
Expand Down
3 changes: 2 additions & 1 deletion src/cons.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* cons(1, [ 2, 3, 4 ]) // => [ 1, 2, 3, 4 ]
*/

const cons = (el: *, arr: *[]): *[] => [el, ...arr]
const cons = (el: *, arr: *[]): *[] =>
[ el, ...arr ]

export default cons
2 changes: 1 addition & 1 deletion src/flat-map.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ test('flatMap', (t): void => {
{ name: 'Zacary', nicks: [ 'Zac', 'Zac Anger' ] },
{ name: 'Foo', nicks: [ 'Baz', 'Bar' ] }
]
const f = (a) => [a.name].concat(a.nicks)
const f = (a) => [ a.name ].concat(a.nicks)
const e = [ 'Zacary', 'Zac', 'Zac Anger', 'Foo', 'Baz', 'Bar' ]

t.deepEqual(flatMap(f, ns), e, 'works')
Expand Down
2 changes: 1 addition & 1 deletion src/intersection.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
*/

const intersection = <T>(xs: T[], ys: T[]): T[] =>
[...new Set(xs.filter((el) => ys.includes(el)))]
[ ...new Set(xs.filter((el) => ys.includes(el))) ]

export default intersection
2 changes: 1 addition & 1 deletion src/intersection.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ import intersection from './intersection'
test('intersection', (t): void => {
t.deepEqual(intersection([], [ 1, 2 ]), [], 'returns empty array if either is empty')
t.deepEqual(intersection([ 3, 4 ], [ 1, 2 ]), [], 'returns empty array if no matches')
t.deepEqual(intersection([ 1 ], [ 1, 2 ]), [1], 'returns intersection otherwise')
t.deepEqual(intersection([ 1 ], [ 1, 2 ]), [ 1 ], 'returns intersection otherwise')
t.end()
})
2 changes: 1 addition & 1 deletion src/is-localhost.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
const isLocalhost = (): bool => {
const h = window && window.location && window.location.hostname
return !!(
[ 'localhost', '[::1]'].includes(h) ||
[ 'localhost', '[::1]' ].includes(h) ||
h.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/)
)
}
Expand Down
2 changes: 1 addition & 1 deletion src/is-number.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ test('isNumber', (t): void => {
const f = (): number => 2
t.false(isNumber('2'), 'returns false for string')
t.false(isNumber({ one: 2 }), 'returns false for obj')
t.false(isNumber([2]), 'returns false for arr')
t.false(isNumber([ 2 ]), 'returns false for arr')
t.true(isNumber(2), 'returns true for int')
t.true(isNumber(2.22), 'returns true for float')
t.true(isNumber(f()), 'returns true for fn that returns number')
Expand Down
2 changes: 1 addition & 1 deletion src/open.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { execFile } from 'child_process'
* open('http://zacanger.com')
*/

// eslint-disable-next-line flowtype/no-weak-types
// eslint-disable-next-line flowtype/no-weak-types, camelcase
const open = (args: string, opts: Object, cb: Function): child_process$ChildProcess => {
const as: string[] = [ args ]
const cmd: string = process.platform === 'win32'
Expand Down
2 changes: 1 addition & 1 deletion src/take.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import test from 'tape'
import take from './take'

test('take', (t): void => {
t.deepEqual(take(2, [1, 2, 3]), [ 1, 2 ], 'works')
t.deepEqual(take(2, [ 1, 2, 3 ]), [ 1, 2 ], 'works')
t.deepEqual(take(2, [ 0 ]), [ 0 ], 'returns arr if n is greater than arr length')
t.end()
})
2 changes: 1 addition & 1 deletion src/zip-3.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ import zipWith3 from './zip-with-3'
*/

const zip3 = <A, B, C>(xs: A[], ys: B[], zs: C[]): [A, B, C][] =>
zipWith3((x, y, z) => [x, y, z], xs, ys, zs)
zipWith3((x, y, z) => [ x, y, z ], xs, ys, zs)

export default zip3

0 comments on commit 5e73d1e

Please sign in to comment.