@checkstack/ui 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# @checkstack/ui
|
|
2
2
|
|
|
3
|
+
## 1.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- d1a2796: Enforce stricter code quality standards and eliminate AI slop anti-patterns.
|
|
8
|
+
|
|
9
|
+
**New utility**
|
|
10
|
+
|
|
11
|
+
- `extractErrorMessage(error, fallback?)` in `@checkstack/common` for consistent error extraction
|
|
12
|
+
|
|
13
|
+
**ESLint rules**
|
|
14
|
+
|
|
15
|
+
- `react-hooks/rules-of-hooks` and `exhaustive-deps` for hook correctness
|
|
16
|
+
- `no-console` in frontend packages — forces `toast` over silent `console.error`
|
|
17
|
+
- `no-restricted-syntax` banning `instanceof Error` — forces `extractErrorMessage`
|
|
18
|
+
- Custom `no-eslint-disable-any` rule preventing `@typescript-eslint/no-explicit-any` circumvention
|
|
19
|
+
|
|
20
|
+
**Refactoring**
|
|
21
|
+
|
|
22
|
+
- Replace 141 `instanceof Error` boilerplate patterns across the codebase
|
|
23
|
+
- Replace swallowed `console.error` with user-visible `toast.error()` feedback
|
|
24
|
+
- Remove 15 redundant `as` type casts in IntegrationsPage and ProviderConnectionsPage
|
|
25
|
+
- Consolidate 3 identical callback handlers into `handleDialogClose`
|
|
26
|
+
- Fix conditional React hook call in `FormField.tsx`
|
|
27
|
+
- Fix unstable useMemo deps in `Dashboard.tsx`
|
|
28
|
+
- Replace `useEffect`→`setState` with derived `useMemo` in `RegisterPage.tsx`
|
|
29
|
+
- Rewrite `keystore.test.ts` with typed `DrizzleMockChain` (eliminating 7 `any` suppressions)
|
|
30
|
+
- Delete obvious comments in `encryption.ts` and Teams `provider.ts`
|
|
31
|
+
|
|
32
|
+
- Updated dependencies [d1a2796]
|
|
33
|
+
- @checkstack/common@0.6.5
|
|
34
|
+
- @checkstack/frontend-api@0.3.9
|
|
35
|
+
|
|
3
36
|
## 1.2.0
|
|
4
37
|
|
|
5
38
|
### Minor Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@checkstack/ui",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"dependencies": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@types/react": "^18.2.0",
|
|
32
32
|
"@testing-library/react": "^16.0.0",
|
|
33
33
|
"@checkstack/test-utils-frontend": "0.0.4",
|
|
34
|
-
"@checkstack/tsconfig": "0.0.
|
|
34
|
+
"@checkstack/tsconfig": "0.0.5",
|
|
35
35
|
"@checkstack/scripts": "0.1.2"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
@@ -33,7 +33,8 @@ export const DynamicForm: React.FC<DynamicFormProps> = ({
|
|
|
33
33
|
if (JSON.stringify(merged) !== JSON.stringify(value)) {
|
|
34
34
|
onChange(merged);
|
|
35
35
|
}
|
|
36
|
-
|
|
36
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- Intentional: runs only on schema change. Including onChange would re-fire on parent re-renders; including value would cause an infinite loop since this effect calls onChange(merged)
|
|
37
|
+
}, [schema]);
|
|
37
38
|
|
|
38
39
|
// Compute validity and report changes
|
|
39
40
|
React.useEffect(() => {
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
|
|
14
14
|
import type { DynamicOptionsFieldProps, ResolverOption } from "./types";
|
|
15
15
|
import { getCleanDescription, NONE_SENTINEL } from "./utils";
|
|
16
|
+
import { extractErrorMessage } from "@checkstack/common";
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* Field component for dynamically resolved options.
|
|
@@ -72,7 +73,7 @@ export const DynamicOptionsField: React.FC<DynamicOptionsFieldProps> = ({
|
|
|
72
73
|
.catch((error_) => {
|
|
73
74
|
if (!cancelled) {
|
|
74
75
|
setError(
|
|
75
|
-
error_
|
|
76
|
+
extractErrorMessage(error_, "Failed to load options"),
|
|
76
77
|
);
|
|
77
78
|
setLoading(false);
|
|
78
79
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
2
|
import { Plus, Trash2 } from "lucide-react";
|
|
3
3
|
|
|
4
4
|
import {
|
|
@@ -37,6 +37,14 @@ export const FormField: React.FC<FormFieldProps> = ({
|
|
|
37
37
|
}) => {
|
|
38
38
|
const description = propSchema.description || "";
|
|
39
39
|
|
|
40
|
+
// Const field handling - must be before any early returns (rules-of-hooks)
|
|
41
|
+
const isConstField = propSchema.const !== undefined;
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (isConstField && value !== propSchema.const) {
|
|
44
|
+
onChange(propSchema.const);
|
|
45
|
+
}
|
|
46
|
+
}, [isConstField, value, propSchema.const, onChange]);
|
|
47
|
+
|
|
40
48
|
// Dynamic options via resolver
|
|
41
49
|
const resolverName = propSchema["x-options-resolver"];
|
|
42
50
|
if (resolverName && optionsResolvers) {
|
|
@@ -57,14 +65,7 @@ export const FormField: React.FC<FormFieldProps> = ({
|
|
|
57
65
|
);
|
|
58
66
|
}
|
|
59
67
|
|
|
60
|
-
|
|
61
|
-
if (propSchema.const !== undefined) {
|
|
62
|
-
// Silently ensure the value is set, no UI needed
|
|
63
|
-
React.useEffect(() => {
|
|
64
|
-
if (value !== propSchema.const) {
|
|
65
|
-
onChange(propSchema.const);
|
|
66
|
-
}
|
|
67
|
-
}, [value, propSchema.const, onChange]);
|
|
68
|
+
if (isConstField) {
|
|
68
69
|
return <></>;
|
|
69
70
|
}
|
|
70
71
|
|
|
@@ -653,7 +654,7 @@ const SecretField: React.FC<{
|
|
|
653
654
|
isRequired?: boolean;
|
|
654
655
|
onChange: (val: unknown) => void;
|
|
655
656
|
}> = ({ id, label, description, value, isRequired, onChange }) => {
|
|
656
|
-
const [showPassword, setShowPassword] =
|
|
657
|
+
const [showPassword, setShowPassword] = useState(false);
|
|
657
658
|
const currentValue = value || "";
|
|
658
659
|
const hasExistingValue = currentValue.length > 0;
|
|
659
660
|
|
|
@@ -702,7 +703,7 @@ const SecretTextareaField: React.FC<{
|
|
|
702
703
|
isRequired?: boolean;
|
|
703
704
|
onChange: (val: unknown) => void;
|
|
704
705
|
}> = ({ id, label, description, value, isRequired, onChange }) => {
|
|
705
|
-
const [showContent, setShowContent] =
|
|
706
|
+
const [showContent, setShowContent] = useState(false);
|
|
706
707
|
const currentValue = value || "";
|
|
707
708
|
const hasExistingValue = currentValue.length > 0;
|
|
708
709
|
|
|
@@ -723,7 +724,9 @@ const SecretTextareaField: React.FC<{
|
|
|
723
724
|
value={currentValue}
|
|
724
725
|
onChange={(e) => onChange(e.target.value)}
|
|
725
726
|
placeholder={
|
|
726
|
-
hasExistingValue
|
|
727
|
+
hasExistingValue
|
|
728
|
+
? "Leave empty to keep existing value"
|
|
729
|
+
: "Paste content here"
|
|
727
730
|
}
|
|
728
731
|
rows={5}
|
|
729
732
|
className="pr-10 font-mono text-xs"
|
|
@@ -750,7 +753,9 @@ const SecretTextareaField: React.FC<{
|
|
|
750
753
|
}
|
|
751
754
|
}}
|
|
752
755
|
placeholder={
|
|
753
|
-
hasExistingValue
|
|
756
|
+
hasExistingValue
|
|
757
|
+
? "Leave empty to keep existing value"
|
|
758
|
+
: "Paste content here"
|
|
754
759
|
}
|
|
755
760
|
rows={3}
|
|
756
761
|
className="pr-10"
|