Skip to content

Commit f1fce69

Browse files
authored
chore: upgrade tools and format code (#444)
* chore: add husky stylelint lint-staged * chore: prettier all code * chore: add .stylelintrc.json * chore: upgrade deps * chore: upgrade actions
1 parent d018cb0 commit f1fce69

30 files changed

+455
-444
lines changed

.fatherrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ import { defineConfig } from 'father';
22

33
export default defineConfig({
44
plugins: ['@rc-component/father-plugin'],
5-
});
5+
});

.github/dependabot.yml

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
version: 2
22
updates:
3-
- package-ecosystem: npm
4-
directory: "/"
5-
schedule:
6-
interval: daily
7-
time: "21:00"
8-
open-pull-requests-limit: 10
9-
ignore:
10-
- dependency-name: np
11-
versions:
12-
- 7.2.0
13-
- 7.3.0
14-
- 7.4.0
15-
- dependency-name: "@types/react"
16-
versions:
17-
- 17.0.0
18-
- 17.0.1
19-
- 17.0.2
20-
- 17.0.3
21-
- dependency-name: "@types/react-dom"
22-
versions:
23-
- 17.0.0
24-
- 17.0.1
25-
- 17.0.2
26-
- dependency-name: react
27-
versions:
28-
- 17.0.1
29-
- dependency-name: less
30-
versions:
31-
- 4.1.0
3+
- package-ecosystem: npm
4+
directory: '/'
5+
schedule:
6+
interval: daily
7+
time: '21:00'
8+
open-pull-requests-limit: 10
9+
ignore:
10+
- dependency-name: np
11+
versions:
12+
- 7.2.0
13+
- 7.3.0
14+
- 7.4.0
15+
- dependency-name: '@types/react'
16+
versions:
17+
- 17.0.0
18+
- 17.0.1
19+
- 17.0.2
20+
- 17.0.3
21+
- dependency-name: '@types/react-dom'
22+
versions:
23+
- 17.0.0
24+
- 17.0.1
25+
- 17.0.2
26+
- dependency-name: react
27+
versions:
28+
- 17.0.1
29+
- dependency-name: less
30+
versions:
31+
- 4.1.0

.github/workflows/react-component-ci.yml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,29 @@ name: CI
22

33
on:
44
push:
5-
branches: [ master ]
5+
branches: [master]
66
pull_request:
7-
branches: [ master ]
7+
branches: [master]
88

99
jobs:
1010
setup:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- name: checkout
14-
uses: actions/checkout@master
14+
uses: actions/checkout@v4
1515

16-
- uses: actions/setup-node@v1
16+
- uses: actions/setup-node@v4
1717
with:
18-
node-version: '12'
18+
node-version: '20'
1919

2020
- name: cache package-lock.json
21-
uses: actions/cache@v2
21+
uses: actions/cache@v4
2222
with:
2323
path: package-temp-dir
2424
key: lock-${{ github.sha }}
2525

2626
- name: create package-lock.json
27-
run: npm i --package-lock-only
27+
run: npm i --package-lock-only --ignore-scripts
2828

2929
- name: hack for singe file
3030
run: |
@@ -35,29 +35,29 @@ jobs:
3535
3636
- name: cache node_modules
3737
id: node_modules_cache_id
38-
uses: actions/cache@v2
38+
uses: actions/cache@v4
3939
with:
4040
path: node_modules
4141
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
4242

4343
- name: install
4444
if: steps.node_modules_cache_id.outputs.cache-hit != 'true'
4545
run: npm ci
46-
46+
4747
lint:
4848
runs-on: ubuntu-latest
4949
steps:
5050
- name: checkout
51-
uses: actions/checkout@master
51+
uses: actions/checkout@v4
5252

5353
- name: restore cache from package-lock.json
54-
uses: actions/cache@v2
54+
uses: actions/cache@v4
5555
with:
5656
path: package-temp-dir
5757
key: lock-${{ github.sha }}
5858

5959
- name: restore cache from node_modules
60-
uses: actions/cache@v2
60+
uses: actions/cache@v4
6161
with:
6262
path: node_modules
6363
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
@@ -66,21 +66,21 @@ jobs:
6666
run: npm run lint
6767

6868
needs: setup
69-
69+
7070
compile:
7171
runs-on: ubuntu-latest
7272
steps:
7373
- name: checkout
74-
uses: actions/checkout@master
74+
uses: actions/checkout@v4
7575

7676
- name: restore cache from package-lock.json
77-
uses: actions/cache@v2
77+
uses: actions/cache@v4
7878
with:
7979
path: package-temp-dir
8080
key: lock-${{ github.sha }}
8181

