Skip to content

Commit b5a337e

Browse files
authored
refator: Use father (#641)
* init father * rm warning deps * fix lint * slider tsx * Slider tsx * Range tsx * handle tsx * createSliderWithTooltip * rest * fix lint * examples * fix ts * fix ci
1 parent 6f2630f commit b5a337e

31 files changed

+843
-566
lines changed

.eslintrc

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

.eslintrc.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
const base = require('@umijs/fabric/dist/eslint');
2+
3+
module.exports = {
4+
...base,
5+
rules: {
6+
...base.rules,
7+
'react/no-array-index-key': 0,
8+
'react/sort-comp': 0,
9+
'@typescript-eslint/no-explicit-any': 1,
10+
'@typescript-eslint/no-empty-interface': 1,
11+
'@typescript-eslint/no-inferrable-types': 0,
12+
'react/no-find-dom-node': 1,
13+
'react/require-default-props': 0,
14+
'no-confusing-arrow': 0,
15+
'import/no-named-as-default-member': 0,
16+
'jsx-a11y/label-has-for': 0,
17+
'jsx-a11y/label-has-associated-control': 0,
18+
},
19+
};

.fatherrc.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export default {
2+
cjs: 'babel',
3+
esm: { type: 'babel', importLibToEs: true },
4+
preCommit: {
5+
eslint: true,
6+
prettier: true,
7+
},
8+
};

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,6 @@ lib
2828
es
2929
/coverage
3030
yarn.lock
31+
package-lock.json
32+
.doc
33+
.storybook

.prettierrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"singleQuote": true,
3+
"trailingComma": "all",
4+
"proseWrap": "never",
5+
"printWidth": 100
6+
}

.travis.yml

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,18 @@
11
language: node_js
22

3-
sudo: false
4-
5-
notifications:
6-
email:
7-
8-
9-
103
node_js:
11-
- 6.0.0
12-
13-
before_install:
14-
- |
15-
if ! git diff --name-only $TRAVIS_COMMIT_RANGE | grep -qvE '(\.md$)|(^(docs|examples))/'
16-
then
17-
echo "Only docs were updated, stopping build process."
18-
exit
19-
fi
20-
phantomjs --version
4+
- 10
215

226
script:
23-
- |
7+
- |
248
if [ "$TEST_TYPE" = test ]; then
259
npm test -- --coverage && \
2610
bash <(curl -s https://codecov.io/bash)
2711
else
2812
npm run $TEST_TYPE
2913
fi
30-
3114
env:
3215
matrix:
33-
- TEST_TYPE=lint
34-
- TEST_TYPE=test
35-
- TEST_TYPE=saucelabs
36-
global:
37-
- secure: S1VwbaPzLnSH/IUT/wlJulxAX5VHRIDmSt53h/ycHcZsszUpWcLCJRQAe0fTVB2dAx5MdBbSZ+o+tr3tRwVB5TRAYm0oTCsYAkOZaWOB28RuUQtdGt3wf9xxTG1UiPiaLLUW3waX9zAaf3yqKBcJGf1op0RD8dksxbCFw/7xVbU=
38-
- secure: EBEDg8k///IlEsnx0AE8X3mbFl0QE5+xGKbG4AxXlGZda12uTIPUSMKJzdZQ2hVbZXduTzf1cQl9rcu9nGoSnkL/DWnIax9cvHi+1orx5+YPlxPHNWAwWByTnHosBn2MJhfy1s5paJfHC9cUzmmEL6x4fYthWxjsPUo+irEZH6E=
39-
40-
41-
matrix:
42-
allow_failures:
43-
- env: "TEST_TYPE=saucelabs"
16+
- TEST_TYPE=lint
17+
- TEST_TYPE=test
18+
- TEST_TYPE=compile

examples/handle.html

Lines changed: 0 additions & 1 deletion
This file was deleted.

examples/handle.js renamed to examples/handle.jsx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
import 'rc-slider/assets/index.less';
1+
import '../assets/index.less';
22
import 'rc-tooltip/assets/bootstrap.css';
33
import React from 'react';
4-
import ReactDOM from 'react-dom';
54
import Tooltip from 'rc-tooltip';
6-
import Slider from 'rc-slider';
5+
import Slider from '../src';
76

8-
const createSliderWithTooltip = Slider.createSliderWithTooltip;
7+
const { createSliderWithTooltip } = Slider;
98
const Range = createSliderWithTooltip(Slider.Range);
10-
const Handle = Slider.Handle;
9+
const { Handle } = Slider;
1110

12-
const handle = (props) => {
11+
const handle = props => {
1312
const { value, dragging, index, ...restProps } = props;
1413
return (
1514
<Tooltip
@@ -25,7 +24,8 @@ const handle = (props) => {
2524
};
2625

2726
const wrapperStyle = { width: 400, margin: 50 };
28-
ReactDOM.render(
27+
28+
export default () => (
2929
<div>
3030
<div style={wrapperStyle}>
3131
<p>Slider with custom handle</p>
@@ -43,6 +43,5 @@ ReactDOM.render(
4343
<p>Range with custom tooltip</p>
4444
<Range min={0} max={20} defaultValue={[3, 10]} tipFormatter={value => `${value}%`} />
4545
</div>
46-
</div>,
47-
document.getElementById('__react-content')
46+
</div>
4847
);

examples/marks.html

Lines changed: 0 additions & 1 deletion
This file was deleted.

examples/marks.js renamed to examples/marks.jsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import 'rc-slider/assets/index.less';
1+
import '../assets/index.less';
22

33
import React from 'react';
4-
import ReactDOM from 'react-dom';
5-
import Slider from 'rc-slider';
4+
import Slider from '../src';
65

76
const style = { width: 400, margin: 50 };
87
const marks = {
@@ -23,7 +22,7 @@ function log(value) {
2322
console.log(value); //eslint-disable-line
2423
}
2524

26-
ReactDOM.render(
25+
export default () => (
2726
<div>
2827
<div style={style}>
2928
<p>Slider with marks, `step=null`</p>
@@ -57,4 +56,4 @@ ReactDOM.render(
5756
<Slider.Range min={-10} marks={marks} step={10} onChange={log} defaultValue={[20, 40]} />
5857
</div>
5958
</div>
60-
, document.getElementById('__react-content'));
59+
);

0 commit comments

Comments
 (0)