Skip to content

Commit

Permalink
add sideEffects option & fix lodash import
Browse files Browse the repository at this point in the history
  • Loading branch information
semkedaniil committed Jun 24, 2024
1 parent b781867 commit 61c131e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 19 deletions.
2 changes: 1 addition & 1 deletion db-viewer-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@skbkontur/db-viewer-ui",
"version": "1.0.0",
"sideEffects": false,
"description": "Database Viewer with custom configuration",
"main": "./index.js",
"license": "MIT",
Expand Down Expand Up @@ -50,7 +51,6 @@
"@skbkontur/edi-ui": "^0.2.4",
"@skbkontur/react-stack-layout": "^1.0.3",
"@skbkontur/react-ui-validations": "^1.8.3",
"date-fns": "^2.29.1",
"lodash": "^4.17.20",
"tslib": "^2.3.0"
},
Expand Down
14 changes: 7 additions & 7 deletions db-viewer-ui/src/Components/ObjectTypes/ObjectTypes.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { StringUtils } from "@skbkontur/edi-ui";
import { ThemeContext } from "@skbkontur/react-ui";
import _ from "lodash";
import groupBy from "lodash/groupBy";
import orderBy from "lodash/orderBy";
import toPairs from "lodash/toPairs";
import React from "react";

import { ObjectIdentifier } from "../../Domain/Api/DataTypes/ObjectIdentifier";
Expand All @@ -26,11 +28,9 @@ export function ObjectTypes({ objects, filter, identifierKeywords }: ObjectTypes
};

const getGrouped = (objects: ObjectIdentifier[]): Array<[string, ObjectIdentifier[]]> => {
return _(objects)
.orderBy(item => getIdentifierWithoutKeywords(item.identifier).toUpperCase())
.groupBy(item => getIdentifierWithoutKeywords(item.identifier)[0].toUpperCase())
.toPairs()
.value();
const orderedItems = orderBy(objects, item => getIdentifierWithoutKeywords(item.identifier).toUpperCase());
const grouped = groupBy(orderedItems, item => getIdentifierWithoutKeywords(item.identifier)[0].toUpperCase());
return toPairs(grouped);
};

const getFiltered = (objects: ObjectIdentifier[], filter: string): ObjectIdentifier[] => {
Expand Down Expand Up @@ -93,7 +93,7 @@ export function ObjectTypes({ objects, filter, identifierKeywords }: ObjectTypes
);
};

const categorized = _.groupBy(objects, x => x.schemaDescription.schemaName);
const categorized = groupBy(objects, x => x.schemaDescription.schemaName);
return (
<div data-tid="ObjectGroups">
{Object.keys(categorized).map(schemaName => renderSchema(schemaName, categorized[schemaName]))}
Expand Down
12 changes: 1 addition & 11 deletions db-viewer-ui/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1442,7 +1442,7 @@ __metadata:
languageName: node
linkType: hard

"@babel/runtime@npm:^7.0.0, @babel/runtime@npm:^7.12.13, @babel/runtime@npm:^7.12.5, @babel/runtime@npm:^7.17.8, @babel/runtime@npm:^7.18.3, @babel/runtime@npm:^7.21.0, @babel/runtime@npm:^7.5.5, @babel/runtime@npm:^7.8.4, @babel/runtime@npm:^7.8.7":
"@babel/runtime@npm:^7.0.0, @babel/runtime@npm:^7.12.13, @babel/runtime@npm:^7.12.5, @babel/runtime@npm:^7.17.8, @babel/runtime@npm:^7.18.3, @babel/runtime@npm:^7.5.5, @babel/runtime@npm:^7.8.4, @babel/runtime@npm:^7.8.7":
version: 7.23.8
resolution: "@babel/runtime@npm:7.23.8"
dependencies:
Expand Down Expand Up @@ -2317,7 +2317,6 @@ __metadata:
"@typescript-eslint/parser": "npm:^6.18.1"
"@vitejs/plugin-react": "npm:^4.2.1"
copyfiles: "npm:^2.4.1"
date-fns: "npm:^2.29.1"
eslint: "npm:^8.56.0"
eslint-config-prettier: "npm:^9.1.0"
eslint-import-resolver-node: "npm:^0.3.9"
Expand Down Expand Up @@ -4670,15 +4669,6 @@ __metadata:
languageName: node
linkType: hard

"date-fns@npm:^2.29.1":
version: 2.30.0
resolution: "date-fns@npm:2.30.0"
dependencies:
"@babel/runtime": "npm:^7.21.0"
checksum: 70b3e8ea7aaaaeaa2cd80bd889622a4bcb5d8028b4de9162cbcda359db06e16ff6e9309e54eead5341e71031818497f19aaf9839c87d1aba1e27bb4796e758a9
languageName: node
linkType: hard

"debug@npm:2.6.9, debug@npm:^2.6.9":
version: 2.6.9
resolution: "debug@npm:2.6.9"
Expand Down

0 comments on commit 61c131e

Please sign in to comment.