Skip to content

Commit a496524

Browse files
authored
fix #283 - feat: Reduce warnings in build and test logs (#323)
* Created an helper to fix React act() warnings * removed console.log which is not needed anymore * Suppressed errorlog in DiagramEditorErrorBoundary.stories.tsx * fix SVG warnings in Edge tests with explicit wrapper * Add oxlint and oxfmt to i18n * Vanilla example: increase Vite chunk size warning limit * Block CI execution for linting issues --------- Signed-off-by: fantonangeli <fabrizio.antonangeli@gmail.com>
1 parent d50427e commit a496524

19 files changed

Lines changed: 180 additions & 138 deletions

File tree

.oxlintrc.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@
44
"rules": {
55
"react/react-in-jsx-scope": "off",
66
"typescript/no-unused-vars": ["warn", { "varsIgnorePattern": "^_" }],
7-
"typescript/no-explicit-any": "warn"
7+
"typescript/no-explicit-any": "warn",
8+
"jsx-a11y/prefer-tag-over-role": "off",
9+
"jsx-a11y/click-events-have-key-events": "off",
10+
"jsx-a11y/no-noninteractive-element-interactions": "off"
811
},
9-
"ignorePatterns": ["**/dist/", "**/dist-storybook/", "**/node_modules/"]
12+
"ignorePatterns": ["**/dist/", "**/dist-storybook/", "**/node_modules/"],
13+
"options": {
14+
"denyWarnings": true
15+
}
1016
}

examples/vanilla-web-component/vite.config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,7 @@ export default defineConfig({
2626
build: {
2727
emptyOutDir: false,
2828
sourcemap: true,
29+
// Raised to 5000 to suppress chunk size warning
30+
chunkSizeWarningLimit: 5000,
2931
},
3032
});

packages/i18n/.oxfmtrc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": ["../../.oxfmtrc.json"]
3+
}

packages/i18n/.oxlintrc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": ["../../.oxlintrc.json"]
3+
}

packages/i18n/package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@
2828
"scripts": {
2929
"clean": "rimraf ./dist",
3030
"build:dev": "pnpm clean && tsc -p tsconfig.json && vite build",
31-
"build:prod": "pnpm run build:dev && pnpm test",
31+
"build:prod": "pnpm lint && pnpm run build:dev && pnpm test",
32+
"lint": "oxlint --config .oxlintrc.json src/ tests/",
33+
"format": "oxfmt --config .oxfmtrc.json",
34+
"format:check": "oxfmt --config .oxfmtrc.json --check",
3235
"test": "vitest run"
3336
},
3437
"devDependencies": {
@@ -37,6 +40,8 @@
3740
"@types/node": "catalog:",
3841
"@types/react": "catalog:",
3942
"@types/react-dom": "catalog:",
43+
"oxfmt": "catalog:",
44+
"oxlint": "catalog:",
4045
"react": "catalog:",
4146
"react-dom": "catalog:",
4247
"rimraf": "catalog:",

packages/open-workflow-diagram-editor/src/components/ui/combobox.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ function ComboboxChip({
267267
);
268268
}
269269

270-
function ComboboxChipsInput({ className, children, ...props }: ComboboxPrimitive.Input.Props) {
270+
function ComboboxChipsInput({ className, ...props }: ComboboxPrimitive.Input.Props) {
271271
return (
272272
<ComboboxPrimitive.Input
273273
data-slot="combobox-chip-input"

packages/open-workflow-diagram-editor/stories/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ This directory contains Storybook stories and documentation.
2525
- **`examples/`** - Open Workflow Specification examples
2626
- **`use-cases/`** - Real-world use case examples
2727
- **`assets/`** - Images and media files used in stories
28+
- **`helpers.ts`** - Shared utilities for creating stories
2829

2930
## Running Storybook
3031

packages/open-workflow-diagram-editor/stories/examples/Examples.stories.tsx

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
import type { Meta, StoryObj } from "@storybook/react-vite";
1818
import { DiagramEditor } from "../features/DiagramEditor";
19+
import { createWorkflowStory } from "../helpers";
1920
import * as workflows from "./index";
2021

2122
const meta = {
@@ -33,25 +34,6 @@ export default meta;
3334
type Story = StoryObj<typeof meta>;
3435

3536
// Constants for shared configuration
36-
const DEFAULT_STORY_ARGS = {
37-
isReadOnly: true,
38-
locale: "en" as const,
39-
} as const;
40-
41-
/**
42-
* Factory function to create workflow story configurations
43-
* @param workflowContent - The YAML workflow content to display
44-
* @returns Story configuration object
45-
*/
46-
const createWorkflowStory = (workflowContent: string): Story => {
47-
return {
48-
args: {
49-
...DEFAULT_STORY_ARGS,
50-
content: workflowContent,
51-
},
52-
};
53-
};
54-
5537
// Story definitions using the factory function
5638
export const AccumulateRoomReadings: Story = createWorkflowStory(workflows.accumulateRoomReadings);
5739
export const AuthenticationOAuth2: Story = createWorkflowStory(workflows.authenticationOAuth2);

packages/open-workflow-diagram-editor/stories/features/DiagramEditor.stories.tsx

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
import type { Meta, StoryObj } from "@storybook/react-vite";
18-
18+
import { createWorkflowStory } from "../helpers";
1919
import { DiagramEditor } from "./DiagramEditor";
2020

2121
const workflowExample = `document:
@@ -107,13 +107,7 @@ const meta = {
107107
export default meta;
108108
type Story = StoryObj<typeof meta>;
109109

110-
export const Component: Story = {
111-
args: {
112-
isReadOnly: true,
113-
locale: "en",
114-
content: workflowExample,
115-
},
116-
};
110+
export const Component: Story = createWorkflowStory(workflowExample);
117111

118112
/* The two stories below each isolate ONE piece of spec syntax the editor must accept,
119113
* and both must render clean (no error badge).
@@ -147,19 +141,7 @@ do:
147141
roomId: \${ .roomid }`;
148142

149143
/* A URI is an RFC 3986 URI-reference, so a relative one is valid and must not error. */
150-
export const RelativeUriEndpoint: Story = {
151-
args: {
152-
isReadOnly: true,
153-
locale: "en",
154-
content: relativeUriEndpointExample,
155-
},
156-
};
144+
export const RelativeUriEndpoint: Story = createWorkflowStory(relativeUriEndpointExample);
157145

158146
/* `source` is optional when emitting (runtimes generate it from the workflow) — so omitting it must not error. */
159-
export const EmitWithoutSource: Story = {
160-
args: {
161-
isReadOnly: true,
162-
locale: "en",
163-
content: emitWithoutSourceExample,
164-
},
165-
};
147+
export const EmitWithoutSource: Story = createWorkflowStory(emitWithoutSourceExample);

packages/open-workflow-diagram-editor/stories/features/DiagramEditorDragNDrop.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,6 @@ export const DiagramEditorDragNDrop = (props: Omit<DiagramEditorProps, "content"
7171
e.target.value = "";
7272
};
7373

74-
/* TODO: Remove this console log when the DiagramEditor is using the content from the param */
75-
console.log("### content updated:\n", content);
76-
7774
return (
7875
<div style={{ height: "100vh" }}>
7976
<div

0 commit comments

Comments
 (0)