finos / a11y-theme-builder

DesignOps toolchain theme builder for accessibility inclusion using Atomic Design.
Apache License 2.0
33 stars 68 forks source link

[REQUEST] Code Cleanup: Remove Unused Imports and Variables #856

Open Sweetdevil144 opened 3 weeks ago

Sweetdevil144 commented 3 weeks ago

Code Cleanup Required

Suggestion/Concern

There are unused imports in some of the code files. For example, in one of the files, the hooks useRef and useLayoutEffect are imported from 'react' but are not used anywhere in the file code/src/ui/src/pages/DesignSystemPage.tsx. This is unnecessary and can lead to confusion.

Proposed Solution

Perform a thorough review of the codebase to identify any unused imports, variables, or other code elements. Once identified, these should be removed to keep the codebase clean and efficient. This will also help in improving the readability of the code and reduce the complexity. We can also add linter features to the same and implement linting before testing to keep track of such future issues.

Although I realise that MAYBE these will be utilised in near future, maintaining code quality is also an aspect we'll need to look over.

// For example, in the file `code/src/ui/src/pages/DesignSystemPage.tsx` we have:
import React, { useRef, useLayoutEffect, ReactNode } from 'react';

// But useRef and useLayoutEffect are not used anywhere in the file.
// So, the import statement should be cleaned up to:
import React, { ReactNode } from 'react';
Sweetdevil144 commented 3 weeks ago

Tagging @PaulaPaul , @aaronreed708 and @evangk6 for your views. I'd love to hear your thoughts on the same.

rahat2134 commented 3 weeks ago

@Sweetdevil144 can I go with the issue?

Sweetdevil144 commented 3 weeks ago

Hi @rahat2134 . I've already finished working on this issue and maintained end to end code quality locally. I'm waiting for the maintainer's review to create a PR for the same.

aaronreed708 commented 3 weeks ago

@Sweetdevil144 Thank you! Yes, we certainly have a lot of issues that lint would help with. If you have code ready to go, please submit a PR and I'll review it. Thank you for taking the time to open the issue and working on this!

Sweetdevil144 commented 3 weeks ago

Opening a PR soon as I get to my room :)

Sweetdevil144 commented 3 weeks ago

@aaronreed708 PR done and a custom .eslintrc.json was created. However, I'd like to remind that I haven't actually ran npm run lint:fix owing to the large amount of code cleanup. Approximately 35700 LOC changed when I tried doing it in a temp-branch (now deleted).

However, No issues were found to stop deployments after addition of linting.