Skip to content

fix(styles): Add ESLint config and improve GoogleSafeBrowsing tests #25

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

Merged
merged 1 commit into from
Dec 1, 2024

Conversation

hckhanh
Copy link
Owner

@hckhanh hckhanh commented Dec 1, 2024

Introduce a new ESLint configuration with plugins for enhanced code quality, while removing .codacy.yml. The test for GoogleSafeBrowsing was improved by awaiting expectations for better async handling. Updated the GitHub workflow to trigger only on pull requests and added necessary dependencies to pnpm-lock.yaml.

Summary by Sourcery

Add ESLint configuration with plugins to improve code quality, update GoogleSafeBrowsing tests for better async handling, and modify GitHub workflow to trigger on pull requests only. Remove .codacy.yml and update pnpm-lock.yaml with necessary dependencies.

Bug Fixes:

  • Improve GoogleSafeBrowsing test by awaiting expectations for better async handling.

Enhancements:

  • Introduce a new ESLint configuration with plugins for enhanced code quality.

CI:

  • Update GitHub workflow to trigger only on pull requests.

Tests:

  • Enhance GoogleSafeBrowsing test to handle async operations more effectively.

Chores:

  • Remove .codacy.yml configuration file.

Introduce a new ESLint configuration with plugins for enhanced code quality, while removing .codacy.yml. The test for GoogleSafeBrowsing was improved by awaiting expectations for better async handling. Updated the GitHub workflow to trigger only on pull requests and added necessary dependencies to pnpm-lock.yaml.
Copy link

sourcery-ai bot commented Dec 1, 2024

Reviewer's Guide by Sourcery

This PR introduces ESLint configuration with TypeScript support and improves code quality through various changes. The implementation adds a new ESLint config file with perfectionist plugin for enforcing consistent code style, removes Codacy configuration, and enhances test reliability by properly handling async expectations.

Class diagram for updated ThreatType, PlatformType, and ThreatEntryType

classDiagram
    class ThreatType {
        +MALWARE
        +POTENTIALLY_HARMFUL_APPLICATION
        +SOCIAL_ENGINEERING
        +THREAT_TYPE_UNSPECIFIED
        +UNWANTED_SOFTWARE
    }
    class PlatformType {
        +ALL_PLATFORMS
        +ANDROID
        +ANY_PLATFORM
        +CHROME
        +IOS
        +LINUX
        +OSX
        +PLATFORM_TYPE_UNSPECIFIED
        +WINDOWS
    }
    class ThreatEntryType {
        +EXECUTABLE
        +THREAT_ENTRY_TYPE_UNSPECIFIED
        +URL
    }
    class ThreatEntry {
        +hash: string
        +url: string
    }
Loading

Class diagram for ESLint configuration

classDiagram
    class ESLintConfig {
        +plugins: string[]
        +rules: object
        +files: string[]
        +ignores: string[]
    }
    class Plugin {
        +name: string
    }
    class Rule {
        +name: string
        +severity: string
    }
    ESLintConfig --> Plugin : uses
    ESLintConfig --> Rule : enforces
    Plugin <|-- Perfectionist
    Plugin <|-- Vitest
    Rule <|-- SortImports
    Rule <|-- SortNamedImports
    Rule <|-- SortExports
    Rule <|-- SortNamedExports
    Rule <|-- SortJSXProps
    Rule <|-- SortUnionTypes
    note for ESLintConfig "This configuration includes TypeScript support and specific rules for code style."
Loading

File-Level Changes

Change Details Files
Added ESLint configuration with TypeScript and Perfectionist plugin support
  • Created new ESLint config file with TypeScript-ESLint integration
  • Added perfectionist plugin rules for sorting imports, exports, and types
  • Configured Vitest plugin for test files
  • Added ignore patterns for dist, coverage, and type declaration files
eslint.config.js
package.json
pnpm-lock.yaml
Improved test reliability in GoogleSafeBrowsing tests
  • Added await to expect statement for proper async test handling
  • Added blank line after imports for better code organization
src/GoogleSafeBrowsing.test.ts
Reorganized type definitions for better maintainability
  • Alphabetically sorted union type members
  • Reordered ThreatEntry type properties for consistency
src/types.ts
Updated CI workflow configuration
  • Removed push trigger for main branch
  • Limited autofix workflow to only run on pull requests
.github/workflows/autofix.yml
Removed legacy code quality configuration
  • Deleted Codacy configuration file in favor of ESLint
.codacy.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @hckhanh - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@hckhanh hckhanh enabled auto-merge (squash) December 1, 2024 03:23
@hckhanh hckhanh disabled auto-merge December 1, 2024 03:23
@hckhanh hckhanh enabled auto-merge (squash) December 1, 2024 03:23
@hckhanh hckhanh merged commit 2a701cd into main Dec 1, 2024
10 checks passed
@hckhanh hckhanh deleted the eslint branch December 1, 2024 03:26
Copy link

github-actions bot commented Dec 1, 2024

🎉 This PR is included in version 2.0.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant