Skip to content

Commit

Permalink
fix(typescript): fix lint typo
Browse files Browse the repository at this point in the history
  • Loading branch information
maximedasilva committed Feb 29, 2024
1 parent f4dfcb8 commit bb72815
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 17 deletions.
7 changes: 6 additions & 1 deletion packages/react-d3-plugin/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,12 @@ export default [
{
input: './dist/types/react-d3-plugin/lib/index.d.ts',
output: [{ file: `dist/${name}.d.ts`, format: 'es' }],
external: [...defaultExternals, '@junipero/core', '@junipero/hooks', '@junipero/react'],
external: [
...defaultExternals,
'@junipero/core',
'@junipero/hooks',
'@junipero/react',
],

plugins: [

Expand Down
11 changes: 9 additions & 2 deletions packages/react/lib/Alerts/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ export declare type AlertsRef = {
innerRef: MutableRefObject<any>;
};

declare type AlertsTypes = 'danger' | 'default' | 'primary'| 'success' | 'warning';
declare type AlertsTypes =
'danger' |
'default' |
'primary'|
'success' |
'warning';

export declare interface AlertsProps extends ComponentPropsWithRef<any> {
animationTimeout?: number;
Expand Down Expand Up @@ -71,7 +76,9 @@ const Alerts = forwardRef(({
index={alert.id ?? index}
animate={alert.animate ?? animateAlert}
animationTimeout={alert.animationTimeout ?? animationTimeout}
icon={alert.icon ?? icons?.[alert.type as AlertsTypes] ?? icons?.default}
icon={
alert.icon ?? icons?.[alert.type as AlertsTypes] ?? icons?.default
}
lifespan={alert.duration ?? alert.lifespan}
onDismiss={onDismiss.bind(null, alert)}
className={alert.type}
Expand Down
2 changes: 1 addition & 1 deletion packages/react/lib/AlertsControl/index.test.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { renderHook, act } from '@testing-library/react';
import { ReactNode } from 'react';

import { useAlerts } from '../hooks';
import AlertsControl from '.';
import { ReactNode } from 'react';

describe('useAlerts()', () => {
it('should render hook', () => {
Expand Down
22 changes: 12 additions & 10 deletions packages/react/lib/Droppable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { classNames } from '@junipero/core';
import PropTypes from 'prop-types';

import { ForwardedProps } from '../utils';

export declare type DraggingPositionType = 'before' | 'after';
export declare interface DroppableProps extends ComponentPropsWithRef<any> {
className?: string;
Expand All @@ -22,18 +23,19 @@ export declare interface DroppableProps extends ComponentPropsWithRef<any> {
onDragLeave?(e: DragEvent): void;
}

const Droppable = forwardRef(({
className,
children,
disabled = false,
onDrop,
onDragOver,
onDragLeave,
...rest
}: DroppableProps, ref) => {
const Droppable = forwardRef((props: DroppableProps, ref) => {
const [dragging, setDragging] = useState(false);
const [stack, setStack] = useState(0);
const [draggingPos, setDraggingPos] = useState(null);
const {
className,
children,
disabled = false,
onDrop,
onDragOver,
onDragLeave,
...rest
} = props;

useEffect(() => {
if (stack <= 0) {
Expand Down Expand Up @@ -115,7 +117,7 @@ const Droppable = forwardRef(({
onDrop: onDrop_,
onDragOver: onDragOver_,
});
}); // TODO find a way to put ForwardedProps back
}) as ForwardedProps<DroppableProps, any>;

Droppable.displayName = 'Droppable';
Droppable.propTypes = {
Expand Down
4 changes: 3 additions & 1 deletion packages/react/lib/RadioField/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ const RadioField = forwardRef(({
valid: state.valid,
}));

const isChecked = (option: any) => parseValue(option) === parseValue(state.value);
const isChecked = (
option: any
) => parseValue(option) === parseValue(state.value);

const onChange_ = (option: any) => {
if (disabled || option.disabled) {
Expand Down
11 changes: 9 additions & 2 deletions packages/react/lib/TextField/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ import PropTypes from 'prop-types';

import { useFieldControl } from '../hooks';
import { MockState } from '../utils';
export declare type TextFieldChangeEvent = { value: string | number; valid: boolean; dirty: boolean }

export declare type TextFieldChangeEvent = {
value: string | number;
valid: boolean;
dirty: boolean
}
export declare type TextFieldRef = {
dirty: boolean;
focused: boolean;
Expand Down Expand Up @@ -127,7 +132,9 @@ const TextField = forwardRef(({
return !isNaN(parsedValue) ? parsedValue : value_;
};

const onChange_ = (e: ChangeEvent<HTMLTextAreaElement | HTMLInputElement>) => {
const onChange_ = (
e: ChangeEvent<HTMLTextAreaElement | HTMLInputElement>
) => {
/* html input disabled attribute will prevent onChange if present anyway */
/* istanbul ignore next: just in case */
if (disabled) {
Expand Down

0 comments on commit bb72815

Please sign in to comment.