Skip to content

Commit fb27da2

Browse files
committed
fix: lint
1 parent 616f1a6 commit fb27da2

File tree

2 files changed

+22
-18
lines changed

2 files changed

+22
-18
lines changed

.github/copilot-instructions.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ npm run unused # Find unused code
175175
- Follow conventional commit message format
176176
- Use conventional commit format for PR titles with lowercase subjects (e.g., "fix: update api endpoints", "feat: add new component", "chore: update dependencies")
177177
- PR title subjects must be lowercase (no proper nouns, sentence-case, start-case, pascal-case, or upper-case)
178+
- PR title must not exceed 72 characters (keep them concise and descriptive)
178179
- Ensure all user-facing text is internationalized
179180
- Test with a local YDB instance when possible
180181

CLAUDE.md

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,13 @@ src/
9494
## Critical Bug Prevention Patterns
9595

9696
### Memory Management
97+
9798
- **ALWAYS** dispose Monaco Editor instances: `return () => editor.dispose();` in useEffect
9899
- **NEVER** allow memory leaks in long-running components
99100
- Clear timeouts and intervals in cleanup functions
100101

101102
### React Performance (MANDATORY)
103+
102104
- **ALWAYS** use `useMemo` for expensive computations and object/array creation
103105
- **ALWAYS** use `useCallback` for functions passed to dependencies
104106
- **ALWAYS** memoize table columns, filtered data, and computed values
@@ -107,18 +109,19 @@ src/
107109

108110
```typescript
109111
// ✅ REQUIRED patterns
110-
const displaySegments = useMemo(() =>
111-
segments.filter(segment => segment.visible), [segments]
112-
);
112+
const displaySegments = useMemo(() => segments.filter((segment) => segment.visible), [segments]);
113113
const handleClick = useCallback(() => {
114114
// logic
115115
}, [dependency]);
116116

117117
// ✅ PREFER direct callbacks over useEffect
118-
const handleInputChange = useCallback((value: string) => {
119-
setSearchTerm(value);
120-
onSearchChange?.(value);
121-
}, [onSearchChange]);
118+
const handleInputChange = useCallback(
119+
(value: string) => {
120+
setSearchTerm(value);
121+
onSearchChange?.(value);
122+
},
123+
[onSearchChange],
124+
);
122125

123126
// ❌ AVOID unnecessary useEffect
124127
// useEffect(() => {
@@ -127,11 +130,13 @@ const handleInputChange = useCallback((value: string) => {
127130
```
128131

129132
### Display Safety
133+
130134
- **ALWAYS** provide fallback values: `Number(value) || 0`
131135
- **NEVER** allow division by zero: `capacity > 0 ? value/capacity : 0`
132136
- **ALWAYS** handle null/undefined data gracefully
133137

134138
### Security & Input Validation
139+
135140
- **NEVER** expose authentication tokens in logs or console output
136141
- **ALWAYS** validate user input before processing
137142
- **NEVER** skip error handling for async operations
@@ -271,19 +276,17 @@ Uses React Router v5 hooks (`useHistory`, `useParams`, etc.). Always validate ro
271276

272277
```typescript
273278
// ✅ PREFERRED pattern for URL parameters
274-
const sortColumnSchema = z
275-
.enum(['column1', 'column2', 'column3'])
276-
.catch('column1');
279+
const sortColumnSchema = z.enum(['column1', 'column2', 'column3']).catch('column1');
277280

278281
const SortOrderParam: QueryParamConfig<SortOrder[]> = {
279-
encode: (value) => value ? encodeURIComponent(JSON.stringify(value)) : undefined,
280-
decode: (value) => {
281-
try {
282-
return value ? JSON.parse(decodeURIComponent(value)) : [];
283-
} catch {
284-
return [];
285-
}
286-
},
282+
encode: (value) => (value ? encodeURIComponent(JSON.stringify(value)) : undefined),
283+
decode: (value) => {
284+
try {
285+
return value ? JSON.parse(decodeURIComponent(value)) : [];
286+
} catch {
287+
return [];
288+
}
289+
},
287290
};
288291

289292
const [urlParam, setUrlParam] = useQueryParam('sort', SortOrderParam);

0 commit comments

Comments
 (0)