fix(lint): resolve 20 gocritic, eslint, and type safety issues
Backend (Go): - Add named return parameters for improved readability - Modernize octal literals (0755 → 0o755, 0644 → 0o644) - Replace nil with http.NoBody in test requests (3 instances) - Add error handling for rows.Close() in test helper - Close HTTP response bodies in network tests (3 instances) Frontend (React/TypeScript): - Add Fast Refresh export suppressions for UI components - Replace 'any' types with proper TypeScript types (6 instances) - Add missing useEffect dependency (calculateScore) - Remove unused variable in Playwright test Testing: - Backend coverage: 87.3% (threshold: 85%) - Frontend coverage: 87.75% (threshold: 85%) - All tests passing with race detection - Zero type errors Security: - CodeQL scans: Zero HIGH/CRITICAL findings - Trivy scan: Zero vulnerabilities - Pre-commit hooks: All passing
This commit is contained in:
@@ -2,7 +2,7 @@ import { render, screen, fireEvent, waitFor } from '@testing-library/react';
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
||||
import { describe, it, expect, vi } from 'vitest';
|
||||
import { SecurityHeaderProfileForm } from '../SecurityHeaderProfileForm';
|
||||
import { securityHeadersApi } from '../../api/securityHeaders';
|
||||
import { securityHeadersApi, type SecurityHeaderProfile } from '../../api/securityHeaders';
|
||||
|
||||
vi.mock('../../api/securityHeaders');
|
||||
|
||||
@@ -47,7 +47,7 @@ describe('SecurityHeaderProfileForm', () => {
|
||||
});
|
||||
|
||||
it('should render with initial data', () => {
|
||||
const initialData = {
|
||||
const initialData: Partial<SecurityHeaderProfile> = {
|
||||
id: 1,
|
||||
name: 'Test Profile',
|
||||
description: 'Test description',
|
||||
@@ -57,7 +57,7 @@ describe('SecurityHeaderProfileForm', () => {
|
||||
};
|
||||
|
||||
render(
|
||||
<SecurityHeaderProfileForm {...defaultProps} initialData={initialData as any} />,
|
||||
<SecurityHeaderProfileForm {...defaultProps} initialData={initialData as SecurityHeaderProfile} />,
|
||||
{ wrapper: createWrapper() }
|
||||
);
|
||||
|
||||
@@ -162,7 +162,7 @@ describe('SecurityHeaderProfileForm', () => {
|
||||
});
|
||||
|
||||
it('should disable form for presets', () => {
|
||||
const presetData = {
|
||||
const presetData: Partial<SecurityHeaderProfile> = {
|
||||
id: 1,
|
||||
name: 'Basic Security',
|
||||
is_preset: true,
|
||||
@@ -171,7 +171,7 @@ describe('SecurityHeaderProfileForm', () => {
|
||||
};
|
||||
|
||||
render(
|
||||
<SecurityHeaderProfileForm {...defaultProps} initialData={presetData as any} />,
|
||||
<SecurityHeaderProfileForm {...defaultProps} initialData={presetData as SecurityHeaderProfile} />,
|
||||
{ wrapper: createWrapper() }
|
||||
);
|
||||
|
||||
@@ -182,7 +182,7 @@ describe('SecurityHeaderProfileForm', () => {
|
||||
});
|
||||
|
||||
it('should show delete button for non-presets', () => {
|
||||
const profileData = {
|
||||
const profileData: Partial<SecurityHeaderProfile> = {
|
||||
id: 1,
|
||||
name: 'Custom Profile',
|
||||
is_preset: false,
|
||||
@@ -192,7 +192,7 @@ describe('SecurityHeaderProfileForm', () => {
|
||||
render(
|
||||
<SecurityHeaderProfileForm
|
||||
{...defaultProps}
|
||||
initialData={profileData as any}
|
||||
initialData={profileData as SecurityHeaderProfile}
|
||||
onDelete={mockOnDelete}
|
||||
/>,
|
||||
{ wrapper: createWrapper() }
|
||||
@@ -202,7 +202,7 @@ describe('SecurityHeaderProfileForm', () => {
|
||||
});
|
||||
|
||||
it('should not show delete button for presets', () => {
|
||||
const presetData = {
|
||||
const presetData: Partial<SecurityHeaderProfile> = {
|
||||
id: 1,
|
||||
name: 'Basic Security',
|
||||
is_preset: true,
|
||||
@@ -213,7 +213,7 @@ describe('SecurityHeaderProfileForm', () => {
|
||||
render(
|
||||
<SecurityHeaderProfileForm
|
||||
{...defaultProps}
|
||||
initialData={presetData as any}
|
||||
initialData={presetData as SecurityHeaderProfile}
|
||||
onDelete={mockOnDelete}
|
||||
/>,
|
||||
{ wrapper: createWrapper() }
|
||||
@@ -247,7 +247,7 @@ describe('SecurityHeaderProfileForm', () => {
|
||||
});
|
||||
|
||||
it('should show deleting state', () => {
|
||||
const profileData = {
|
||||
const profileData: Partial<SecurityHeaderProfile> = {
|
||||
id: 1,
|
||||
name: 'Custom Profile',
|
||||
is_preset: false,
|
||||
@@ -257,7 +257,7 @@ describe('SecurityHeaderProfileForm', () => {
|
||||
render(
|
||||
<SecurityHeaderProfileForm
|
||||
{...defaultProps}
|
||||
initialData={profileData as any}
|
||||
initialData={profileData as SecurityHeaderProfile}
|
||||
onDelete={mockOnDelete}
|
||||
isDeleting={true}
|
||||
/>,
|
||||
|
||||
Reference in New Issue
Block a user