Skip to content

Commit 3ee6f00

Browse files
authored
Upgrade to father (#193)
* 📦 rc-tools => father * fix eslint
1 parent 754cd1a commit 3ee6f00

File tree

16 files changed

+173
-163
lines changed

16 files changed

+173
-163
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.eslintrc.js

.eslintrc.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const base = require('@umijs/fabric/dist/eslint');
2+
3+
module.exports = {
4+
...base,
5+
rules: {
6+
...base.rules,
7+
'no-template-curly-in-string': 0,
8+
'prefer-promise-reject-errors': 0,
9+
'react/no-array-index-key': 0,
10+
'react/sort-comp': 0,
11+
'import/no-named-as-default': 0,
12+
'import/no-named-as-default-member': 0,
13+
'jsx-a11y/no-autofocus': 0,
14+
},
15+
};

.fatherrc.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export default {
2+
entry: ['src/index.js'],
3+
cjs: 'babel',
4+
esm: { type: 'babel', importLibToEs: true },
5+
doc: { base: '/checkbox' },
6+
preCommit: {
7+
eslint: true,
8+
prettier: true,
9+
},
10+
runtimeHelpers: true,
11+
};

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.storybook
12
*.iml
23
*.log
34
*.log.*

.npmignore

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
build/
2+
*.cfg
3+
nohup.out
4+
*.iml
5+
.idea/
6+
.ipr
7+
.iws
8+
*~
9+
~*
10+
*.diff
11+
*.log
12+
*.patch
13+
*.bak
14+
.DS_Store
15+
Thumbs.db
16+
.project
17+
.*proj
18+
.svn/
19+
*.swp
20+
out/
21+
.build
22+
node_modules
23+
.cache
24+
examples
25+
tests
26+
src
27+
/index.js
28+
.*
29+
assets/**/*.less

.prettierrc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"endOfLine": "lf",
3+
"semi": true,
4+
"singleQuote": true,
5+
"tabWidth": 2,
6+
"trailingComma": "all",
7+
"printWidth": 100
8+
}

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ language: node_js
33
sudo: false
44

55
node_js:
6-
- 10
6+
- 12
77

88
script:
99
- |

README.md

Lines changed: 70 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,33 @@
11
# rc-checkbox
2+
23
---
34

4-
React Checkbox component.
5+
Checkbox ui component for react.
56

