Merged PR 170: Add new eslint rules

- naming-convention
- prefer-arrow-callback
- func-style
- import/no-default-export
This commit is contained in:
Eric Nguyen 2022-08-26 16:13:21 +00:00
parent 3f58c5ba5e
commit ad126c6c28
65 changed files with 781 additions and 784 deletions

View file

@ -1,6 +1,6 @@
import * as React from 'react';
import { IAvailableSymbol } from '../../Interfaces/IAvailableSymbol';
import { truncateString } from '../../utils/stringtools';
import { TruncateString } from '../../utils/stringtools';
interface ISymbolsProps {
componentOptions: IAvailableSymbol[]
@ -8,11 +8,11 @@ interface ISymbolsProps {
buttonOnClick: (type: string) => void
}
function handleDragStart(event: React.DragEvent<HTMLButtonElement>): void {
function HandleDragStart(event: React.DragEvent<HTMLButtonElement>): void {
event.dataTransfer.setData('type', (event.target as HTMLButtonElement).id);
}
export const Symbols: React.FC<ISymbolsProps> = (props: ISymbolsProps) => {
export function Symbols(props: ISymbolsProps): JSX.Element {
const listElements = props.componentOptions.map(componentOption => {
if (componentOption.Image.Url !== undefined || componentOption.Image.Base64Image !== undefined) {
const url = componentOption.Image.Base64Image ?? componentOption.Image.Url;
@ -23,7 +23,7 @@ export const Symbols: React.FC<ISymbolsProps> = (props: ISymbolsProps) => {
title={componentOption.Name}
onClick={() => props.buttonOnClick(componentOption.Name)}
draggable={true}
onDragStart={(event) => handleDragStart(event)}
onDragStart={(event) => HandleDragStart(event)}
>
<div>
<img
@ -32,7 +32,7 @@ export const Symbols: React.FC<ISymbolsProps> = (props: ISymbolsProps) => {
/>
</div>
<div>
{truncateString(componentOption.Name, 5)}
{TruncateString(componentOption.Name, 5)}
</div>
</button>);
}
@ -44,10 +44,10 @@ export const Symbols: React.FC<ISymbolsProps> = (props: ISymbolsProps) => {
title={componentOption.Name}
onClick={() => props.buttonOnClick(componentOption.Name)}
draggable={true}
onDragStart={(event) => handleDragStart(event)}
onDragStart={(event) => HandleDragStart(event)}
>
{truncateString(componentOption.Name, 5)}
{TruncateString(componentOption.Name, 5)}
</button>);
});