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

feat: remove unused exports, functions and files #1750

Merged
merged 1 commit into from
Dec 12, 2024
Merged

Conversation

artemmufazalov
Copy link
Member

@artemmufazalov artemmufazalov commented Dec 12, 2024

  • Added command, that searches for unused code
  • Removed unused code
  • Removed unused imports
  • Added some imports to lib.ts - everything should be imported from there, when app is used as package

There are still unused exports and files, I didn't delete everything

CI Results

Test Status: ⚠️ FLAKY

📊 Full Report

Total Passed Failed Flaky Skipped
222 221 0 1 0

😟 No changes in tests. 😕

Bundle Size: 🔽

Current: 65.84 MB | Main: 65.86 MB
Diff: 0.01 MB (-0.02%)

✅ Bundle size decreased.

ℹ️ CI Information
  • Test recordings for failed tests are available in the full report.
  • Bundle size is measured for the entire 'dist' directory.
  • 📊 indicates links to detailed reports.
  • 🔺 indicates increase, 🔽 decrease, and ✅ no change in bundle size.

@@ -69,7 +69,7 @@
"lint:styles": "stylelint 'src/**/*.{css,scss}'",
"lint:other": "npm run prettier -- --check",
"prettier": "prettier '**/*.{json,yaml,yml,md}'",
"unimported": "npx unimported --no-cache",
"unused": "npx knip --include dependencies,files,exports,types",
Copy link
Member Author

@artemmufazalov artemmufazalov Dec 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unimported is marked as deprecated now in favor of knip. knip can search not only unused files and deps, but also unused exports. When unused export is deleted and function is not used locally, it will be marked by our linter

@@ -62,6 +63,7 @@ export function Operations({database}: OperationsProps) {
{data ? (
<ResizeableDataTable
columns={getColumns({database, refreshTable: refetch})}
columnsWidthLSKey={OPERATIONS_SELECTED_COLUMNS_KEY}
Copy link
Member Author

@artemmufazalov artemmufazalov Dec 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This property was declared, but was not passed

Comment on lines +19 to +22
const b = cn('ydb-storage-nodes');

const getRowUnavailableClassName = (row: PreparedStorageNode) =>
b('node', {unavailable: isUnavailableNode(row)});
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code from StorageNodes/shared.ts


import {StorageNodesEmptyDataMessage} from './StorageNodesEmptyDataMessage';
import {STORAGE_NODES_COLUMNS_WIDTH_LS_KEY} from './columns/constants';
import type {StorageNodesColumn} from './columns/types';
import {getStorageNodes} from './getNodes';
import i18n from './i18n';
import {getRowUnavailableClassName} from './shared';

import './StorageNodes.scss';
Copy link
Member Author

@artemmufazalov artemmufazalov Dec 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

File was not imported, so unavailable nodes weren't grey

@@ -15,7 +15,7 @@ const initialState: ITooltipState = {
toolTipVisible: false,
currentHoveredRef: undefined,
data: undefined,
templateType: 'pool',
templateType: 'cell',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our redux tooltip requires some initial value to be set

@artemmufazalov artemmufazalov added this pull request to the merge queue Dec 12, 2024
Merged via the queue into main with commit cdf9ebc Dec 12, 2024
8 checks passed
@artemmufazalov artemmufazalov deleted the remove-unused branch December 12, 2024 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants