Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: prettier code #482

Merged
merged 1 commit into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .dumirc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ export default defineConfig({
min-height: 300px;
}
`,
]
],
});
2 changes: 1 addition & 1 deletion .fatherrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ import { defineConfig } from 'father';

export default defineConfig({
plugins: ['@rc-component/father-plugin'],
});
});
56 changes: 28 additions & 28 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
version: 2
updates:
- package-ecosystem: npm
directory: "/"
schedule:
interval: daily
time: "21:00"
open-pull-requests-limit: 10
ignore:
- dependency-name: np
versions:
- 7.2.0
- 7.3.0
- 7.4.0
- dependency-name: "@types/react-dom"
versions:
- 17.0.0
- 17.0.1
- 17.0.2
- dependency-name: "@types/react"
versions:
- 17.0.0
- 17.0.1
- 17.0.2
- 17.0.3
- dependency-name: typescript
versions:
- 4.1.3
- 4.1.4
- 4.1.5
- package-ecosystem: npm
directory: '/'
schedule:
interval: daily
time: '21:00'
open-pull-requests-limit: 10
ignore:
- dependency-name: np
versions:
- 7.2.0
- 7.3.0
- 7.4.0
- dependency-name: '@types/react-dom'
versions:
- 17.0.0
- 17.0.1
- 17.0.2
- dependency-name: '@types/react'
versions:
- 17.0.0
- 17.0.1
- 17.0.2
- 17.0.3
- dependency-name: typescript
versions:
- 4.1.3
- 4.1.4
- 4.1.5
12 changes: 6 additions & 6 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: "CodeQL"
name: 'CodeQL'

on:
push:
branches: [ "master" ]
branches: ['master']
pull_request:
branches: [ "master" ]
branches: ['master']
schedule:
- cron: "40 12 * * 0"
- cron: '40 12 * * 0'

jobs:
analyze:
Expand All @@ -20,7 +20,7 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ javascript ]
language: [javascript]

steps:
- name: Checkout
Expand All @@ -38,4 +38,4 @@ jobs:
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{ matrix.language }}"
category: '/language:${{ matrix.language }}'
3 changes: 2 additions & 1 deletion HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# History
----

---

## 4.1.0 / 2020-05-08

Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,25 +39,26 @@ import React from 'react';
import ReactDOM from 'react-dom';
import Trigger from '@rc-component/trigger';

ReactDOM.render((
ReactDOM.render(
<Trigger
action={['click']}
popup={<span>popup</span>}
popupAlign={{
points: ['tl', 'bl'],
offset: [0, 3]
offset: [0, 3],
}}
>
<a href='#'>hover</a>
</Trigger>
), container);
<a href="#">hover</a>
</Trigger>,
container,
);
```

## Compatibility

| [<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 |
| --- | --- | --- | --- | --- |
| IE11, Edge | last 2 versions | last 2 versions | last 2 versions | last 2 versions |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| IE11, Edge | last 2 versions | last 2 versions | last 2 versions | last 2 versions |

## Example

Expand Down Expand Up @@ -243,7 +244,6 @@ npm start
</tbody>
</table>


## Test Case

```
Expand Down
6 changes: 4 additions & 2 deletions assets/index/Mask.less
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
animation-timing-function: cubic-bezier(0.55, 0, 0.55, 0.2);
}

&-fade-enter,&-fade-appear {
&-fade-enter,
&-fade-appear {
opacity: 0;
.fade-effect();
animation-play-state: paused;
Expand All @@ -33,7 +34,8 @@
animation-play-state: paused;
}

&-fade-enter&-fade-enter-active,&-fade-appear&-fade-appear-active {
&-fade-enter&-fade-enter-active,
&-fade-appear&-fade-appear-active {
animation-name: rcTriggerMaskFadeIn;
animation-play-state: running;
}
Expand Down
2 changes: 1 addition & 1 deletion docs/demos/body-overflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ nav:
path: /demo
---

<code src="../examples/body-overflow.tsx"></code>
<code src="../examples/body-overflow.tsx"></code>
2 changes: 1 addition & 1 deletion docs/demos/case.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ nav:
path: /demo
---

<code src="../examples/case.tsx"></code>
<code src="../examples/case.tsx"></code>
2 changes: 1 addition & 1 deletion docs/demos/click-nested.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ nav:
path: /demo
---

<code src="../examples/click-nested.tsx"></code>
<code src="../examples/click-nested.tsx"></code>
2 changes: 1 addition & 1 deletion docs/demos/clip.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ nav:
path: /demo
---

<code src="../examples/clip.tsx"></code>
<code src="../examples/clip.tsx"></code>
2 changes: 1 addition & 1 deletion docs/demos/container.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ nav:
path: /demo
---

<code src="../examples/container.tsx"></code>
<code src="../examples/container.tsx"></code>
2 changes: 1 addition & 1 deletion docs/demos/inside.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ nav:
path: /demo
---

<code src="../examples/inside.tsx"></code>
<code src="../examples/inside.tsx"></code>
2 changes: 1 addition & 1 deletion docs/demos/large-popup.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ nav:
path: /demo
---

<code src="../examples/large-popup.tsx"></code>
<code src="../examples/large-popup.tsx"></code>
2 changes: 1 addition & 1 deletion docs/demos/nested.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ nav:
path: /demo
---

<code src="../examples/nested.tsx"></code>
<code src="../examples/nested.tsx"></code>
2 changes: 1 addition & 1 deletion docs/demos/point.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ nav:
path: /demo
---

<code src="../examples/point.tsx"></code>
<code src="../examples/point.tsx"></code>
2 changes: 1 addition & 1 deletion docs/demos/shadow.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ nav:
path: /demo
---

<code src="../examples/shadow.tsx"></code>
<code src="../examples/shadow.tsx"></code>
2 changes: 1 addition & 1 deletion docs/demos/simple.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ nav:
path: /demo
---

<code src="../examples/simple.tsx"></code>
<code src="../examples/simple.tsx"></code>
2 changes: 1 addition & 1 deletion docs/demos/visible-fallback.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ nav:
path: /demo
---

<code src="../examples/visible-fallback.tsx"></code>
<code src="../examples/visible-fallback.tsx"></code>
6 changes: 4 additions & 2 deletions docs/examples/case.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,10 @@ const Demo = () => {
click,
contextMenu,
};

const actionsKeys = Object.keys(actions).filter((action) => actions[action]) as ActionType[];

const actionsKeys = Object.keys(actions).filter(
(action) => actions[action],
) as ActionType[];

return (
<React.StrictMode>
Expand Down
12 changes: 3 additions & 9 deletions docs/examples/nested.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@ const Test = () => {
getPopupContainer={() => containerRef.current}
popup={<div style={popupBorderStyle}>I am inner Trigger Popup</div>}
>
<span style={{ margin: 20 }}>
clickToShowInnerTrigger
</span>
<span style={{ margin: 20 }}>clickToShowInnerTrigger</span>
</Trigger>
</div>
);
Expand All @@ -94,9 +92,7 @@ const Test = () => {
builtinPlacements={builtinPlacements}
popup={<div style={popupBorderStyle}>i am a hover popup</div>}
>
<span style={{ margin: 20 }}>
trigger
</span>
<span style={{ margin: 20 }}>trigger</span>
</Trigger>
</span>
</Trigger>
Expand All @@ -108,9 +104,7 @@ const Test = () => {
builtinPlacements={builtinPlacements}
popup={innerTrigger}
>
<span style={{ margin: 20 }}>
trigger
</span>
<span style={{ margin: 20 }}>trigger</span>
</Trigger>
</div>

Expand Down
2 changes: 1 addition & 1 deletion docs/examples/point.less
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.point-popup {
pointer-events: none;
}
}
10 changes: 8 additions & 2 deletions docs/examples/point.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ const builtinPlacements = {
};

const innerTrigger = (
<div style={{ padding: 20, background: 'rgba(0, 255, 0, 0.3)' }}>This is popup</div>
<div style={{ padding: 20, background: 'rgba(0, 255, 0, 0.3)' }}>
This is popup
</div>
);

class Test extends React.Component {
Expand Down Expand Up @@ -45,7 +47,11 @@ class Test extends React.Component {
{action === 'hover' && (
<label>
Mouse enter delay:{' '}
<input type="text" value={mouseEnterDelay} onChange={this.onDelayChange} />
<input
type="text"
value={mouseEnterDelay}
onChange={this.onDelayChange}
/>
</label>
)}
<div style={{ margin: 50 }}>
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/simple.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ class Test extends React.Component<any, TestState> {
return null;
}

const actions = Object.keys(state.trigger) as ActionType[]
const actions = Object.keys(state.trigger) as ActionType[];

return (
<div>
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ hero:
description: React Trigger Component
---

<embed src="../README.md"></embed>
<embed src="../README.md"></embed>
2 changes: 1 addition & 1 deletion now.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
"config": { "distDir": ".doc" }
}
]
}
}
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"prepublishOnly": "npm run compile && np --yolo --no-publish",
"lint": "eslint src/ docs/examples/ --ext .tsx,.ts,.jsx,.js",
"test": "rc-test",
"prettier": "prettier --write .",
"coverage": "rc-test --coverage",
"now-build": "npm run build"
},
Expand All @@ -55,6 +56,7 @@
"father": "^4.0.0",
"less": "^4.2.0",
"np": "^10.0.5",
"prettier": "^3.3.3",
"rc-test": "^7.0.13",
"react": "^18.0.0",
"react-dom": "^18.0.0",
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useAlign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export default function useAlign(
} else {
const rect = target.getBoundingClientRect();
rect.x = rect.x ?? rect.left;
rect.y = rect.y ?? rect.top
rect.y = rect.y ?? rect.top;
targetRect = {
x: rect.x,
y: rect.y,
Expand Down
2 changes: 1 addition & 1 deletion tests/flip.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ describe('Trigger.Align', () => {
top: 100,
width: 300,
height: 300,
} as any);
}) as any;

const visibleArea = getVisibleArea(initArea, [affectEle]);
expect(visibleArea).toEqual({
Expand Down
1 change: 0 additions & 1 deletion tests/rect.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,4 @@ describe('Trigger.Rect', () => {
bottom: `100px`,
});
});

});
Loading
Loading