Skip to content

Commit bae642f

Browse files
author
NgocNhi123
committed
fix lint
1 parent 7507df8 commit bae642f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+191
-165
lines changed

.github/DEVELOP.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ To understand the principles that drive the design and development of Moai, see
1414

1515
Moai is a [monorepo](https://classic.yarnpkg.com/en/docs/workspaces/) powered by Yarn. There are several projects:
1616

17-
| Path | Project | Framework |
18-
| ------- | ----------------- | ----------- |
19-
| core | [@moai/core] | [Rollup] |
20-
| gallery | [@moai/gallery] | [Rollup] |
21-
| docs | [moai.thien.do] | [Storybook] |
22-
| test | Test suits | [Jest] |
17+
| Path | Project | Framework |
18+
| ------- | --------------- | ----------- |
19+
| core | [@moai/core] | [Rollup] |
20+
| gallery | [@moai/gallery] | [Rollup] |
21+
| docs | [moai.thien.do] | [Storybook] |
22+
| test | Test suits | [Jest] |
2323

2424
The "test" and "docs" projects depend on "core" and "gallery" via symlinks. This means to run tests or start the docs site locally, you will need to build "core" and "gallery" first. Also, the "gallery" depends on the "core" project:
2525

README.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
**Heads up!** This project is no longer in active development. It will be [archived](https://docs.github.com/en/repositories/archiving-a-github-repository/archiving-repositories) soon. Some suggestions:
22

3-
- Build your own UI kit with a good foundation like [Radix](https://www.radix-ui.com/) or [Headless UI](https://headlessui.com/). This is what I'm actually doing these days myself.
4-
- Fork this project. You have my sword, and bow, and axe, and only 22 unresolved bugs.
5-
- Refactor Moai to utilise Radix (which is what I wanted to do, if I don't need to pay the bills)
6-
3+
- Build your own UI kit with a good foundation like [Radix](https://www.radix-ui.com/) or [Headless UI](https://headlessui.com/). This is what I'm actually doing these days myself.
4+
- Fork this project. You have my sword, and bow, and axe, and only 22 unresolved bugs.
5+
- Refactor Moai to utilise Radix (which is what I wanted to do, if I don't need to pay the bills)
76

87
<hr />
98

core/src/button/button.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ const validateButton = (props: ButtonProps): void => {
267267
// since it's missing the ref. See Button for the exported component.
268268
const buttonRender = (
269269
props: ButtonProps,
270-
ref: React.ForwardedRef<ButtonElement>
270+
ref: React.ForwardedRef<ButtonElement>,
271271
): JSX.Element => {
272272
validateButton(props);
273273
const common = {

core/src/button/color/failure.module.css

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
:global(.dark) .outset {
1515
color: var(--white);
1616
background-color: var(--failure-5);
17-
box-shadow: var(--shadow), var(--inset-shadow) var(--failure-4);
17+
box-shadow:
18+
var(--shadow),
19+
var(--inset-shadow) var(--failure-4);
1820
font-weight: 500;
1921
}
2022

core/src/button/color/highlight.module.css

+3-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@
3131
:global(.dark) .outset {
3232
color: var(--white);
3333
background-color: var(--highlight-5);
34-
box-shadow: var(--shadow), var(--inset-shadow) var(--highlight-4);
34+
box-shadow:
35+
var(--shadow),
36+
var(--inset-shadow) var(--highlight-4);
3537
font-weight: 500;
3638
}
3739

core/src/button/color/none.module.css

+6-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@
2525
:global(.light) .outset {
2626
--shadow: var(--shadow-size) rgba(0, 0, 0, 0.1);
2727
background-color: var(--gray-0);
28-
box-shadow: var(--shadow), var(--inset-shadow) var(--white);
28+
box-shadow:
29+
var(--shadow),
30+
var(--inset-shadow) var(--white);
2931
border-color: var(--gray-2);
3032
}
3133
:global(.light) .outset:hover {
@@ -39,7 +41,9 @@
3941
:global(.dark) .outset {
4042
--shadow: var(--shadow-size) rgba(0, 0, 0, 0.5);
4143
background-color: var(--gray-6);
42-
box-shadow: var(--shadow), var(--inset-shadow) var(--gray-5);
44+
box-shadow:
45+
var(--shadow),
46+
var(--inset-shadow) var(--gray-5);
4347
border-color: var(--black);
4448
}
4549
:global(.dark) .outset:hover {

core/src/button/style/flat.module.css

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
.main {
2-
transition: background-color 0.1s, outline 0.2s ease-out;
2+
transition:
3+
background-color 0.1s,
4+
outline 0.2s ease-out;
35
border-radius: 0;
46
/* To have same layout with outset buttons */
57
border: solid 1px transparent;

core/src/button/style/outset.module.css

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
.main {
2-
transition: background-color 0.1s, box-shadow 0.1s, outline 0.2s ease-out;
2+
transition:
3+
background-color 0.1s,
4+
box-shadow 0.1s,
5+
outline 0.2s ease-out;
36
border: solid 1px transparent;
47
--shadow-size: 0px 0.5px 2px;
58
--inset-shadow: inset 0px 1px 0px;

core/src/checkbox/checkbox.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ export const Checkbox = (props: CheckboxProps): JSX.Element => {
147147
/>
148148
<span
149149
className={[shared.icon, style.icon, self.indeterminate].join(
150-
" "
150+
" ",
151151
)}
152152
children={<Icon display="block" component={coreIcons.dash} />}
153153
/>

core/src/checkbox/outset.module.css

+13-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
.input {
2-
transition: background-color 0.1s, box-shadow 0.1s, outline 0.2s ease-out;
2+
transition:
3+
background-color 0.1s,
4+
box-shadow 0.1s,
5+
outline 0.2s ease-out;
36
border: solid 1px transparent;
47
--shadow-size: 0px 0.5px 2px;
58
--inset-shadow: inset 0px 1px 0px;
@@ -10,7 +13,9 @@
1013
:global(.light) .input {
1114
--shadow: var(--shadow-size) rgba(0, 0, 0, 0.1);
1215
background-color: var(--gray-0);
13-
box-shadow: var(--shadow), var(--inset-shadow) var(--white);
16+
box-shadow:
17+
var(--shadow),
18+
var(--inset-shadow) var(--white);
1419
border-color: var(--gray-2);
1520
}
1621
:global(.light) .input:hover {
@@ -24,7 +29,9 @@
2429
:global(.dark) .input {
2530
--shadow: var(--shadow-size) rgba(0, 0, 0, 0.3);
2631
background-color: var(--gray-6);
27-
box-shadow: var(--shadow), var(--inset-shadow) var(--gray-5);
32+
box-shadow:
33+
var(--shadow),
34+
var(--inset-shadow) var(--gray-5);
2835
border-color: var(--black);
2936
}
3037
:global(.dark) .input:hover {
@@ -42,7 +49,9 @@
4249
:global(.dark) .input:checked,
4350
:global(.dark) .input[type="checkbox"]:indeterminate {
4451
background-color: var(--highlight-5);
45-
box-shadow: var(--shadow), var(--inset-shadow) var(--highlight-4);
52+
box-shadow:
53+
var(--shadow),
54+
var(--inset-shadow) var(--highlight-4);
4655
}
4756

4857
:global(.light) .input:checked,

core/src/date-input/date-input.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,13 @@
114114
// /**
115115
// * A date input is a control for users to enter a date, either by typing it or
116116
// * choosing from a pop-up calendar.
117-
// *
117+
// *
118118
// * The Date Input component is based on [React Day Picker][3], as an
119119
// * alternative to the built-in `<Input type="date" />`. It works on
120120
// * [unsupported browsers][2] and can display custom date format (e.g. "dmy" or
121121
// * "mdy"). If you don't need these features, use [Input][1] to have better
122122
// * accessibility support.
123-
123+
124124
// * [1]: /docs/components-input--primary#date
125125
// * [2]: https://caniuse.com/input-datetime
126126
// * [3]: https://react-day-picker.js.org

core/src/dialog/native/alert.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export const dialogAlert = (
3232
message: React.ReactNode,
3333
options?: {
3434
width?: DialogProps["width"];
35-
}
35+
},
3636
): Promise<void> => {
3737
return new Promise((resolve) => {
3838
renderDialog((unmount) => (

core/src/dialog/native/confirm.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export const dialogConfirm = (
3434
message: React.ReactNode,
3535
options?: {
3636
width?: DialogProps["width"];
37-
}
37+
},
3838
): Promise<boolean> => {
3939
return new Promise((resolve) => {
4040
renderDialog((unmount) => (

core/src/dialog/native/prompt.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export const dialogPrompt = (
6060
options?: {
6161
width?: Props["width"];
6262
rows?: Props["rows"];
63-
}
63+
},
6464
): Promise<string | null> => {
6565
return new Promise((resolve) => {
6666
renderDialog((unmount) => (

core/src/form/field.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ export const FormField = (props: Props): JSX.Element => {
1919
{label}
2020
</span>,
2121
<DivPx size={8} />,
22-
<span className={s.input}>{children}</span>
22+
<span className={s.input}>{children}</span>,
2323
);
2424
};

core/src/icons/blank-icon.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ import { GenIcon, IconBaseProps, IconType } from "react-icons";
22

33
export const BlankIcon: IconType = (props: IconBaseProps): JSX.Element => {
44
return GenIcon({ tag: "svg", attr: { viewBox: "0 0 16 16" }, child: [] })(
5-
props
5+
props,
66
);
77
};

core/src/index.ts

-1
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,3 @@ export * from "./time-input/time-input";
3636
export * from "./toast/toast";
3737
export * from "./tooltip/tooltip";
3838
export * from "./tree/tree";
39-

core/src/input/flat.module.css

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
.main {
2-
transition: background-color 0.1s, outline 0.2s ease-out;
2+
transition:
3+
background-color 0.1s,
4+
outline 0.2s ease-out;
35

46
/* Pretty much nothing in normal state */
57
text-align: inherit;

core/src/input/input.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ const validate = (props: InputProps): void => {
119119

120120
const inputRender = (
121121
props: InputProps,
122-
ref: React.ForwardedRef<HTMLInputElement>
122+
ref: React.ForwardedRef<HTMLInputElement>,
123123
): JSX.Element => {
124124
validate(props);
125125
const size = props.size ?? Input.sizes.medium;

core/src/input/outset.module.css

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
.main {
2-
transition: background-color 0.1s, outline 0.2s ease-out;
2+
transition:
3+
background-color 0.1s,
4+
outline 0.2s ease-out;
35

46
border-width: 1px;
57
border-style: solid;

core/src/pagination/pagination.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export const Pagination = (props: PaginationProps): JSX.Element => {
5151
await setValueOrg(value);
5252
setBusy(false);
5353
},
54-
[setValueOrg, max, min]
54+
[setValueOrg, max, min],
5555
);
5656

5757
return (

core/src/pane/pane.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,6 @@ export const Pane = (props: Props): JSX.Element => (
4444

4545
Pane.styles = {
4646
outset: [border.px1, background.strong, border.strong, shadow.boxWeak].join(
47-
" "
47+
" ",
4848
),
4949
};

core/src/progress/circle.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const getViewBox = (strokeWidth: number) => {
4242
const getStroke = (props: ProgressCircleProps) => {
4343
const width = Math.min(
4444
MIN_STROKE_WIDTH,
45-
(STROKE_WIDTH * SIZE_LARGE) / props.size
45+
(STROKE_WIDTH * SIZE_LARGE) / props.size,
4646
);
4747
const value = props.value === "indeterminate" ? 0.25 : props.value;
4848
const offset = PATH_LENGTH - PATH_LENGTH * value;

core/src/step/step.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export const Steps = (props: Props): JSX.Element => {
6060
index={index}
6161
current={props.current}
6262
/>,
63-
<Divider key={`${index}-divider`} />
63+
<Divider key={`${index}-divider`} />,
6464
);
6565
});
6666
children.pop();

core/src/table/actions/actions.tsx

+17-18
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,26 @@ import s from "./actions.module.css";
88

99
const renderActions =
1010
<R,>(props: TableProps<R>, state: TableState) =>
11-
(_row: R, _index: number, rowKey: string): JSX.Element =>
12-
(
13-
<div className={s.container}>
14-
{props.selectable !== undefined && (
15-
<TableSelectableControl
16-
rowKey={rowKey}
17-
selectable={props.selectable}
18-
/>
19-
)}
20-
{props.expandable !== undefined && (
21-
<TableExpandableControl
22-
rowKey={rowKey}
23-
expandable={state.expandable}
24-
/>
25-
)}
26-
</div>
27-
);
11+
(_row: R, _index: number, rowKey: string): JSX.Element => (
12+
<div className={s.container}>
13+
{props.selectable !== undefined && (
14+
<TableSelectableControl
15+
rowKey={rowKey}
16+
selectable={props.selectable}
17+
/>
18+
)}
19+
{props.expandable !== undefined && (
20+
<TableExpandableControl
21+
rowKey={rowKey}
22+
expandable={state.expandable}
23+
/>
24+
)}
25+
</div>
26+
);
2827

2928
export const getTableActionsColumn = <R,>(
3029
props: TableProps<R>,
31-
state: TableState
30+
state: TableState,
3231
): TableColumn<R> => ({
3332
className: s.column,
3433
title: "",

core/src/table/actions/selectable/state.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export interface TableSelectableProps<T extends TableSelected> {
2222

2323
export const isTableRowSelected = (
2424
selected: TableSelected | undefined,
25-
rowKey: string
25+
rowKey: string,
2626
): boolean => {
2727
if (selected === undefined) return false;
2828
if (typeof selected === "string") return selected === rowKey;

core/src/table/body/cell.tsx

+5-3
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@ interface Props<R> {
1717
export const TableBodyCell = <R,>(props: Props<R>): JSX.Element => {
1818
const { column, row } = props;
1919
const children =
20-
typeof column.render === "function"
21-
? <>{column.render(row, props.rowIndex, props.rowKey)}</> // Render function
22-
: <>{row[column.render]}</>; // Accessor
20+
typeof column.render === "function" ? (
21+
<>{column.render(row, props.rowIndex, props.rowKey)}</> // Render function
22+
) : (
23+
<>{row[column.render]}</>
24+
); // Accessor
2325
const columnMeta = props.tableState.columnMetaMap.get(props.columnIndex);
2426
return (
2527
<td

core/src/table/column/column.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export type TableColumnMetaMap = Map<number, TableColumnMeta>;
1616
// These meta info can be calculated in each cell, but we put it here so it
1717
// can be calculated once for each table
1818
export const getTableColumnMetaMap = <R>(
19-
props: TableProps<R>
19+
props: TableProps<R>,
2020
): TableColumnMetaMap => {
2121
// We only have fixed meta for now. If we have more in the future, we should
2222
// merge them here

core/src/table/fixed/fixed.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { TableProps } from "../table";
2121
import s from "./fixed.module.css";
2222

2323
export const getTableFixedMetaMap = <R>(
24-
props: TableProps<R>
24+
props: TableProps<R>,
2525
): TableColumnMetaMap => {
2626
const map: TableColumnMetaMap = new Map();
2727
if (props.fixed === undefined) return map;

core/src/text-area/text-area.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ interface TextAreaComponent
6565

6666
const renderTextArea = (
6767
props: TextAreaProps,
68-
ref: React.ForwardedRef<HTMLTextAreaElement>
68+
ref: React.ForwardedRef<HTMLTextAreaElement>,
6969
): JSX.Element => {
7070
const rawProps = omit(props, [
7171
"className",

core/src/toast/container/container.tsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import toastController, { Toast as RHTToast, ToastType as RHTToastType, useToaster as useRHTToaster } from "react-hot-toast";
1+
import toastController, {
2+
Toast as RHTToast,
3+
ToastType as RHTToastType,
4+
useToaster as useRHTToaster,
5+
} from "react-hot-toast";
26
import { ToastPane, ToastPaneType } from "../pane/pane";
37
import s from "./container.module.css";
48

core/src/toast/toast.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const init = async (resolve: (div: HTMLDivElement) => void): Promise<void> => {
2222

2323
export const toast = async (
2424
type: ToastType,
25-
message: string
25+
message: string,
2626
): Promise<void> => {
2727
if (inited.current === false) await new Promise(init);
2828
type.handler(message);

0 commit comments

Comments
 (0)