): JSX.Element => {
const { column, row } = props;
const children =
- typeof column.render === "function"
- ? <>{column.render(row, props.rowIndex, props.rowKey)}> // Render function
- : <>{row[column.render]}>; // Accessor
+ typeof column.render === "function" ? (
+ <>{column.render(row, props.rowIndex, props.rowKey)}> // Render function
+ ) : (
+ <>{row[column.render]}>
+ ); // Accessor
const columnMeta = props.tableState.columnMetaMap.get(props.columnIndex);
return (
;
// These meta info can be calculated in each cell, but we put it here so it
// can be calculated once for each table
export const getTableColumnMetaMap = (
- props: TableProps
+ props: TableProps,
): TableColumnMetaMap => {
// We only have fixed meta for now. If we have more in the future, we should
// merge them here
diff --git a/core/src/table/fixed/fixed.ts b/core/src/table/fixed/fixed.ts
index 204c5420..b8de5b5f 100644
--- a/core/src/table/fixed/fixed.ts
+++ b/core/src/table/fixed/fixed.ts
@@ -21,7 +21,7 @@ import { TableProps } from "../table";
import s from "./fixed.module.css";
export const getTableFixedMetaMap = (
- props: TableProps
+ props: TableProps,
): TableColumnMetaMap => {
const map: TableColumnMetaMap = new Map();
if (props.fixed === undefined) return map;
diff --git a/core/src/text-area/text-area.tsx b/core/src/text-area/text-area.tsx
index 8d05f94c..a33d1ae0 100644
--- a/core/src/text-area/text-area.tsx
+++ b/core/src/text-area/text-area.tsx
@@ -65,7 +65,7 @@ interface TextAreaComponent
const renderTextArea = (
props: TextAreaProps,
- ref: React.ForwardedRef
+ ref: React.ForwardedRef,
): JSX.Element => {
const rawProps = omit(props, [
"className",
diff --git a/core/src/toast/container/container.tsx b/core/src/toast/container/container.tsx
index 2735595e..ad4d8b8c 100644
--- a/core/src/toast/container/container.tsx
+++ b/core/src/toast/container/container.tsx
@@ -1,4 +1,8 @@
-import toastController, { Toast, ToastType, useToaster as useRHTToaster } from "react-hot-toast";
+import toastController, {
+ Toast,
+ ToastType,
+ useToaster as useRHTToaster,
+} from "react-hot-toast";
import { ToastPane, ToastPaneType } from "../pane/pane";
import s from "./container.module.css";
diff --git a/core/src/toast/toast.tsx b/core/src/toast/toast.tsx
index 6982ad7e..d3573365 100644
--- a/core/src/toast/toast.tsx
+++ b/core/src/toast/toast.tsx
@@ -22,7 +22,7 @@ const init = async (resolve: (div: HTMLDivElement) => void): Promise => {
export const toast = async (
type: ToastType,
- message: string
+ message: string,
): Promise => {
if (inited.current === false) await new Promise(init);
type.handler(message);
diff --git a/core/src/toast/type/type.ts b/core/src/toast/type/type.ts
index d4ccd8bb..a5ca0a7d 100644
--- a/core/src/toast/type/type.ts
+++ b/core/src/toast/type/type.ts
@@ -1,7 +1,7 @@
import RHTToast from "react-hot-toast";
import { ToastPane, ToastPaneType } from "../pane/pane";
-type ToastHandler = typeof RHTToast["success"];
+type ToastHandler = (typeof RHTToast)["success"];
export interface ToastType {
handler: ToastHandler;
diff --git a/core/src/tree/tree.tsx b/core/src/tree/tree.tsx
index a40dbe1b..1036aaac 100644
--- a/core/src/tree/tree.tsx
+++ b/core/src/tree/tree.tsx
@@ -75,15 +75,14 @@ export interface TreeProps {
parentMode: "select" | "expand";
}
-const renderChild = (treeProps: TreeProps) => (child: TreeNode) =>
- (
-
- );
+const renderChild = (treeProps: TreeProps) => (child: TreeNode) => (
+
+);
export const Tree = (props: TreeProps): JSX.Element => {
const expanded = props.expanded.has(props.node.id);
diff --git a/core/src/tree/utils/refresh.ts b/core/src/tree/utils/refresh.ts
index 401a3b88..d5386209 100644
--- a/core/src/tree/utils/refresh.ts
+++ b/core/src/tree/utils/refresh.ts
@@ -7,7 +7,7 @@ export interface RefreshTreeParams {
}
export const refreshTree = async (
- params: RefreshTreeParams
+ params: RefreshTreeParams,
): Promise => {
const { loadChildren, node } = params;
diff --git a/core/src/tree/utils/update.ts b/core/src/tree/utils/update.ts
index 3ccf6b09..d4ec71cf 100644
--- a/core/src/tree/utils/update.ts
+++ b/core/src/tree/utils/update.ts
@@ -19,7 +19,7 @@ export interface UpdateTreeNodeParams {
* version which can skip branches O(logN).
*/
export const updateTreeNode = (
- params: UpdateTreeNodeParams
+ params: UpdateTreeNodeParams,
): TreeNode => {
const { current, id, key, value } = params;
if (current.id === id) {
diff --git a/core/src/utils/omit.ts b/core/src/utils/omit.ts
index 6e4d15e8..dbf1eb23 100644
--- a/core/src/utils/omit.ts
+++ b/core/src/utils/omit.ts
@@ -3,14 +3,17 @@
type Keys = (keyof T)[];
interface OmitFunction {
- >(obj: T, keys: K): {
+ >(
+ obj: T,
+ keys: K,
+ ): {
[K2 in Exclude]: T[K2];
};
}
export const omit: OmitFunction = (obj, keys) => {
const ret = {} as {
- [K in keyof typeof obj]: typeof obj[K];
+ [K in keyof typeof obj]: (typeof obj)[K];
};
let key: keyof typeof obj;
for (key in obj) {
diff --git a/docs/src/color/background/background.tsx b/docs/src/color/background/background.tsx
index 2da9f31c..c4b0b8d7 100644
--- a/docs/src/color/background/background.tsx
+++ b/docs/src/color/background/background.tsx
@@ -10,15 +10,14 @@ interface Row {
const MakeColumn =
(theme: "light" | "dark", text: string) =>
- (row: Row): JSX.Element =>
- (
-
-
-
- );
+ (row: Row): JSX.Element => (
+
+
+
+ );
const LightStrong = MakeColumn("light", text.normal);
const LightWeak = MakeColumn("light", text.muted);
diff --git a/docs/src/color/border/border.tsx b/docs/src/color/border/border.tsx
index dcce464d..9dca1d11 100644
--- a/docs/src/color/border/border.tsx
+++ b/docs/src/color/border/border.tsx
@@ -10,15 +10,14 @@ interface Row {
const MakeColumn =
(theme: "light" | "dark", back: string) =>
- (row: Row): JSX.Element =>
- (
-
-
-
- );
+ (row: Row): JSX.Element => (
+
+
+
+ );
const LightStrong = MakeColumn("light", background.strong);
const LightWeak = MakeColumn("light", background.weak);
diff --git a/docs/src/color/sample/sample.tsx b/docs/src/color/sample/sample.tsx
index ea966b0e..0a9ef3a0 100644
--- a/docs/src/color/sample/sample.tsx
+++ b/docs/src/color/sample/sample.tsx
@@ -23,7 +23,7 @@ const getColor = (contrast: number): CategoryColor => {
const getContrast = (
props: Props,
backElement: HTMLDivElement,
- foreElement: HTMLElement
+ foreElement: HTMLElement,
): number => {
const back = window.getComputedStyle(backElement).backgroundColor;
const foreStyle = window.getComputedStyle(foreElement);
diff --git a/docs/src/color/static/table.tsx b/docs/src/color/static/table.tsx
index 34859caf..c896a51b 100644
--- a/docs/src/color/static/table.tsx
+++ b/docs/src/color/static/table.tsx
@@ -8,19 +8,17 @@ interface Props {
const Color =
(props: Props) =>
- (row: number): JSX.Element =>
- (
- // eslint-disable-next-line react/prop-types
-
- );
+ (row: number): JSX.Element => (
+ // eslint-disable-next-line react/prop-types
+
+ );
const Name =
(props: Props) =>
- (row: number): JSX.Element =>
- (
- // eslint-disable-next-line react/prop-types
-
- );
+ (row: number): JSX.Element => (
+ // eslint-disable-next-line react/prop-types
+
+ );
export const ColorStaticTable = (props: Props): JSX.Element => (
diff --git a/docs/src/color/text/text.tsx b/docs/src/color/text/text.tsx
index d3729577..d1a1a3e3 100644
--- a/docs/src/color/text/text.tsx
+++ b/docs/src/color/text/text.tsx
@@ -19,19 +19,18 @@ interface Row {
const MakeColumn =
(theme: "light" | "dark", back: string) =>
- (row: Row): JSX.Element =>
- (
-
-
-
- );
+ (row: Row): JSX.Element => (
+
+
+
+ );
const LightStrong = MakeColumn("light", background.strong);
const LightWeak = MakeColumn("light", background.weak);
diff --git a/docs/src/components/radio-group-fake.tsx b/docs/src/components/radio-group-fake.tsx
index cdbf6c5d..a855c145 100644
--- a/docs/src/components/radio-group-fake.tsx
+++ b/docs/src/components/radio-group-fake.tsx
@@ -5,5 +5,5 @@ import { RadioOption } from "../../../core/src";
* ArgsTable to describe the RadioOption interface.
*/
export const RadioOptionComponent =
(
- props: RadioOption
+ props: RadioOption,
): JSX.Element => {props.id}
;
diff --git a/docs/src/components/select-fake.tsx b/docs/src/components/select-fake.tsx
index ddb6e393..258f3bae 100644
--- a/docs/src/components/select-fake.tsx
+++ b/docs/src/components/select-fake.tsx
@@ -5,5 +5,5 @@ import { SelectOption } from "../../../core/src";
* ArgsTable to describe the SelectOption interface.
*/
export const SelectOptionComponent = (
- props: SelectOption
+ props: SelectOption,
): JSX.Element => {props.id}
;
diff --git a/docs/src/components/switcher-fake.tsx b/docs/src/components/switcher-fake.tsx
index c0c6daa6..5a111282 100644
--- a/docs/src/components/switcher-fake.tsx
+++ b/docs/src/components/switcher-fake.tsx
@@ -5,5 +5,5 @@ import { SwitcherOption } from "../../../core/src";
* ArgsTable to describe the Option interface.
*/
export const SwitcherOptionComponent = (
- props: SwitcherOption
+ props: SwitcherOption,
): JSX.Element => {props.key}
;
diff --git a/docs/src/components/table-fake.tsx b/docs/src/components/table-fake.tsx
index a7ed3f07..b98e9ba8 100644
--- a/docs/src/components/table-fake.tsx
+++ b/docs/src/components/table-fake.tsx
@@ -6,9 +6,9 @@ import { TableExpandableProps } from "../../../core/src";
* ArgsTable to describe the TableColumn interface.
*/
export const TableColumnComponent = (
- props: TableColumn
+ props: TableColumn,
): JSX.Element => {props.title}
;
export const TableExpandableComponent = (
- props: TableExpandableProps
+ props: TableExpandableProps,
): JSX.Element => {props.render.length}
;
diff --git a/eslint.config.mjs b/eslint.config.mjs
index 86d0ec3a..9af5fae8 100644
--- a/eslint.config.mjs
+++ b/eslint.config.mjs
@@ -10,45 +10,57 @@ import { FlatCompat } from "@eslint/eslintrc";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
- baseDirectory: __dirname,
- recommendedConfig: js.configs.recommended,
- allConfig: js.configs.all
+ baseDirectory: __dirname,
+ recommendedConfig: js.configs.recommended,
+ allConfig: js.configs.all,
});
-export default [{
- ignores: ["**/node_modules", "**/dist", "**/public", "test/coverage"],
-}, ...fixupConfigRules(compat.extends(
- "eslint:recommended",
- "plugin:@typescript-eslint/recommended",
- "plugin:react/recommended",
- "plugin:jest-dom/recommended",
- "prettier",
-)), {
- plugins: {
- "@typescript-eslint": fixupPluginRules(typescriptEslint),
- "jest-dom": fixupPluginRules(jestDom),
- },
+export default [
+ {
+ ignores: [
+ "**/node_modules",
+ "**/dist",
+ "**/public",
+ "test/coverage",
+ "**/docs/.storybook",
+ ],
+ },
+ ...fixupConfigRules(
+ compat.extends(
+ "eslint:recommended",
+ "plugin:@typescript-eslint/recommended",
+ "plugin:react/recommended",
+ "plugin:jest-dom/recommended",
+ "prettier",
+ ),
+ ),
+ {
+ plugins: {
+ "@typescript-eslint": fixupPluginRules(typescriptEslint),
+ "jest-dom": fixupPluginRules(jestDom),
+ },
- languageOptions: {
- parser: tsParser,
- ecmaVersion: 5,
- sourceType: "script",
+ languageOptions: {
+ parser: tsParser,
+ ecmaVersion: 5,
+ sourceType: "script",
- parserOptions: {
- project: "./tsconfig.json",
- },
- },
+ parserOptions: {
+ project: "./tsconfig.json",
+ },
+ },
- settings: {
- react: {
- version: "17",
- },
- },
+ settings: {
+ react: {
+ version: "17",
+ },
+ },
- rules: {
- "react/jsx-uses-react": "off",
- "react/react-in-jsx-scope": "off",
- "react/no-children-prop": "off",
- "react/display-name": "off",
- },
-}];
\ No newline at end of file
+ rules: {
+ "react/jsx-uses-react": "off",
+ "react/react-in-jsx-scope": "off",
+ "react/no-children-prop": "off",
+ "react/display-name": "off",
+ },
+ },
+];
diff --git a/gallery/scripts/example/generate.ts b/gallery/scripts/example/generate.ts
index 9f8585db..5286396a 100644
--- a/gallery/scripts/example/generate.ts
+++ b/gallery/scripts/example/generate.ts
@@ -56,11 +56,11 @@ const main = async () => {
fs.mkdir(distPath);
fs.writeFile(
path.resolve(distPath, "pokemons.json"),
- JSON.stringify(pokemons, null, 2)
+ JSON.stringify(pokemons, null, 2),
);
fs.writeFile(
path.resolve(distPath, "types.json"),
- JSON.stringify(types, null, 2)
+ JSON.stringify(types, null, 2),
);
return pokemons;
};
diff --git a/gallery/src/table/table.tsx b/gallery/src/table/table.tsx
index 5c27f161..f5ba49a9 100644
--- a/gallery/src/table/table.tsx
+++ b/gallery/src/table/table.tsx
@@ -78,7 +78,7 @@ const MaterialsHeader = (): JSX.Element => (
diff --git a/test/.swcrc b/test/.swcrc
index 30025bf1..9dad08e5 100644
--- a/test/.swcrc
+++ b/test/.swcrc
@@ -1,31 +1,31 @@
{
- "jsc": {
- "target": "es2017",
- "parser": {
- "syntax": "typescript",
- "tsx": true,
- "decorators": false,
- "dynamicImport": false
- },
- "transform": {
- "react": {
- "pragma": "React.createElement",
- "pragmaFrag": "React.Fragment",
- "throwIfNamespace": true,
- "development": false,
- "useBuiltins": false,
- "runtime": "automatic"
- },
- "hidden": {
- "jest": true
- }
- }
- },
- "module": {
- "type": "commonjs",
- "strict": false,
- "strictMode": true,
- "lazy": false,
- "noInterop": false
- }
+ "jsc": {
+ "target": "es2017",
+ "parser": {
+ "syntax": "typescript",
+ "tsx": true,
+ "decorators": false,
+ "dynamicImport": false
+ },
+ "transform": {
+ "react": {
+ "pragma": "React.createElement",
+ "pragmaFrag": "React.Fragment",
+ "throwIfNamespace": true,
+ "development": false,
+ "useBuiltins": false,
+ "runtime": "automatic"
+ },
+ "hidden": {
+ "jest": true
+ }
+ }
+ },
+ "module": {
+ "type": "commonjs",
+ "strict": false,
+ "strictMode": true,
+ "lazy": false,
+ "noInterop": false
+ }
}
diff --git a/test/jest.config.js b/test/jest.config.js
index dafd42c8..add10f17 100644
--- a/test/jest.config.js
+++ b/test/jest.config.js
@@ -2,6 +2,7 @@
// https://jestjs.io/docs/configuration
module.exports = {
+ // eslint-disable-line
collectCoverage: true,
coverageDirectory: "coverage",
coverageProvider: "v8",
diff --git a/test/src/button.test.tsx b/test/src/button.test.tsx
index 0c660c48..cbaf454e 100644
--- a/test/src/button.test.tsx
+++ b/test/src/button.test.tsx
@@ -57,11 +57,11 @@ describe("Button", () => {
render(
+ />,
);
expect(
- screen.queryByRole("button", { name: buttonLabel })
+ screen.queryByRole("button", { name: buttonLabel }),
).not.toBeInTheDocument();
const link = screen.getByRole("link", { name: buttonLabel });
expect(link).toHaveAttribute("rel", "noopener");
@@ -76,7 +76,7 @@ describe("Button", () => {
rel: "noopener",
onClick: onClickMockFn,
}}
- />
+ />,
);
const link = screen.getByRole("link", { name: buttonLabel });
userEvent.click(link);
diff --git a/test/src/radio.test.tsx b/test/src/radio.test.tsx
index d1a26918..d6efa181 100644
--- a/test/src/radio.test.tsx
+++ b/test/src/radio.test.tsx
@@ -9,7 +9,7 @@ describe("Testing Checkbox Uncontrolled Prop", () => {
render(
foo
-
+ ,
);
const radioElement = screen.getByRole("radio");
@@ -23,7 +23,7 @@ describe("Testing Checkbox Disabled Prop", () => {
render(
foo
-
+ ,
);
const radioElement = screen.getByRole("radio");
diff --git a/test/src/select.test.tsx b/test/src/select.test.tsx
index 8a8f85d9..129ffc14 100644
--- a/test/src/select.test.tsx
+++ b/test/src/select.test.tsx
@@ -20,7 +20,7 @@ describe("Testing Select Uncontrolled Props", () => {
defaultValue={"blue"}
id="select"
/>
-
+ ,
);
const selectElement = screen.getByLabelText("select");
expect(selectElement).toHaveValue("blue");
@@ -71,7 +71,7 @@ describe("Testing Select Disabled Props", () => {
select
-
+ ,
);
const selectElement = screen.getByLabelText("select");
@@ -92,7 +92,7 @@ describe("Testing Select Disabled Props", () => {
]}
id="select"
/>
-
+ ,
);
const selectElement = screen.getByLabelText("select");