Chore(front): Create a custom eslint rule for Props naming (#1904)
Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Matheus <matheus_benini@hotmail.com> Co-authored-by: bosiraphael <raphael.bosi@gmail.com>
This commit is contained in:
@@ -31,7 +31,7 @@ import { isFieldRelation } from '../types/guards/isFieldRelation';
|
||||
import { isFieldText } from '../types/guards/isFieldText';
|
||||
import { isFieldURL } from '../types/guards/isFieldURL';
|
||||
|
||||
type OwnProps = {
|
||||
type FieldInputProps = {
|
||||
onSubmit?: FieldInputEvent;
|
||||
onCancel?: () => void;
|
||||
onClickOutside?: FieldInputEvent;
|
||||
@@ -49,7 +49,7 @@ export const FieldInput = ({
|
||||
onShiftTab,
|
||||
onTab,
|
||||
onClickOutside,
|
||||
}: OwnProps) => {
|
||||
}: FieldInputProps) => {
|
||||
const { fieldDefinition } = useContext(FieldContext);
|
||||
|
||||
return (
|
||||
|
||||
+2
-2
@@ -4,7 +4,7 @@ import { Entity } from '@/ui/input/relation-picker/types/EntityTypeForSelect';
|
||||
import { getLogoUrlFromDomainName } from '~/utils';
|
||||
import { logError } from '~/utils/logError';
|
||||
|
||||
type OwnProps = {
|
||||
type ChipDisplayProps = {
|
||||
entityType: Entity;
|
||||
displayName: string;
|
||||
entityId: string | null;
|
||||
@@ -16,7 +16,7 @@ export const ChipDisplay = ({
|
||||
displayName,
|
||||
entityId,
|
||||
avatarUrlValue,
|
||||
}: OwnProps) => {
|
||||
}: ChipDisplayProps) => {
|
||||
switch (entityType) {
|
||||
case Entity.Company: {
|
||||
return (
|
||||
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
import { formatToHumanReadableDate } from '~/utils';
|
||||
|
||||
type OwnProps = {
|
||||
type DateDisplayProps = {
|
||||
value: Date | string | null | undefined;
|
||||
};
|
||||
|
||||
export const DateDisplay = ({ value }: OwnProps) => (
|
||||
export const DateDisplay = ({ value }: DateDisplayProps) => (
|
||||
<div>{value && formatToHumanReadableDate(value)}</div>
|
||||
);
|
||||
|
||||
+2
-2
@@ -7,11 +7,11 @@ const validateEmail = (email: string) => {
|
||||
return emailPattern.test(email.trim());
|
||||
};
|
||||
|
||||
type OwnProps = {
|
||||
type EmailDisplayProps = {
|
||||
value: string | null;
|
||||
};
|
||||
|
||||
export const EmailDisplay = ({ value }: OwnProps) =>
|
||||
export const EmailDisplay = ({ value }: EmailDisplayProps) =>
|
||||
value && validateEmail(value) ? (
|
||||
<ContactLink
|
||||
href={`mailto:${value}`}
|
||||
|
||||
+2
-2
@@ -9,11 +9,11 @@ const StyledTextInputDisplay = styled.div`
|
||||
width: 100%;
|
||||
`;
|
||||
|
||||
type OwnProps = {
|
||||
type MoneyDisplayProps = {
|
||||
value: number | null;
|
||||
};
|
||||
|
||||
export const MoneyDisplay = ({ value }: OwnProps) => (
|
||||
export const MoneyDisplay = ({ value }: MoneyDisplayProps) => (
|
||||
<StyledTextInputDisplay>
|
||||
{value ? `$${formatNumber(value)}` : ''}
|
||||
</StyledTextInputDisplay>
|
||||
|
||||
+2
-2
@@ -9,11 +9,11 @@ const StyledNumberDisplay = styled.div`
|
||||
width: 100%;
|
||||
`;
|
||||
|
||||
type OwnProps = {
|
||||
type NumberDisplayProps = {
|
||||
value: string | number | null;
|
||||
};
|
||||
|
||||
export const NumberDisplay = ({ value }: OwnProps) => (
|
||||
export const NumberDisplay = ({ value }: NumberDisplayProps) => (
|
||||
<StyledNumberDisplay>
|
||||
{value && formatNumber(Number(value))}
|
||||
</StyledNumberDisplay>
|
||||
|
||||
+2
-2
@@ -3,11 +3,11 @@ import { isValidPhoneNumber, parsePhoneNumber } from 'libphonenumber-js';
|
||||
|
||||
import { ContactLink } from '@/ui/link/components/ContactLink';
|
||||
|
||||
type OwnProps = {
|
||||
type PhoneDisplayProps = {
|
||||
value: string | null;
|
||||
};
|
||||
|
||||
export const PhoneDisplay = ({ value }: OwnProps) =>
|
||||
export const PhoneDisplay = ({ value }: PhoneDisplayProps) =>
|
||||
value && isValidPhoneNumber(value) ? (
|
||||
<ContactLink
|
||||
href={parsePhoneNumber(value, 'FR')?.getURI()}
|
||||
|
||||
+2
-2
@@ -7,10 +7,10 @@ const StyledTextInputDisplay = styled.div`
|
||||
width: 100%;
|
||||
`;
|
||||
|
||||
type OwnProps = {
|
||||
type TextDisplayProps = {
|
||||
text: string;
|
||||
};
|
||||
|
||||
export const TextDisplay = ({ text }: OwnProps) => (
|
||||
export const TextDisplay = ({ text }: TextDisplayProps) => (
|
||||
<StyledTextInputDisplay>{text}</StyledTextInputDisplay>
|
||||
);
|
||||
|
||||
+2
-2
@@ -14,7 +14,7 @@ const StyledRawLink = styled(RoundedLink)`
|
||||
}
|
||||
`;
|
||||
|
||||
type OwnProps = {
|
||||
type URLDisplayProps = {
|
||||
value: string | null;
|
||||
};
|
||||
|
||||
@@ -33,7 +33,7 @@ const checkUrlType = (url: string) => {
|
||||
return LinkType.Url;
|
||||
};
|
||||
|
||||
export const URLDisplay = ({ value }: OwnProps) => {
|
||||
export const URLDisplay = ({ value }: URLDisplayProps) => {
|
||||
const handleClick = (event: MouseEvent<HTMLElement>) => {
|
||||
event.stopPropagation();
|
||||
};
|
||||
|
||||
@@ -5,11 +5,11 @@ import { useBooleanField } from '../../hooks/useBooleanField';
|
||||
|
||||
import { FieldInputEvent } from './DateFieldInput';
|
||||
|
||||
type OwnProps = {
|
||||
type BooleanFieldInputProps = {
|
||||
onSubmit?: FieldInputEvent;
|
||||
};
|
||||
|
||||
export const BooleanFieldInput = ({ onSubmit }: OwnProps) => {
|
||||
export const BooleanFieldInput = ({ onSubmit }: BooleanFieldInputProps) => {
|
||||
const { fieldValue } = useBooleanField();
|
||||
|
||||
const persistField = usePersistField();
|
||||
|
||||
@@ -5,7 +5,7 @@ import { useChipField } from '../../hooks/useChipField';
|
||||
|
||||
import { FieldInputEvent } from './DateFieldInput';
|
||||
|
||||
type OwnProps = {
|
||||
type ChipFieldInputProps = {
|
||||
onClickOutside?: FieldInputEvent;
|
||||
onEnter?: FieldInputEvent;
|
||||
onEscape?: FieldInputEvent;
|
||||
@@ -19,7 +19,7 @@ export const ChipFieldInput = ({
|
||||
onClickOutside,
|
||||
onTab,
|
||||
onShiftTab,
|
||||
}: OwnProps) => {
|
||||
}: ChipFieldInputProps) => {
|
||||
const { fieldDefinition, contentFieldValue, hotkeyScope } = useChipField();
|
||||
|
||||
const persistField = usePersistField();
|
||||
|
||||
@@ -6,7 +6,7 @@ import { useDateField } from '../../hooks/useDateField';
|
||||
|
||||
export type FieldInputEvent = (persist: () => void) => void;
|
||||
|
||||
type OwnProps = {
|
||||
type DateFieldInputProps = {
|
||||
onClickOutside?: FieldInputEvent;
|
||||
onEnter?: FieldInputEvent;
|
||||
onEscape?: FieldInputEvent;
|
||||
@@ -18,7 +18,7 @@ export const DateFieldInput = ({
|
||||
onEnter,
|
||||
onEscape,
|
||||
onClickOutside,
|
||||
}: OwnProps) => {
|
||||
}: DateFieldInputProps) => {
|
||||
const { fieldValue, hotkeyScope } = useDateField();
|
||||
|
||||
const persistField = usePersistField();
|
||||
|
||||
@@ -6,7 +6,7 @@ import { useDoubleTextChipField } from '../../hooks/useDoubleTextChipField';
|
||||
|
||||
import { FieldInputEvent } from './DateFieldInput';
|
||||
|
||||
type OwnProps = {
|
||||
type DoubleTextChipFieldInputProps = {
|
||||
onClickOutside?: FieldInputEvent;
|
||||
onEnter?: FieldInputEvent;
|
||||
onEscape?: FieldInputEvent;
|
||||
@@ -20,7 +20,7 @@ export const DoubleTextChipFieldInput = ({
|
||||
onClickOutside,
|
||||
onTab,
|
||||
onShiftTab,
|
||||
}: OwnProps) => {
|
||||
}: DoubleTextChipFieldInputProps) => {
|
||||
const { fieldDefinition, firstValue, secondValue, hotkeyScope } =
|
||||
useDoubleTextChipField();
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import { useDoubleTextField } from '../../hooks/useDoubleTextField';
|
||||
|
||||
import { FieldInputEvent } from './DateFieldInput';
|
||||
|
||||
type OwnProps = {
|
||||
type DoubleTextFieldInputProps = {
|
||||
onClickOutside?: FieldInputEvent;
|
||||
onEnter?: FieldInputEvent;
|
||||
onEscape?: FieldInputEvent;
|
||||
@@ -20,7 +20,7 @@ export const DoubleTextFieldInput = ({
|
||||
onClickOutside,
|
||||
onTab,
|
||||
onShiftTab,
|
||||
}: OwnProps) => {
|
||||
}: DoubleTextFieldInputProps) => {
|
||||
const { fieldDefinition, firstValue, secondValue, hotkeyScope } =
|
||||
useDoubleTextField();
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import { useEmailField } from '../../hooks/useEmailField';
|
||||
|
||||
import { FieldInputEvent } from './DateFieldInput';
|
||||
|
||||
type OwnProps = {
|
||||
type EmailFieldInputProps = {
|
||||
onClickOutside?: FieldInputEvent;
|
||||
onEnter?: FieldInputEvent;
|
||||
onEscape?: FieldInputEvent;
|
||||
@@ -19,7 +19,7 @@ export const EmailFieldInput = ({
|
||||
onClickOutside,
|
||||
onTab,
|
||||
onShiftTab,
|
||||
}: OwnProps) => {
|
||||
}: EmailFieldInputProps) => {
|
||||
const { fieldDefinition, fieldValue, hotkeyScope } = useEmailField();
|
||||
|
||||
const persistField = usePersistField();
|
||||
|
||||
@@ -4,7 +4,7 @@ import { useMoneyField } from '../../hooks/useMoneyField';
|
||||
|
||||
export type FieldInputEvent = (persist: () => void) => void;
|
||||
|
||||
type OwnProps = {
|
||||
type MoneyFieldInputProps = {
|
||||
onClickOutside?: FieldInputEvent;
|
||||
onEnter?: FieldInputEvent;
|
||||
onEscape?: FieldInputEvent;
|
||||
@@ -18,7 +18,7 @@ export const MoneyFieldInput = ({
|
||||
onClickOutside,
|
||||
onTab,
|
||||
onShiftTab,
|
||||
}: OwnProps) => {
|
||||
}: MoneyFieldInputProps) => {
|
||||
const { fieldDefinition, fieldValue, hotkeyScope, persistMoneyField } =
|
||||
useMoneyField();
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import { useNumberField } from '../../hooks/useNumberField';
|
||||
|
||||
export type FieldInputEvent = (persist: () => void) => void;
|
||||
|
||||
type OwnProps = {
|
||||
type NumberFieldInputProps = {
|
||||
onClickOutside?: FieldInputEvent;
|
||||
onEnter?: FieldInputEvent;
|
||||
onEscape?: FieldInputEvent;
|
||||
@@ -18,7 +18,7 @@ export const NumberFieldInput = ({
|
||||
onClickOutside,
|
||||
onTab,
|
||||
onShiftTab,
|
||||
}: OwnProps) => {
|
||||
}: NumberFieldInputProps) => {
|
||||
const { fieldDefinition, fieldValue, hotkeyScope, persistNumberField } =
|
||||
useNumberField();
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import { usePhoneField } from '../../hooks/usePhoneField';
|
||||
|
||||
import { FieldInputEvent } from './DateFieldInput';
|
||||
|
||||
type OwnProps = {
|
||||
type PhoneFieldInputProps = {
|
||||
onClickOutside?: FieldInputEvent;
|
||||
onEnter?: FieldInputEvent;
|
||||
onEscape?: FieldInputEvent;
|
||||
@@ -18,7 +18,7 @@ export const PhoneFieldInput = ({
|
||||
onClickOutside,
|
||||
onTab,
|
||||
onShiftTab,
|
||||
}: OwnProps) => {
|
||||
}: PhoneFieldInputProps) => {
|
||||
const { fieldDefinition, fieldValue, hotkeyScope, persistPhoneField } =
|
||||
usePhoneField();
|
||||
|
||||
|
||||
@@ -5,11 +5,13 @@ import { useProbabilityField } from '../../hooks/useProbabilityField';
|
||||
|
||||
import { FieldInputEvent } from './DateFieldInput';
|
||||
|
||||
type OwnProps = {
|
||||
type ProbabilityFieldInputProps = {
|
||||
onSubmit?: FieldInputEvent;
|
||||
};
|
||||
|
||||
export const ProbabilityFieldInput = ({ onSubmit }: OwnProps) => {
|
||||
export const ProbabilityFieldInput = ({
|
||||
onSubmit,
|
||||
}: ProbabilityFieldInputProps) => {
|
||||
const { probabilityIndex } = useProbabilityField();
|
||||
|
||||
const persistField = usePersistField();
|
||||
|
||||
@@ -17,12 +17,15 @@ const StyledRelationPickerContainer = styled.div`
|
||||
top: -8px;
|
||||
`;
|
||||
|
||||
type OwnProps = {
|
||||
type RelationFieldInputProps = {
|
||||
onSubmit?: FieldInputEvent;
|
||||
onCancel?: () => void;
|
||||
};
|
||||
|
||||
export const RelationFieldInput = ({ onSubmit, onCancel }: OwnProps) => {
|
||||
export const RelationFieldInput = ({
|
||||
onSubmit,
|
||||
onCancel,
|
||||
}: RelationFieldInputProps) => {
|
||||
const { fieldDefinition, fieldValue } = useRelationField();
|
||||
|
||||
const persistField = usePersistField();
|
||||
|
||||
@@ -5,7 +5,7 @@ import { useTextField } from '../../hooks/useTextField';
|
||||
|
||||
import { FieldInputEvent } from './DateFieldInput';
|
||||
|
||||
type OwnProps = {
|
||||
type TextFieldInputProps = {
|
||||
onClickOutside?: FieldInputEvent;
|
||||
onEnter?: FieldInputEvent;
|
||||
onEscape?: FieldInputEvent;
|
||||
@@ -19,7 +19,7 @@ export const TextFieldInput = ({
|
||||
onClickOutside,
|
||||
onTab,
|
||||
onShiftTab,
|
||||
}: OwnProps) => {
|
||||
}: TextFieldInputProps) => {
|
||||
const { fieldDefinition, fieldValue, hotkeyScope } = useTextField();
|
||||
|
||||
const persistField = usePersistField();
|
||||
|
||||
@@ -4,7 +4,7 @@ import { useURLField } from '../../hooks/useURLField';
|
||||
|
||||
import { FieldInputEvent } from './DateFieldInput';
|
||||
|
||||
type OwnProps = {
|
||||
type URLFieldInputProps = {
|
||||
onClickOutside?: FieldInputEvent;
|
||||
onEnter?: FieldInputEvent;
|
||||
onEscape?: FieldInputEvent;
|
||||
@@ -18,7 +18,7 @@ export const URLFieldInput = ({
|
||||
onClickOutside,
|
||||
onTab,
|
||||
onShiftTab,
|
||||
}: OwnProps) => {
|
||||
}: URLFieldInputProps) => {
|
||||
const { fieldDefinition, fieldValue, hotkeyScope, persistURLField } =
|
||||
useURLField();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user