Skip to content

Commit

Permalink
The lint warnings from chaire-lib-frontend (other than "unexpected an…
Browse files Browse the repository at this point in the history
…y") have been removed.

29 warnings got removed (122 to 93).
  • Loading branch information
GabrielBruno24 authored and tahini committed Dec 20, 2024
1 parent ba163b1 commit baf2eb4
Show file tree
Hide file tree
Showing 16 changed files with 29 additions and 29 deletions.
2 changes: 2 additions & 0 deletions packages/chaire-lib-frontend/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* License text available at https://opensource.org/licenses/MIT
*/
/* eslint-disable n/no-unpublished-require */
/* eslint-disable @typescript-eslint/no-var-requires */
/* eslint-disable @typescript-eslint/no-require-imports */
const baseConfig = require('../../tests/jest.config.base');

module.exports = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { withTranslation, WithTranslation } from 'react-i18next';
// FIXME Using the NoReload captcha (which can pose problems to users) because the "Reload Captcha" text is hardcoded in english. Switch when https://github.com/masroorejaz/react-simple-captcha/pull/2 is accepted
import {
loadCaptchaEnginge,
LoadCanvasTemplate,
LoadCanvasTemplateNoReload,
validateCaptcha as validateCaptchaMain
} from 'react-simple-captcha';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ export type DayRangeProps = WithTranslation & {
showPeriodDropdown?: boolean;
};

type dayRangeType = 'custom' | 'week' | 'week-end' | 'all';

const periodsGroupValues = {
week: [0, 1, 2, 3, 4],
'week-end': [5, 6],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@ export type InputCheckboxProps = InputCheckboxCommonProps & {
allowSelectAll?: boolean;
};

type defaultInputType = {
name: string;
disabled?: boolean;
};

class InputCheckboxInner extends React.Component<InputCheckboxProps> {
static defaultProps: Partial<InputCheckboxProps> = {
defaultValue: [],
Expand All @@ -54,13 +49,8 @@ class InputCheckboxInner extends React.Component<InputCheckboxProps> {
this.selectAll = this.selectAll.bind(this);
}

onContainerClick(value, e) {
onContainerClick(_value, e) {
e.stopPropagation();
const clickEvent = new MouseEvent('click', {
view: window,
bubbles: true,
cancelable: false
});
// this.onCheckboxInputChange({target: {value: value}})
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export class InputStringFormatted extends React.Component<InputStringFormattedPr
}

render(): React.ReactNode {
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
const { onValueUpdated, onValueChange, stringToValue, valueToString, value, ...inputProps } = this.props;
return <InputString onValueUpdated={this.handleChange} value={this.state.strValue} {...inputProps} />;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { faCheckCircle } from '@fortawesome/free-solid-svg-icons/faCheckCircle';
import Button from '../input/Button';
import serviceLocator from 'chaire-lib-common/lib/utils/ServiceLocator';
import { ObjectWithHistory } from 'chaire-lib-common/lib/utils/objects/ObjectWithHistory';
import { Saveable, isSaveable } from 'chaire-lib-common/lib/utils/objects/Saveable';
import { isSaveable } from 'chaire-lib-common/lib/utils/objects/Saveable';

export type SelectedObjectButtonsProps<T extends ObjectWithHistory<any>> = WithTranslation & {
object: T;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,23 @@
*/
import React from 'react';

type DefaultColumnFilterProps = {
column: {
filterValue: any;
_preFilteredRows: any;
setFilter: any;
};
};

/**
* Textbox input for column filter
*
* @param param0 description of the filtered column
* @returns
*/
export const DefaultColumnFilter = ({ column: { filterValue, _preFilteredRows, setFilter } }) => {
export const DefaultColumnFilter = ({
column: { filterValue, _preFilteredRows, setFilter }
}: DefaultColumnFilterProps) => {
return (
<input
value={filterValue || ''}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,20 +87,20 @@ const UsersComponent: React.FC = () => {
{
Header: t('admin:user:isAdmin'),
accessor: 'is_admin',
Cell: (props) => (
<input type="checkbox" className={'_input-checkbox'} disabled={true} checked={props.value} />
Cell: (cellProps) => (
<input type="checkbox" className={'_input-checkbox'} disabled={true} checked={cellProps.value} />
)
}
];
if (roles.length > 0) {
columns.push({
Header: t('admin:user:roles'),
accessor: 'permissions',
Cell: (props) => (
Cell: (cellProps) => (
<WidgetChangePermission
roles={roles}
currentValues={props.value}
userUuid={props.row.original.uuid}
currentValues={cellProps.value}
userUuid={cellProps.row.original.uuid}
/>
)
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ declare module 'react-table' {
UseResizeColumnsColumnProps<D>,
UseSortByColumnProps<D> {}

/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
export interface Cell<D extends Record<string, unknown> = Record<string, unknown>, V = any>
extends UseGroupByCellProps<D>,
UseRowStateCellProps<D> {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ type ForgotPasswordPageProps = {
};

const emailRegex =
/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;

const ForgotPasswordPage: React.FC<ForgotPasswordPageProps> = ({ config }) => {
const ForgotPasswordPage: React.FC<ForgotPasswordPageProps> = () => {
const { t } = useTranslation('auth');
const dispatch = useDispatch<ThunkDispatch<RootState, unknown, Action>>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import React from 'react';
import Loader from 'react-spinners/HashLoader';

const LoadingPage = function (props) {
const LoadingPage = function (props: { message?: string }) {
return (
<div className="_fill" style={{ flexDirection: 'column' }}>
{typeof props.message !== 'undefined' && <h1>{props.message}</h1>}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { connect } from 'react-redux';
import { withTranslation, WithTranslation } from 'react-i18next';
import appConfiguration from '../../config/application.config';
import LoginForm from '../forms/auth/localLogin/LoginForm';
import { redirect, useNavigate, NavigateFunction } from 'react-router';
import { useNavigate, NavigateFunction } from 'react-router';

export type LoginPageProps = {
isAuthenticated?: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ const ResetPasswordPage: React.FC = () => {
const { token } = useParams<{ token: string }>();
const submitButtonRef = React.useRef<HTMLButtonElement>(null);

const isAuthenticated = useSelector((state: RootState) => state.auth.isAuthenticated);
const status = useSelector((state: RootState) => state.auth.status as Status);

const [formState, setFormState] = React.useState({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export type PrivateRouteProps = RouteProps & {
config?: { [key: string]: unknown };
} & PropsWithChildren;

const PrivateRoute = ({ permissions, component: Component, children, ...rest }: PrivateRouteProps) => {
const PrivateRoute = ({ permissions, component: Component, children: _children, ...rest }: PrivateRouteProps) => {
return rest.isAuthenticated ? (
permissions ? (
rest.user.isAuthorized(permissions) ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type PublicRouteProps = RouteProps & {
config?: { [key: string]: unknown };
} & PropsWithChildren;

const PublicRoute = ({ component: Component, children, ...rest }: PublicRouteProps) => {
const PublicRoute = ({ component: Component, children: _children, ...rest }: PublicRouteProps) => {
return (
<React.Fragment>
<Header path={rest.path as string} appName={rest.config?.appName as string} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
import MapboxGL from 'mapbox-gl';
import _debounce from 'lodash/debounce';
import { lineString, bboxPolygon, bbox, feature } from '@turf/turf';
import { lineString, bboxPolygon, bbox } from '@turf/turf';

import serviceLocator from 'chaire-lib-common/lib/utils/ServiceLocator';
import Preferences from 'chaire-lib-common/lib/config/Preferences';
Expand Down

0 comments on commit baf2eb4

Please sign in to comment.