Skip to content

Commit f7617e7

Browse files
authored
refactor(sonar): mark component props as read-only (typescript:S6759) (#3448)
1 parent 441ed44 commit f7617e7

44 files changed

Lines changed: 58 additions & 46 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎src/renderer/components/AllRead.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ interface AllReadProps {
1212
fullHeight?: boolean;
1313
}
1414

15-
export function AllRead({ fullHeight = true }: AllReadProps) {
15+
export function AllRead({ fullHeight = true }: Readonly<AllReadProps>) {
1616
const hasFilters = useFiltersStore((s) => s.hasActiveFilters());
1717

1818
const emoji = useMemo(() => randomElement(Constants.EMOJIS.ALL_READ), []);

‎src/renderer/components/Oops.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ interface OopsProps {
1515
fullHeight?: boolean;
1616
}
1717

18-
export function Oops({ error, fullHeight = true }: OopsProps) {
18+
export function Oops({ error, fullHeight = true }: Readonly<OopsProps>) {
1919
const navigate = useNavigate();
2020

2121
const err = error ?? Errors.UNKNOWN;

‎src/renderer/components/avatars/AvatarWithFallback.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export function AvatarWithFallback({
2626
size = Size.MEDIUM,
2727
userType = 'User',
2828
icon,
29-
}: AvatarWithFallbackProps) {
29+
}: Readonly<AvatarWithFallbackProps>) {
3030
const [hasBrokenAvatarSource, setHasBrokenAvatarSource] = useState(false);
3131

3232
const isNonHuman = isNonHumanUser(userType);

‎src/renderer/components/fields/FieldLabel.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ export interface FieldLabelProps {
33
label: string;
44
}
55

6-
export function FieldLabel(props: FieldLabelProps) {
6+
export function FieldLabel(props: Readonly<FieldLabelProps>) {
77
return (
88
<label className={'mr-1 font-medium cursor-pointer'} htmlFor={props.name}>
99
{props.label}

‎src/renderer/components/fields/RadioGroup.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export interface RadioGroupProps {
1616
tooltip?: ReactNode | string;
1717
}
1818

19-
export function RadioGroup(props: RadioGroupProps) {
19+
export function RadioGroup(props: Readonly<RadioGroupProps>) {
2020
return (
2121
<Stack align="center" className="text-sm" direction="horizontal" gap="condensed">
2222
<FieldLabel label={props.label} name={props.name} />

‎src/renderer/components/fields/Tooltip.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export interface TooltipProps {
1010
tooltip: ReactNode | string;
1111
}
1212

13-
export function Tooltip(props: TooltipProps) {
13+
export function Tooltip(props: Readonly<TooltipProps>) {
1414
const [shouldShowTooltipContents, setShouldShowTooltipContents] = useState(false);
1515

1616
const scrollContainerRef = useRef<HTMLElement | null>(null);

‎src/renderer/components/filters/FilterSection.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function FilterSectionComponent<K extends keyof FiltersState>({
3030
filterSetting,
3131
tooltip,
3232
layout = 'vertical',
33-
}: FilterSectionProps<K>) {
33+
}: Readonly<FilterSectionProps<K>>) {
3434
const { notifications } = useNotifications();
3535
const updateFilter = useFiltersStore((s) => s.updateFilter);
3636

‎src/renderer/components/filters/SearchFilterSuggestions.tsx‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ interface SearchFilterSuggestionsProps {
1717
inputValue: string;
1818
}
1919

20-
export function SearchFilterSuggestions({ open, inputValue }: SearchFilterSuggestionsProps) {
20+
export function SearchFilterSuggestions({
21+
open,
22+
inputValue,
23+
}: Readonly<SearchFilterSuggestionsProps>) {
2124
const detailedNotifications = useSettingsStore((s) => s.detailedNotifications);
2225

2326
if (!open) {

‎src/renderer/components/filters/TokenSearchInput.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export function TokenSearchInput({
2727
showSuggestionsOnFocusIfEmpty,
2828
onAdd,
2929
onRemove,
30-
}: TokenSearchInputProps) {
30+
}: Readonly<TokenSearchInputProps>) {
3131
const [inputValue, setInputValue] = useState('');
3232
const [shouldShowFilterSuggestions, setShouldShowFilterSuggestions] = useState(false);
3333

‎src/renderer/components/layout/AppLayout.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ interface AppLayoutProps {
1010
* AppLayout is the main container for the application.
1111
* It handles the basic layout with sidebar and content area.
1212
*/
13-
export function AppLayout({ children }: AppLayoutProps) {
13+
export function AppLayout({ children }: Readonly<AppLayoutProps>) {
1414
const setFocusRef = (el: HTMLButtonElement | null) => {
1515
if (el) {
1616
el.focus();

0 commit comments

Comments
 (0)