Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to airbnb eslint #466

Merged
merged 23 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions src/components/DirectoryItemSelector/directory-item-selector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,20 @@ interface DirectoryItemSelectorProps extends TreeViewFinderProps {
expanded?: UUID[];
}

function sortHandlingDirectories(
a: TreeViewFinderNodeProps,
b: TreeViewFinderNodeProps
): number {
// If children property is set it means it's a directory, they are handled differently in order to keep them at the top of the list
if (a.children && !b.children) {
return -1;
}
if (b.children && !a.children) {
return 1;
}
return a.name.localeCompare(b.name);
}

function DirectoryItemSelector({
open,
types,
Expand Down Expand Up @@ -332,24 +346,10 @@ function DirectoryItemSelector({
}
}, [open, updateRootDirectories, expanded, fetchDirectory]);

function sortHandlingDirectories(
a: TreeViewFinderNodeProps,
b: TreeViewFinderNodeProps
): number {
// If children property is set it means it's a directory, they are handled differently in order to keep them at the top of the list
if (a.children && !b.children) {
return -1;
}
if (b.children && !a.children) {
return 1;
}
return a.name.localeCompare(b.name);
}

return (
<TreeViewFinder
onTreeBrowse={fetchDirectory as (NodeId: string) => void}
sortMethod={(a, b) => sortHandlingDirectories(a, b)}
sortMethod={sortHandlingDirectories}
multiSelect // defaulted to true
open={open}
expanded={expanded as string[]}
Expand Down
2 changes: 1 addition & 1 deletion src/components/ElementSearchDialog/tag-renderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function TagRenderer({ element, ...props }: TagRendererProps) {
/>
);
}
return null;
return undefined;
ayolab marked this conversation as resolved.
Show resolved Hide resolved
}

export default TagRenderer;
5 changes: 3 additions & 2 deletions src/components/TopBar/AboutDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -539,9 +539,10 @@ function AboutDialog({
<>
{[...modules]
.sort(compareModules)
.map((module) => (
.map((module, idx) => (
<Module
key={`module-${module.name}`}
// eslint-disable-next-line react/no-array-index-key
ayolab marked this conversation as resolved.
Show resolved Hide resolved
key={`module-${idx}`}
type={module.type}
name={module.name}
version={module.version}
Expand Down
7 changes: 6 additions & 1 deletion src/components/inputs/react-hook-form/slider-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ function SliderInput({
field: { onChange, value },
} = useController({ name });

const handleValueChange = (event: Event, newValue: number | number[]) => {
const handleValueChange = (
event: Event,
newValue: number | number[],
// eslint-disable-next-line @typescript-eslint/no-unused-vars
activeThumb: number
) => {
onValueChanged(newValue);
onChange(newValue);
};
Expand Down
Loading