67
[![NPM version][npm-image]][npm-url]
7-
[![npm download][download-image]][download-url]
88
[![build status][travis-image]][travis-url]
9-
[![Test coverage][codecov-image]][codecov-url]
10-
[![Dependencies](https://img.shields.io/david/react-component/checkbox.svg?style=flat-square)](https://david-dm.org/react-component/checkbox)
11-
[![DevDependencies](https://img.shields.io/david/dev/react-component/checkbox.svg?style=flat-square)](https://david-dm.org/react-component/checkbox?type=dev)
9+
[![Test coverage][coveralls-image]][coveralls-url]
10+
[![Dependencies][david-image]][david-url]
11+
[![DevDependencies][david-dev-image]][david-dev-url]
12+
[![npm download][download-image]][download-url]
13+
[![bundle size][bundlephobia-image]][bundlephobia-url]
1214

1315
[npm-image]: http://img.shields.io/npm/v/rc-checkbox.svg?style=flat-square
1416
[npm-url]: http://npmjs.org/package/rc-checkbox
15-
[travis-image]: https://img.shields.io/travis/react-component/checkbox/master.svg?style=flat-square
17+
[travis-image]: https://img.shields.io/travis/react-component/checkbox/master?style=flat-square
1618
[travis-url]: https://travis-ci.org/react-component/checkbox
17-
[codecov-image]: https://img.shields.io/codecov/c/github/react-component/checkbox.svg?style=flat-square
18-
[codecov-url]: https://codecov.io/gh/react-component/checkbox
19+
[circleci-image]: https://img.shields.io/circleci/react-component/checkbox/master?style=flat-square
20+
[circleci-url]: https://circleci.com/gh/react-component/checkbox
21+
[coveralls-image]: https://img.shields.io/coveralls/react-component/checkbox.svg?style=flat-square
22+
[coveralls-url]: https://coveralls.io/r/react-component/checkbox?branch=master
23+
[david-url]: https://david-dm.org/react-component/checkbox
24+
[david-image]: https://david-dm.org/react-component/checkbox/status.svg?style=flat-square
25+
[david-dev-url]: https://david-dm.org/react-component/checkbox?type=dev
26+
[david-dev-image]: https://david-dm.org/react-component/checkbox/dev-status.svg?style=flat-square
1927
[download-image]: https://img.shields.io/npm/dm/rc-checkbox.svg?style=flat-square
2028
[download-url]: https://npmjs.org/package/rc-checkbox
29+
[bundlephobia-url]: https://bundlephobia.com/result?p=rc-checkbox
30+
[bundlephobia-image]: https://badgen.net/bundlephobia/minzip/rc-checkbox
2131

2232
## Install
2333

@@ -26,62 +36,65 @@ React Checkbox component.
2636
## Usage
2737

2838
```js
29-
import 'rc-checkbox/assets/index.css';
30-
import Checkbox from 'rc-checkbox';
39+
import checkbox from 'rc-checkbox';
3140

32-
ReactDOM.render(<Checkbox />, container);
41+
export default () => <checkbox />;
3342
```
3443

35-
## API
44+
## Compatibility
45+
46+
| [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_48x48.png" alt="IE / Edge" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br>IE / Edge | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png" alt="Firefox" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br>Firefox | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png" alt="Chrome" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br>Chrome | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari/safari_48x48.png" alt="Safari" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br>Safari | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/electron/electron_48x48.png" alt="Electron" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br>Electron |
47+
| --- | --- | --- | --- | --- |
48+
| IE11, Edge | last 2 versions | last 2 versions | last 2 versions | last 2 versions |
3649

37-
### props
50+
## API
3851

3952
<table class="table table-bordered table-striped">
40-
<thead>
53+
<thead>
54+
<tr>
55+
<th style="width: 100px;">name</th>
56+
<th style="width: 50px;">type</th>
57+
<th style="width: 50px;">default</th>
58+
<th>description</th>
59+
</tr>
60+
</thead>
61+
<tbody>
62+
<tr>
63+
<td>prefixCls</td>
64+
<td>String</td>
65+
<td>rc-checkbox</td>
66+
<td></td>
67+
</tr>
68+
<tr>
69+
<td>className</td>
70+
<td>String</td>
71+
<td>''</td>
72+
<td>additional class name of root node</td>
73+
</tr>
74+
<tr>
75+
<td>name</td>
76+
<td>String</td>
77+
<td></td>
78+
<td>same with native input checkbox</td>
79+
</tr>
80+
<tr>
81+
<td>checked</td>
82+
<td>enum: 0,1,2</td>
83+
<td></td>
84+
<td></td>
85+
</tr>
86+
<tr>
87+
<td>defaultChecked</td>
88+
<td>enum: 0,1,2</td>
89+
<td>0</td>
90+
<td>same with native input checkbox</td>
4191
<tr>
42-
<th style="width: 100px;">name</th>
43-
<th style="width: 50px;">type</th>
44-
<th style="width: 50px;">default</th>
45-
<th>description</th>
92+
<td>onChange</td>
93+
<td>Function(e:Event, checked:Number)</td>
94+
<td></td>
95+
<td>called when checkbox is changed. e is native event, checked is original checked state.</td>
4696
</tr>
47-
</thead>
48-
<tbody>
49-
<tr>
50-
<td>prefixCls</td>
51-
<td>String</td>
52-
<td>rc-checkbox</td>
53-
<td></td>
54-
</tr>
55-
<tr>
56-
<td>className</td>
57-
<td>String</td>
58-
<td>''</td>
59-
<td>additional class name of root node</td>
60-
</tr>
61-
<tr>
62-
<td>name</td>
63-
<td>String</td>
64-
<td></td>
65-
<td>same with native input checkbox</td>
66-
</tr>
67-
<tr>
68-
<td>checked</td>
69-
<td>enum: 0,1,2</td>
70-
<td></td>
71-
<td></td>
72-
</tr>
73-
<tr>
74-
<td>defaultChecked</td>
75-
<td>enum: 0,1,2</td>
76-
<td>0</td>
77-
<td>same with native input checkbox</td>
78-
<tr>
79-
<td>onChange</td>
80-
<td>Function(e:Event, checked:Number)</td>
81-
<td></td>
82-
<td>called when checkbox is changed. e is native event, checked is original checked state.</td>
83-
</tr>
84-
</tbody>
97+
</tbody>
8598
</table>
8699

87100
## Development
@@ -91,24 +104,7 @@ npm install
91104
npm start
92105
```
93106

94-
## Examples
95-
96-
http://localhost:8001/examples/
97-
98-
online example: http://react-component.github.io/checkbox/examples/simple.html
99-
100-
## Test Case
101-
102-
```
103-
npm test
104-
```
105-
106-
## Coverage
107-
108-
```
109-
npm run coverage
110-
open coverage
111-
```
107+
Online demo: http://react-component.github.io/checkbox/
112108

113109
## License
114110

examples/simple.html

Whitespace-only changes.

examples/simple.js renamed to examples/simple.jsx

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
1-
/* eslint no-console:0 */
2-
1+
/* eslint no-console:0, jsx-a11y/label-has-for: 0, jsx-a11y/label-has-associated-control: 0 */
32
import React from 'react';
4-
import ReactDOM from 'react-dom';
5-
import Checkbox from 'rc-checkbox';
6-
import 'rc-checkbox/assets/index.less';
3+
import Checkbox from '../src';
4+
import '../assets/index.less';
75

86
function onChange(e) {
97
console.log('Checkbox checked:', (e.target.checked));
108
}
119

12-
class SimpleDemo extends React.Component {
10+
export default class SimpleDemo extends React.Component {
1311
state = {
1412
disabled: false,
1513
};
1614

1715
toggle = () => {
18-
this.setState((state) => ({
16+
this.setState(state => ({
1917
disabled: !state.disabled,
2018
}));
2119
}
@@ -103,10 +101,8 @@ class SimpleDemo extends React.Component {
103101
</p>
104102
</div>
105103

106-
<button onClick={this.toggle}>toggle disabled</button>
104+
<button type="button" onClick={this.toggle}>toggle disabled</button>
107105
</div>
108106
);
109107
}
110108
}
111-
112-
ReactDOM.render(<SimpleDemo />, document.getElementById('__react-content'));

0 commit comments

Comments
 (0)