lint: move last remaining native eslint rules to oxlint (create new alternatives) (#6468)

* lint: clean up unnecessary config and disables

* fix: update package import path in browser preload script

* lint: create custom ESLint rules for rules not in oxlint

- Add object-shorthand-properties rule (replaces object-shorthand)
- Add prefer-const rule (replaces prefer-const)
- Add no-anchor-tag rule (replaces no-restricted-syntax for <a> tags)
- Add no-react-default-import rule (replaces no-restricted-syntax for React.*)

These custom rules are needed because oxlint doesn't support these rules yet.
All rules are properly tested and integrated into the ESLint config.

* refactor: enhance prefer-const rule to track variable reassignments by scope

- Introduced a mapping of scopes to reassigned variable names, improving the accuracy of the prefer-const rule.
- Added helper functions to determine variable scopes and reassignment status.
- Updated logic to check variable reassignments during declaration analysis.
- Adjusted test cases to reflect changes in variable handling.
This commit is contained in:
Matiss Janis Aboltins
2026-01-05 10:00:44 +01:00
committed by GitHub
parent 88fbfe7078
commit f1faf45659
17 changed files with 1162 additions and 57 deletions

View File

@@ -1,5 +1,5 @@
// @ts-strict-ignore
import React, { useEffect } from 'react';
import React, { Fragment, useEffect } from 'react';
import { useLocation } from 'react-router';
import { send } from 'loot-core/platform/client/fetch';
@@ -405,9 +405,7 @@ export function Modals() {
}
})
.map((modal, idx) => (
<React.Fragment key={`${modalStack[idx].name}-${idx}`}>
{modal}
</React.Fragment>
<Fragment key={`${modalStack[idx].name}-${idx}`}>{modal}</Fragment>
));
// fragment needed per TS types

View File

@@ -52,7 +52,6 @@ const ExternalLink = ({
}: ExternalLinkProps) => {
return (
// we can't use <ExternalLink /> here for obvious reasons
// eslint-disable-next-line no-restricted-syntax
<a
href={to ?? ''}
target="_blank"

View File

@@ -1,4 +1,4 @@
import React from 'react';
import React, { Fragment } from 'react';
import { useResponsive } from '@actual-app/components/hooks/useResponsive';
@@ -35,9 +35,7 @@ export function NotesTagFormatter({
switch (segment.type) {
case 'text':
return (
<React.Fragment key={index}>{segment.content}</React.Fragment>
);
return <Fragment key={index}>{segment.content}</Fragment>;
case 'tag':
if (isNarrowWidth) {