kiali/kiali

Consistent use of lodash library

Open

#6,339 opened on Jul 7, 2023

View on GitHub
 (0 comments) (0 reactions) (0 assignees)Go (562 forks)auto 404
help wantedmaintenance

Repository metrics

Stars
 (3,624 stars)
PR merge metrics
 (PR metrics pending)

Description

I have noticed that lodash library is used in 3 different ways within Kiali:

import _ from 'lodash';
import { isArray } from 'lodash';
import _isEqual from 'lodash/isEqual';

For best practices and maintenance, the code should be consistent and use always same pattern.

As we are using lodas-es that allows tree shaking (https://til.hashrocket.com/posts/dnzttruljf-prefer-lodash-es-when-using-webpack), IMO the best approach is to import just the lodash modules that we are going to use in the file:

import { isArray } from 'lodash-es';

Contributor guide