8282
- name: restore cache from node_modules
83-
uses: actions/cache@v2
83+
uses: actions/cache@v4
8484
with:
8585
path: node_modules
8686
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
@@ -89,21 +89,21 @@ jobs:
8989
run: npm run compile
9090

9191
needs: setup
92-
92+
9393
coverage:
9494
runs-on: ubuntu-latest
9595
steps:
9696
- name: checkout
97-
uses: actions/checkout@master
97+
uses: actions/checkout@v4
9898

9999
- name: restore cache from package-lock.json
100-
uses: actions/cache@v2
100+
uses: actions/cache@v4
101101
with:
102102
path: package-temp-dir
103103
key: lock-${{ github.sha }}
104104

105105
- name: restore cache from node_modules
106-
uses: actions/cache@v2
106+
uses: actions/cache@v4
107107
with:
108108
path: node_modules
109109
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npx lint-staged

.stylelintrc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": ["stylelint-config-standard-less"]
3+
}

README.md

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -35,41 +35,41 @@ ReactDom.render(
3535

3636
## Browser Support
3737

38-
|![IE](https://github.com/alrra/browser-logos/blob/master/src/edge/edge_48x48.png?raw=true) | ![Chrome](https://github.com/alrra/browser-logos/blob/master/src/chrome/chrome_48x48.png?raw=true) | ![Firefox](https://github.com/alrra/browser-logos/blob/master/src/firefox/firefox_48x48.png?raw=true) | ![Opera](https://github.com/alrra/browser-logos/blob/master/src/opera/opera_48x48.png?raw=true) | ![Safari](https://github.com/alrra/browser-logos/blob/master/src/safari/safari_48x48.png?raw=true)|
39-
| --- | --- | --- | --- | --- |
40-
| IE 10+ ✔ | Chrome 31.0+ ✔ | Firefox 31.0+ ✔ | Opera 30.0+ ✔ | Safari 7.0+ ✔ |
38+
| ![IE](https://github.com/alrra/browser-logos/blob/master/src/edge/edge_48x48.png?raw=true) | ![Chrome](https://github.com/alrra/browser-logos/blob/master/src/chrome/chrome_48x48.png?raw=true) | ![Firefox](https://github.com/alrra/browser-logos/blob/master/src/firefox/firefox_48x48.png?raw=true) | ![Opera](https://github.com/alrra/browser-logos/blob/master/src/opera/opera_48x48.png?raw=true) | ![Safari](https://github.com/alrra/browser-logos/blob/master/src/safari/safari_48x48.png?raw=true) |
39+
| ------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
40+
| IE 10+ ✔ | Chrome 31.0+ ✔ | Firefox 31.0+ ✔ | Opera 30.0+ ✔ | Safari 7.0+ ✔ |
4141

4242
## API
4343

44-
| props | type | default | description |
45-
|------------|----------------|---------|----------------|
46-
| className | string | null | - |
47-
| classNames | { mask?: string; content?: string; wrapper?: string; } | - | pass className to target area |
48-
| styles | { mask?: CSSProperties; content?: CSSProperties; wrapper?: CSSProperties; } | - | pass style to target area |
49-
| prefixCls | string | 'drawer' | prefix class |
50-
| width | string \| number | null | drawer content wrapper width, drawer level transition width |
51-
| height | string \| number | null | drawer content wrapper height, drawer level transition height |
52-
| open | boolean | false | open or close menu |
53-
| defaultOpen | boolean | false | default open menu |
54-
| placement | string | `left` | `left` `top` `right` `bottom` |
55-
| level | string \| array | `all` | With the drawer level element. `all`/ null / className / id / tagName / array |
56-
| levelMove | number \| array \| func | null |level move value. default is drawer width |
57-
| duration | string | `.3s` | level animation duration |
58-
| ease | string | `cubic-bezier(0.78, 0.14, 0.15, 0.86)` | level animation timing function |
59-
| getContainer | string \| func \| HTMLElement | `body` | Return the mount node for Drawer. if is `null` use React.creactElement |
60-
| showMask | boolean | true | mask is show |
61-
| maskClosable | boolean | true | Clicking on the mask (area outside the Drawer) to close the Drawer or not. |
62-
| maskStyle | CSSProperties | null | mask style |
63-
| afterVisibleChange | func | null | transition end callback(open) |
64-
| onClose | func | null | close click function |
65-
| keyboard | boolean | true | Whether support press esc to close |
66-
| autoFocus | boolean | true | Whether focusing on the drawer after it opened |
67-
| onMouseEnter | React.MouseEventHandler\<HTMLDivElement\> | - | Trigger when mouse enter drawer panel |
68-
| onMouseOver | React.MouseEventHandler\<HTMLDivElement\> | - | Trigger when mouse over drawer panel |
69-
| onMouseLeave | React.MouseEventHandler\<HTMLDivElement\> | - | Trigger when mouse leave drawer panel |
70-
| onClick | React.MouseEventHandler\<HTMLDivElement\> | - | Trigger when mouse click drawer panel |
71-
| onKeyDown | React.MouseEventHandler\<HTMLDivElement\> | - | Trigger when mouse keydown on drawer panel |
72-
| onKeyUp | React.MouseEventHandler\<HTMLDivElement\> | - | Trigger when mouse keyup on drawer panel |
44+
| props | type | default | description |
45+
| ------------------ | --------------------------------------------------------------------------- | -------------------------------------- | ----------------------------------------------------------------------------- |
46+
| className | string | null | - |
47+
| classNames | { mask?: string; content?: string; wrapper?: string; } | - | pass className to target area |
48+
| styles | { mask?: CSSProperties; content?: CSSProperties; wrapper?: CSSProperties; } | - | pass style to target area |
49+
| prefixCls | string | 'drawer' | prefix class |
50+
| width | string \| number | null | drawer content wrapper width, drawer level transition width |
51+
| height | string \| number | null | drawer content wrapper height, drawer level transition height |
52+
| open | boolean | false | open or close menu |
53+
| defaultOpen | boolean | false | default open menu |
54+
| placement | string | `left` | `left` `top` `right` `bottom` |
55+
| level | string \| array | `all` | With the drawer level element. `all`/ null / className / id / tagName / array |
56+
| levelMove | number \| array \| func | null | level move value. default is drawer width |
57+
| duration | string | `.3s` | level animation duration |
58+
| ease | string | `cubic-bezier(0.78, 0.14, 0.15, 0.86)` | level animation timing function |
59+
| getContainer | string \| func \| HTMLElement | `body` | Return the mount node for Drawer. if is `null` use React.creactElement |
60+
| showMask | boolean | true | mask is show |
61+
| maskClosable | boolean | true | Clicking on the mask (area outside the Drawer) to close the Drawer or not. |
62+
| maskStyle | CSSProperties | null | mask style |
63+
| afterVisibleChange | func | null | transition end callback(open) |
64+
| onClose | func | null | close click function |
65+
| keyboard | boolean | true | Whether support press esc to close |
66+
| autoFocus | boolean | true | Whether focusing on the drawer after it opened |
67+
| onMouseEnter | React.MouseEventHandler\<HTMLDivElement\> | - | Trigger when mouse enter drawer panel |
68+
| onMouseOver | React.MouseEventHandler\<HTMLDivElement\> | - | Trigger when mouse over drawer panel |
69+
| onMouseLeave | React.MouseEventHandler\<HTMLDivElement\> | - | Trigger when mouse leave drawer panel |
70+
| onClick | React.MouseEventHandler\<HTMLDivElement\> | - | Trigger when mouse click drawer panel |
71+
| onKeyDown | React.MouseEventHandler\<HTMLDivElement\> | - | Trigger when mouse keydown on drawer panel |
72+
| onKeyUp | React.MouseEventHandler\<HTMLDivElement\> | - | Trigger when mouse keyup on drawer panel |
7373

7474
> 2.0 Rename `onMaskClick` -> `onClose`, add `maskClosable`.
7575

assets/index.less

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,12 @@
44
@zIndex: 1050;
55

66
.inset-0() {
7-
top: 0;
8-
bottom: 0;
9-
left: 0;
10-
right: 0;
7+
inset: 0;
118
}
129

1310
.@{prefixCls} {
1411
.inset-0;
12+
1513
position: fixed;
1614
z-index: @zIndex;
1715
pointer-events: none;
@@ -22,9 +20,10 @@
2220

2321
&-mask {
2422
.inset-0;
23+
2524
position: absolute;
2625
z-index: @zIndex;
27-
background: rgba(0, 0, 0, 0.5);
26+
background: rgb(0 0 0 / 50%);
2827
pointer-events: auto;
2928
}
3029

docs/demo/change-remove.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@ nav:
55
path: /demo
66
---
77

8-
98
<code src="../examples/change-remove.tsx"></code>

docs/demo/change.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@ nav:
55
path: /demo
66
---
77

8-
98
<code src="../examples/change.tsx"></code>

docs/demo/forceRender.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@ nav:
55
path: /demo
66
---
77

8-
98
<code src="../examples/forceRender.tsx"></code>

0 commit comments

Comments
 (0)