Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
dcordz committed Aug 26, 2024
1 parent e06c594 commit 97e018d
Show file tree
Hide file tree
Showing 10 changed files with 105 additions and 55 deletions.
2 changes: 1 addition & 1 deletion app/frontend/components/LoginBubbles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const LoginBubbles: React.FC<IProps> = ({ title, isBubbles, children }) => {
return img;
}),
);
} catch (error) {}
} catch (_error) {}
}, []);

return (
Expand Down
4 changes: 1 addition & 3 deletions app/frontend/components/bill/BillSummaryTextWithLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
const extractAnchorTextFromString = (string: string): [string, string, string][] => {
const matches = [] as [string, string, string][];
string.replace(/[^<]*(<a href="([^"]+)">([^<]+)<\/a>)/g, function (...args: string[]) {
// eslint-disable-line
// eslint-disable-next-line
// @ts-ignore
// @ts-expect-error - Argument of type 'any[]' is not assignable to parameter of type '[string, string, string]'.
matches.push(Array.prototype.slice.call(args, 1, 4));
return "";
});
Expand Down
2 changes: 1 addition & 1 deletion app/frontend/entrypoints/application.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ document.addEventListener("DOMContentLoaded", () => {
const LayoutComponent = NO_AUTH_LAYOUTS.includes(pageName.toLowerCase()) ? NoAuthLayout : LayoutWithPage;

return Promise.resolve(pages[`../pages/${pageName}.tsx`]()).then((_page) => {
let page = _page && "default" in _page ? _page.default : _page;
const page = _page && "default" in _page ? _page.default : _page;

if (page) {
page.layout = page.layout || LayoutComponent;
Expand Down
12 changes: 3 additions & 9 deletions app/frontend/hooks/elements/useOpenCloseElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,17 @@ export interface IDimensions {
}

export const useOpenCloseElement = (
ref: React.RefObject<any>, // eslint-disable-line
ref: React.RefObject<any>,
defaultState = false,
): [boolean, React.Dispatch<React.SetStateAction<boolean>>] => {
const [open, setOpen] = useState<boolean>(defaultState);

const handleClose = useCallback(() => setOpen(false), []);

const esc = useCallback((e: KeyboardEvent) => e.code === KEYCODE_ESC, []);
const outside = useCallback(
(e: Event) => ref.current && !ref.current.contains(e.target),
[ref],
);
const outside = useCallback((e: Event) => ref.current && !ref.current.contains(e.target), [ref]);

const handleClick = useCallback(
(e: Event) => outside(e) && handleClose(),
[outside, handleClose],
);
const handleClick = useCallback((e: Event) => outside(e) && handleClose(), [outside, handleClose]);
const handleKeyDown = useCallback(
(e: KeyboardEvent) => esc(e) && outside(e) && handleClose(),
[esc, outside, handleClose],
Expand Down
8 changes: 6 additions & 2 deletions app/frontend/hooks/useAxios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,12 @@ const handleAxiosError = (ex: AxiosError | Error) => {
};

const handleRoutedResponse = (result: IRoutableResponse) => {
result.phone && localStorage.setItem("@sway/phone", removeNonDigits(result.phone));
result.route && router.visit(result.route);
if (result.phone) {
localStorage.setItem("@sway/phone", removeNonDigits(result.phone));
}
if (result.route) {
router.visit(result.route);
}
};

/*
Expand Down
2 changes: 0 additions & 2 deletions app/frontend/hooks/useCancellable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ export const useCancellable = () => {

return useCallback(
async <T>(promise: Promise<T>, onCancel?: () => void) =>
// eslint-disable-next-line
new Promise<T>(async (resolve, reject) => {
// NOSONAR
try {
const result = await promise;
if (isMounted()) {
Expand Down
2 changes: 0 additions & 2 deletions app/frontend/sway_constants/locales.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@

export const CONGRESS_LOCALE_NAME = "congress-congress-united_states";

// eslint-disable-next-line
export enum ELocaleName {
BALTIMORE = "baltimore-maryland-united_states",
BALTIMORE_COUNTY = "baltimore_county-maryland-united_states",
Expand Down
8 changes: 5 additions & 3 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import rulesOfHooks from "eslint-plugin-react-hooks";
import eslintImport from "eslint-plugin-import";
import typescriptParser from "@typescript-eslint/parser";
import typescriptEslint from "@typescript-eslint/eslint-plugin";
import { fixupPluginRules } from "@eslint/compat";

export default [
// pluginJs.configs.recommended,
Expand All @@ -33,7 +34,7 @@ export default [
plugins: {
"@typescript-eslint": typescriptEslint,
"react-refresh": reactRefresh,
"react-hooks": rulesOfHooks,
"react-hooks": fixupPluginRules(rulesOfHooks),
import: eslintImport,
},
},
Expand All @@ -48,8 +49,9 @@ export default [
rules: {
"react-refresh/only-export-components": ["warn", { allowConstantExport: true }],

"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
// "react-hooks/rules-of-hooks": "error",
// "react-hooks/exhaustive-deps": "warn",
...rulesOfHooks.configs.recommended.rules,

// "react/prop-types": "off",
// "react/react-in-jsx-scope": "off",
Expand Down
111 changes: 83 additions & 28 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@react-google-maps/api": "^2.19.3",
"@sentry/react": "^8.26.0",
"@sentry/tracing": "^7.114.0",
"axios": "^1.7.4",
"axios": "^1.7.5",
"bootstrap": "^5.3.3",
"chart.js": "^4.4.4",
"copy-to-clipboard": "^3.3.3",
Expand All @@ -38,16 +38,17 @@
"yup": "^1.4.0"
},
"devDependencies": {
"@eslint/js": "^9.9.0",
"@eslint/compat": "^1.1.1",
"@eslint/js": "^9.9.1",
"@types/eslint__js": "^8.42.3",
"@types/lodash": "^4.17.7",
"@types/node": "^20.12.13",
"@types/react": "^18.3.4",
"@types/react-dom": "^18.3.0",
"@vitejs/plugin-react": "^4.3.1",
"dart-sass": "^1.25.0",
"eslint": "^9.9.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint": "^9.9.1",
"eslint-import-resolver-typescript": "^3.6.3",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsx-a11y": "^6.9.0",
"eslint-plugin-promise": "^7.1.0",
Expand Down

0 comments on commit 97e018d

Please sign in to comment.