Fix lint violations (vol.3) (#6301)

* Fix lint violations

* Refactor code for clarity and consistency

- Updated various components to improve readability and maintainability, including:
  - Changed `while (1)` to `while (true)` for better clarity.
  - Simplified conditional checks by removing unnecessary boolean casts.
  - Added missing `key` props in mapped elements to ensure proper rendering in lists.
  - Adjusted the handling of hidden states in budget components for clearer logic.
  - Cleaned up linting rules in `.oxlintrc.json` to streamline configuration.

* Enhance accessibility and linting compliance

- Updated `.oxlintrc.json` to add a warning for `jsx-a11y/no-autofocus` and removed several disabled rules.
- Added `aria-level` attributes to improve semantic structure in `Page.tsx`, `Modal.tsx`, and `ReportCardName.tsx`.
- Replaced `<label>` elements with `<Text>` components in various modals to ensure proper accessibility.
- Added `htmlFor` attributes to labels in `ImportTransactionsModal.tsx` for better form accessibility.
- Disabled specific linting rules inline to address accessibility concerns in `Image.jsx` and `Toggle.tsx`.

* Add new keywords to spelling allowlist

- Updated `.github/actions/docs-spelling/allow/keywords.txt` to include `oxfmt` and `oxlint` for improved spell-checking in documentation and code comments.

* Disable no-autofocus rule in .oxlintrc.json

* Update Trans component usage in MergeUnusedPayeesModal

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
Matiss Janis Aboltins
2025-12-09 21:39:50 +00:00
committed by GitHub
parent 5a4fc5823c
commit 0aa96ecaee
16 changed files with 45 additions and 29 deletions

View File

@@ -78,6 +78,7 @@ export function MobilePageHeader({
</View>
<View
role="heading"
aria-level={1}
style={{
textAlign: 'center',
alignItems: 'center',

View File

@@ -315,6 +315,7 @@ export function ModalHeader({
return (
<View
role="heading"
aria-level={1}
style={{
justifyContent: 'center',
alignItems: 'center',

View File

@@ -112,7 +112,7 @@ export function EditUserAccess({
onChange={(newValue: string) => setUserId(newValue)}
value={userId}
/>
<label
<Text
style={{
...styles.verySmallText,
color: theme.pageTextLight,
@@ -120,7 +120,7 @@ export function EditUserAccess({
}}
>
<Trans>Select a user from the directory</Trans>
</label>
</Text>
</View>
)}
{availableUsers.length === 0 && (

View File

@@ -221,7 +221,7 @@ function EditUser({ defaultUser, onSave: originalOnSave }: EditUserProps) {
borderColor: theme.buttonMenuBorder,
}}
/>
<label
<Text
style={{
...styles.verySmallText,
color: theme.pageTextLight,
@@ -229,7 +229,7 @@ function EditUser({ defaultUser, onSave: originalOnSave }: EditUserProps) {
}}
>
<Trans>The username registered within the OpenID provider.</Trans>
</label>
</Text>
</FormField>
<View
style={{
@@ -254,7 +254,7 @@ function EditUser({ defaultUser, onSave: originalOnSave }: EditUserProps) {
</View>
</SpaceBetween>
{isOwner && (
<label
<Text
style={{
...styles.verySmallText,
color: theme.errorText,
@@ -264,7 +264,7 @@ function EditUser({ defaultUser, onSave: originalOnSave }: EditUserProps) {
<Trans>
Change this username with caution; it is the server owner.
</Trans>
</label>
</Text>
)}
<SpaceBetween style={{ marginTop: 10 }}>
<FormField style={{ flex: 1 }}>
@@ -365,7 +365,7 @@ const RoleDescription = () => {
</Trans>
</Text>
<View style={{ paddingTop: 5 }}>
<label
<Text
style={{
...styles.altMenuHeaderText,
...styles.verySmallText,
@@ -373,7 +373,7 @@ const RoleDescription = () => {
}}
>
<Trans>Basic</Trans>
</label>
</Text>
<Text
style={{
...styles.verySmallText,
@@ -398,7 +398,7 @@ const RoleDescription = () => {
</Text>
</View>
<View style={{ paddingTop: 10 }}>
<label
<Text
style={{
...styles.altMenuHeaderText,
...styles.verySmallText,
@@ -406,7 +406,7 @@ const RoleDescription = () => {
}}
>
<Trans>Admin</Trans>
</label>
</Text>
<Text
style={{
...styles.verySmallText,

View File

@@ -970,6 +970,7 @@ export function ImportTransactionsModal({
<View style={{ marginLeft: 10, gap: 5 }}>
<SectionLabel title={t('CSV OPTIONS')} />
<label
htmlFor="csv-delimiter-select"
style={{
display: 'flex',
flexDirection: 'row',
@@ -979,6 +980,7 @@ export function ImportTransactionsModal({
>
<Trans>Delimiter:</Trans>
<Select
id="csv-delimiter-select"
options={[
[',', ','],
[';', ';'],
@@ -994,6 +996,7 @@ export function ImportTransactionsModal({
/>
</label>
<label
htmlFor="csv-skip-start-lines"
style={{
display: 'flex',
flexDirection: 'row',
@@ -1003,6 +1006,7 @@ export function ImportTransactionsModal({
>
<Trans>Skip start lines:</Trans>
<Input
id="csv-skip-start-lines"
type="number"
value={skipStartLines}
min="0"
@@ -1014,6 +1018,7 @@ export function ImportTransactionsModal({
/>
</label>
<label
htmlFor="csv-skip-end-lines"
style={{
display: 'flex',
flexDirection: 'row',
@@ -1023,6 +1028,7 @@ export function ImportTransactionsModal({
>
<Trans>Skip end lines:</Trans>
<Input
id="csv-skip-end-lines"
type="number"
value={skipEndLines}
min="0"

View File

@@ -1,5 +1,5 @@
import React, { useState, useRef, useEffect, useCallback } from 'react';
import { Trans } from 'react-i18next';
import { Trans, useTranslation } from 'react-i18next';
import { Button } from '@actual-app/components/button';
import { Paragraph } from '@actual-app/components/paragraph';
@@ -31,6 +31,7 @@ export function MergeUnusedPayeesModal({
payeeIds,
targetPayeeId,
}: MergeUnusedPayeesModalProps) {
const { t } = useTranslation();
const allPayees = usePayees();
const modalStack = useSelector(state => state.modals.modalStack);
const isEditingRule = !!modalStack.find(m => m.name === 'edit-rule');
@@ -177,6 +178,9 @@ export function MergeUnusedPayeesModal({
alignItems: 'center',
justifyContent: 'center',
}}
aria-label={t(
'Automatically rename these payees in the future',
)}
>
<input
type="checkbox"
@@ -184,9 +188,7 @@ export function MergeUnusedPayeesModal({
onChange={e => setShouldCreateRule(e.target.checked)}
/>
<Text style={{ marginLeft: 3 }}>
<Trans count={payees.length}>
Automatically rename these payees in the future
</Trans>
<Trans>Automatically rename these payees in the future</Trans>
</Text>
</label>
)}

View File

@@ -125,7 +125,7 @@ export function TransferOwnership({
value={userId}
defaultLabel={t('Select a user')}
/>
<label
<Text
style={{
...styles.verySmallText,
color: theme.pageTextLight,
@@ -136,8 +136,8 @@ export function TransferOwnership({
Select a user from the directory to designate as the new
budget owner.
</Trans>
</label>
<label
</Text>
<Text
style={{
...styles.verySmallText,
color: theme.errorText,
@@ -147,8 +147,8 @@ export function TransferOwnership({
{t(
'This action is irreversible, ownership of this budget file will only be able to be transferred by the server administrator or new owner.',
)}
</label>
<label
</Text>
<Text
style={{
...styles.verySmallText,
color: theme.errorText,
@@ -156,7 +156,7 @@ export function TransferOwnership({
}}
>
<Trans>Proceed with caution.</Trans>
</label>
</Text>
</View>
)}
{availableUsers.length === 0 && (

View File

@@ -144,7 +144,6 @@ export function FormulaResult({
{!loading && (
<View
ref={mergedRef as Ref<HTMLDivElement>}
role="text"
aria-label={displayValue}
style={{
alignItems: 'center',

View File

@@ -48,6 +48,7 @@ export const ReportCardName = ({
marginBottom: 5,
}}
role="heading"
aria-level={2}
>
{name}
</Block>

View File

@@ -74,7 +74,6 @@ export function SummaryNumber({
{!loading && (
<View
ref={mergedRef as Ref<HTMLDivElement>}
role="text"
aria-label={
value < 0
? t('Negative amount: {{amount}}', { amount: displayAmount })

View File

@@ -84,11 +84,11 @@ export function AuthSettings() {
<Trans>Disable OpenID</Trans>
</Button>
{multiuserEnabled && (
<label style={{ paddingTop: 5, color: theme.errorText }}>
<Text style={{ paddingTop: 5, color: theme.errorText }}>
<Trans>
Disabling OpenID will deactivate multi-user mode.
</Trans>
</label>
</Text>
)}
</>
)}