Skip to content

Conversation

@AlexImb
Copy link
Member

@AlexImb AlexImb commented Jul 2, 2025

Fix various linting issues to improve code quality and maintainability.

- Fixed 323+ linting issues (went from 371 to 48 remaining)
- Fixed unnecessary regex escape characters in all microlink services
- Fixed hasOwnProperty access security issues
- Added proper documentation for intentional empty base class methods
- Fixed formatting issues across all files
- All tests still passing (1057 tests)

Remaining issues are mostly warnings about 'any' types and intentional empty test mocks.
@AlexImb AlexImb requested review from Copilot and victorlap July 2, 2025 14:50
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR addresses various linting issues and code quality improvements across the codebase.

  • Replaced let and explicit type annotations with const or inferred types where appropriate
  • Simplified regex character classes, updated example URLs and SVG icons in service classes
  • Enhanced property definitions with JSDoc, improved hasOwnProperty checks, and cleaned up utility functions

Reviewed Changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/services/local.test.ts Switched letconst in tests
src/uppload.ts Replaced let with const for firstService
src/services/microlink/weheartit.ts Updated icon, color, exampleURL, and regex syntax
src/services/microlink/twitter.ts Updated icon, exampleURL, and regex syntax
src/services/microlink/tumblr.ts Updated icon, color, exampleURL, and regex syntax
src/services/microlink/reddit.ts Updated icon, color, exampleURL, and regex syntax
src/services/microlink/pinterest.ts Updated icon, color, exampleURL, and regex syntax
src/services/microlink/linkedin.ts Updated icon, color, exampleURL, and regex syntax
src/services/microlink/instagram.ts Simplified regex syntax
src/services/microlink/fotki.ts Simplified regex syntax
src/services/microlink/flipboard.ts Simplified regex syntax
src/services/microlink/flickr.ts Simplified regex syntax
src/services/microlink/facebook.ts Simplified regex syntax
src/services/microlink/deviantart.ts Simplified regex syntax
src/services/microlink/artstation.ts Simplified regex syntax
src/services/microlink/9gag.ts Simplified regex syntax
src/services/local.ts Removed redundant type annotation for maxFileSize
src/service.ts Added JSDoc to base methods and removed explicit type syntax
src/i18n/fa.ts Fixed indentation of a long string literal
src/helpers/utils.ts Removed explicit type annotations for default parameters
src/helpers/i18n.ts Replaced hasOwnProperty calls with safer Object.prototype
src/effects/flip/index.ts Replaced let with const for file
src/effect.ts Added JSDoc to base handler and removed explicit type syntax
Comments suppressed due to low confidence (3)

src/services/microlink/weheartit.ts:9

  • The updated regex for validator should have accompanying unit tests to ensure URLs still validate correctly, especially after syntax simplification.
    /(https?:\/\/(.+?\.)?weheartit\.com(\/[A-Za-z0-9\-._~:/?#[\]@!$&'()*+,;=]*)?)/.test(

tests/services/local.test.ts:39

  • Using const file = null prevents reassignment, but the test expects file to be set by service.dropHandler. Consider reverting to let or refactoring the handler to return the file instead of mutating this variable.
  const file = null;

tests/services/local.test.ts:45

  • Similarly here, const file = null cannot be updated by service.getFile, so expect(file).toBeDefined() will always fail. Use let or change the API to return the file.
  const file = null;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants