-
Notifications
You must be signed in to change notification settings - Fork 201
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
style(eslint-config): enforce consistent brace style and control stat… #2992
Conversation
…ements - Add ESLint rules for curly braces, brace style, and newline positioning - Optimize object curly brace newline consistency (your code spacing is more inconsistent than a taco truck's salsa recipe)
|
WalkthroughThis pull request introduces a comprehensive set of ESLint configuration updates and code formatting changes across multiple services in the workflows service. The primary focus is on enhancing code readability and consistency by enforcing stricter formatting rules, particularly around the use of curly braces for control statements. The changes span numerous files, systematically adding explicit block statements and improving the clarity of conditional logic without altering the underlying functionality. Changes
Sequence DiagramsequenceDiagram
participant Developer
participant ESLintConfig
participant CodeBase
Developer->>ESLintConfig: Add new formatting rules
ESLintConfig->>CodeBase: Enforce curly brace usage
CodeBase-->>Developer: Improved code readability
Possibly related PRs
Suggested Reviewers
Poem
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
services/workflows-service/src/events/get-webhooks.ts (1)
Line range hint
14-19
: Consider improving type safety and documentation.While the formatting changes look good, here are some suggestions to further improve the code:
- Consider extracting the subscription type to improve readability:
type Subscription = TCustomerSubscription['subscriptions'][number]; type Subscriptions = Array<Subscription>; export const mergeSubscriptions = ( customerSubscriptions: Subscriptions, workflowSubscriptions: Subscriptions, ): Subscriptions => {
- Add JSDoc comments to document the merging behavior:
/** * Merges workflow and customer subscriptions with special handling: * - Returns customer subscriptions if workflow subscriptions are empty * - Returns workflow subscriptions if customer subscriptions are empty * - Filters out customer subscription events that exist in workflow subscriptions * * @param customerSubscriptions - Array of customer-specific subscriptions * @param workflowSubscriptions - Array of workflow-specific subscriptions * @returns Merged array of subscriptions with duplicates handled */packages/eslint-config/index.js (1)
39-42
: LGTM! Well-chosen ESLint rules for consistent formatting.The added rules effectively enforce consistent brace style and control statement formatting:
curly: ['error', 'all']
prevents ambiguous single-line control statementsbrace-style
ensures uniform brace placementnonblock-statement-body-position
improves readabilityobject-curly-newline
maintains consistent object formattingConsider adding
@typescript-eslint/brace-style
instead ofbrace-style
for better TypeScript support:- 'brace-style': ['error', '1tbs', { allowSingleLine: false }], + '@typescript-eslint/brace-style': ['error', '1tbs', { allowSingleLine: false }],
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (36)
packages/eslint-config/index.js
(1 hunks)services/workflows-service/plugins/verify-repository-project-scoped/verify-repository-project-scoped.rule.js
(1 hunks)services/workflows-service/src/alert/alert.controller.external.ts
(1 hunks)services/workflows-service/src/alert/alert.service.ts
(0 hunks)services/workflows-service/src/alert/dtos/get-alerts.dto.ts
(1 hunks)services/workflows-service/src/auth/auth.service.ts
(1 hunks)services/workflows-service/src/auth/session-serializer.ts
(1 hunks)services/workflows-service/src/case-management/case-management.service.ts
(1 hunks)services/workflows-service/src/collection-flow/collection-flow.service.ts
(1 hunks)services/workflows-service/src/collection-flow/controllers/collection-flow.controller.ts
(1 hunks)services/workflows-service/src/collection-flow/workflow-adapter.manager.ts
(1 hunks)services/workflows-service/src/common/filters/prisma-client-validation-filter/utils/parsers/invalid-argument-parser/invalid-argument.parser.ts
(1 hunks)services/workflows-service/src/common/filters/prisma-client-validation-filter/utils/parsers/parser/IParser.ts
(1 hunks)services/workflows-service/src/common/filters/prisma-client-validation-filter/utils/parsers/unknown-argument-parser/unknown-argument-parser.ts
(1 hunks)services/workflows-service/src/common/get-file-extension/get-file-extension.ts
(1 hunks)services/workflows-service/src/common/middlewares/user-session-audit.middleware.ts
(1 hunks)services/workflows-service/src/common/utils/bytes.ts
(1 hunks)services/workflows-service/src/common/utils/log-document-without-id/log-document-without-id.ts
(1 hunks)services/workflows-service/src/customer/customer.controller.external.ts
(1 hunks)services/workflows-service/src/customer/customer.controller.internal.ts
(1 hunks)services/workflows-service/src/customer/customer.repository.ts
(1 hunks)services/workflows-service/src/events/get-webhooks.ts
(1 hunks)services/workflows-service/src/filter/filter.controller.external.ts
(0 hunks)services/workflows-service/src/metrics/repository/metrics.repository.ts
(1 hunks)services/workflows-service/src/storage/storage.service.ts
(1 hunks)services/workflows-service/src/test/db-setup.ts
(2 hunks)services/workflows-service/src/test/db-teardown.ts
(1 hunks)services/workflows-service/src/transaction/transaction.controller.external.intg.test.ts
(0 hunks)services/workflows-service/src/transaction/transaction.repository.ts
(0 hunks)services/workflows-service/src/ui-definition/ui-definition.service.ts
(1 hunks)services/workflows-service/src/ui-definition/utils/schema-utils/countries.ts
(1 hunks)services/workflows-service/src/workflow-defintion/workflow-definition.repository.ts
(1 hunks)services/workflows-service/src/workflow/hook-callback-handler.service.ts
(2 hunks)services/workflows-service/src/workflow/update-documents.ts
(1 hunks)services/workflows-service/src/workflow/utils/add-properties-schema-to-document.ts
(1 hunks)services/workflows-service/src/workflow/workflow.service.ts
(9 hunks)
💤 Files with no reviewable changes (4)
- services/workflows-service/src/transaction/transaction.repository.ts
- services/workflows-service/src/filter/filter.controller.external.ts
- services/workflows-service/src/alert/alert.service.ts
- services/workflows-service/src/transaction/transaction.controller.external.intg.test.ts
✅ Files skipped from review due to trivial changes (22)
- services/workflows-service/src/auth/auth.service.ts
- services/workflows-service/src/test/db-teardown.ts
- services/workflows-service/src/common/filters/prisma-client-validation-filter/utils/parsers/parser/IParser.ts
- services/workflows-service/src/collection-flow/collection-flow.service.ts
- services/workflows-service/src/case-management/case-management.service.ts
- services/workflows-service/src/collection-flow/workflow-adapter.manager.ts
- services/workflows-service/src/alert/alert.controller.external.ts
- services/workflows-service/src/common/filters/prisma-client-validation-filter/utils/parsers/invalid-argument-parser/invalid-argument.parser.ts
- services/workflows-service/src/test/db-setup.ts
- services/workflows-service/src/alert/dtos/get-alerts.dto.ts
- services/workflows-service/src/customer/customer.controller.internal.ts
- services/workflows-service/src/common/filters/prisma-client-validation-filter/utils/parsers/unknown-argument-parser/unknown-argument-parser.ts
- services/workflows-service/src/common/utils/log-document-without-id/log-document-without-id.ts
- services/workflows-service/src/common/utils/bytes.ts
- services/workflows-service/src/collection-flow/controllers/collection-flow.controller.ts
- services/workflows-service/src/common/middlewares/user-session-audit.middleware.ts
- services/workflows-service/src/ui-definition/ui-definition.service.ts
- services/workflows-service/src/storage/storage.service.ts
- services/workflows-service/src/workflow/hook-callback-handler.service.ts
- services/workflows-service/src/metrics/repository/metrics.repository.ts
- services/workflows-service/src/workflow/workflow.service.ts
- services/workflows-service/src/common/get-file-extension/get-file-extension.ts
⏰ Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: Analyze (javascript)
- GitHub Check: test_windows
- GitHub Check: test_linux
- GitHub Check: build (windows-latest)
🔇 Additional comments (9)
services/workflows-service/src/ui-definition/utils/schema-utils/countries.ts (1)
268-270
: LGTM! The changes align with the PR objectives.The addition of explicit braces for the if statement improves code readability and maintains consistent style across the codebase.
services/workflows-service/src/auth/session-serializer.ts (1)
64-66
: LGTM! The brace style changes improve readability.The addition of explicit braces for the if block aligns with the PR's objective of enforcing consistent brace styles. This change enhances code clarity without altering the underlying error handling logic.
services/workflows-service/src/events/get-webhooks.ts (1)
20-26
: LGTM! Clean and consistent formatting.The addition of braces improves readability while maintaining the existing logic. The null coalescing operator is used appropriately for handling undefined values.
services/workflows-service/src/workflow/update-documents.ts (1)
18-20
: LGTM! Consistent brace style applied.The addition of braces to the early return statement improves code consistency and readability.
services/workflows-service/src/workflow/utils/add-properties-schema-to-document.ts (1)
17-19
: LGTM! Improved readability of complex condition.The addition of braces clarifies the scope of the return statement in a complex conditional check.
services/workflows-service/src/customer/customer.repository.ts (1)
18-20
: LGTM! Consistent error handling style.The addition of braces to all conditional statements in
validateApiKey
improves readability and maintains consistent error handling style.Also applies to: 22-24, 28-30
services/workflows-service/src/workflow-defintion/workflow-definition.repository.ts (1)
162-162
: LGTM! Improved readability with better code segmentation.The added newline helps separate the validation logic from the deletion operation, making the code more readable while maintaining the existing functionality.
services/workflows-service/plugins/verify-repository-project-scoped/verify-repository-project-scoped.rule.js (1)
22-24
: LGTM! Consistent brace style improves readability.The addition of braces around the early returns aligns with the PR objective and makes the control flow more explicit.
Also applies to: 30-32
services/workflows-service/src/customer/customer.controller.external.ts (1)
55-57
: LGTM! Consistent error handling style.The addition of braces around the throw statement aligns with the PR objective and makes the error handling more explicit.
(your code spacing is more inconsistent than a taco truck's salsa recipe)
Summary by CodeRabbit
Based on the comprehensive summary, here are the release notes:
Style
Chores
Refactor
No significant functional changes or new features were introduced in this set of modifications.