Skip to content
This repository was archived by the owner on Jun 2, 2024. It is now read-only.

Commit 7704f2a

Browse files
committed
feat: increase test coverage and simplify docs
Increase test coverage back to 100% and simplify documentation. Add all relevant filetypes to prettier whitelist. Add better types to some utility functions.
1 parent cfc79f8 commit 7704f2a

26 files changed

+135
-194
lines changed
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
2-
"parser": "typescript",
32
"bracketSpacing": true,
43
"jsxBracketSameLine": false,
54
"printWidth": 89,
@@ -8,4 +7,4 @@
87
"tabWidth": 2,
98
"trailingComma": "all",
109
"useTabs": false
11-
}
10+
}

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
language: node_js
22

33
node_js:
4-
- "node"
4+
- 'node'
55

66
notifications:
77
email: false
@@ -10,7 +10,7 @@ branches:
1010
only:
1111
- master
1212
- /^greenkeeper.*$/
13-
13+
1414
before_install:
1515
- npm install -g npm@latest
1616
- npm install -g greenkeeper-lockfile
@@ -27,6 +27,6 @@ script:
2727

2828
after_success:
2929
- npm run report-coverage
30-
30+
3131
after_script:
3232
- greenkeeper-lockfile-upload

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
* __[List](https://csvenke.github.io/react-semantic-render/#/List)__: Renders content from an array of data.
4444
* __[Show](https://csvenke.github.io/react-semantic-render/#/Show)__: Renders content when specified condition is true.
4545
* __[Switch](https://csvenke.github.io/react-semantic-render/#/Switch)__: Renders content from first __[Switch.Case](https://csvenke.github.io/react-semantic-render/#/SwitchCase)__ that matches, else __[Switch.Default](https://csvenke.github.io/react-semantic-render/#/SwitchDefault)__ if it exists.
46-
* __Small bundle size__
46+
* __Tiny bundle size__
4747
* __Blazing fast__
4848
* __TypeScript type definitions__
4949
* __100% test coverage__

jest.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ module.exports = {
1717
collectCoverageFrom: ['src/@(components|utils)/**/*.@(ts|tsx)'],
1818
globals: {
1919
'ts-jest': {
20-
'tsConfig': './tsconfig.jest.json',
21-
'isolatedModules': 'true'
20+
tsConfig: './tsconfig.jest.json',
21+
isolatedModules: 'true',
2222
},
2323
},
2424
};

package-lock.json

Lines changed: 8 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
"husky": "^1.0.1",
5757
"jest": "^23.6.0",
5858
"lint-staged": "^7.3.0",
59+
"lodash": "^4.17.11",
5960
"prettier": "^1.14.3",
6061
"react-docgen-typescript": "^1.9.1",
6162
"react-dom": "^16.5.2",
@@ -90,8 +91,8 @@
9091
"lint:fix": "npm run lint:write --fix \"src/**/*.{ts,tsx}\"",
9192
"lint:write": "tslint -p tsconfig.json -c tslint.json",
9293
"lint": "npm run lint:write \"src/**/*.{ts,tsx}\"",
93-
"prettier:write": "prettier -c .prettierrc --write",
94-
"prettier": "npm run prettier:write \"src/**/*.{ts,tsx}\"",
94+
"prettier:write": "prettier -c .prettierrc.json --write",
95+
"prettier": "npm run prettier:write \"src/**/*.{ts,tsx,md}\" \"*.{js,yml,json}\"",
9596
"report-coverage": "cat ./coverage/lcov.info | coveralls",
9697
"test:prod": "npm run lint && npm run test --coverage --no-cache",
9798
"test:watch": "jest --watch",
@@ -107,9 +108,13 @@
107108
},
108109
"lint-staged": {
109110
"*.{ts,tsx}": [
110-
"prettier -c .prettierrc --write",
111+
"prettier -c .prettierrc.json --write",
111112
"tslint -c tslint.json --fix",
112113
"git add"
114+
],
115+
"*.{js,yml,json}": [
116+
"prettier -c .prettierrc.json --write",
117+
"git add"
113118
]
114119
}
115120
}

src/components/List/List.md

Lines changed: 0 additions & 41 deletions
This file was deleted.

src/components/List/List.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const List = (props: IListProps): Output => {
2222
const { items, children, render } = props;
2323
const renderProp = getRenderProp(children, render);
2424

25-
if (renderProp && isFunction(renderProp)) {
25+
if (!!renderProp && isFunction(renderProp)) {
2626
return <React.Fragment>{items.map(renderProp)}</React.Fragment>;
2727
}
2828

src/components/List/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
### Example usage
2+
3+
```jsx
4+
const data = _.range(10).map(() => faker.name.findName());
5+
6+
<ul>
7+
<List
8+
items={data}
9+
render={i => (
10+
<li key={i}>
11+
<div>{i}</div>
12+
</li>
13+
)}
14+
/>
15+
</ul>;
16+
```

src/components/Show/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
### Example usage
2+
3+
```jsx
4+
<Show
5+
when={true}
6+
render={() => (
7+
<div>Render me!</div>
8+
)}
9+
/>
10+
11+
<Show when={false}>
12+
<div>Don't render me!</div>
13+
</Show>
14+
```

0 commit comments

Comments
 (0)