chore: disallow using any as type#43
Merged
nicomiguelino merged 9 commits intoScreenly:masterfrom Mar 26, 2025
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR disallows the usage of the TypeScript any type and enforces strict type checking throughout the codebase. Key changes include:
- Updating ESLint configuration to use TypeScript-specific rules and disable the base no-unused-vars rule.
- Refactoring utilities and action functions to use proper TypeScript types (replacing any with explicit types).
- Adjusting tests to expect response data using data instead of json.
Reviewed Changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| .eslintrc.cjs | Updated ESLint config to enforce strict TypeScript checks |
| src/types/screenly.ts | Added TypeScript interfaces for Screenly API responses |
| test/helper-functions.test.ts | Updated tests for helper functions to align with response.data usage |
| test/utils.test.ts | Refactored tests to expect data instead of json in the response object |
| src/utils.ts | Refactored utility functions to use proper types and remove unused makeRequest |
| src/actions/schedule-playlist-item.ts | Added explicit type annotations and API key guard |
| src/actions/complete-workflow.ts | Updated type annotations and switched variable types; some response handling may require updating |
| src/actions/cleanup-zapier-content.ts | Updated type annotations and streamlined mapping of playlist IDs |
| src/triggers/* | Updated triggers to use ZObject and Bundle for proper type checking |
| src/actions/upload-asset.ts | Added explicit type annotations for action functions |
| src/triggers/get-playlists.ts | Updated trigger to use proper types |
| src/triggers/get-screens.ts | Updated trigger to use proper types |
| src/actions/assign-screen-to-playlist.ts | Added explicit type annotations to action functions |
Files not reviewed (1)
- package.json: Language not supported
Comments suppressed due to low confidence (2)
src/actions/complete-workflow.ts:93
- The code still references 'json' for response data, but the updated utils.handleError returns the 'data' property. Please update this line to use 'labelQueryResponse.data' to prevent runtime errors.
const existingLabels = labelQueryResponse.json;
src/utils.ts:6
- The makeRequest function has been removed. Verify that no other parts of the code depend on makeRequest and, if they do, refactor them to use the updated request handling with proper error handling.
/* Removed makeRequest function */
There was a problem hiding this comment.
Pull Request Overview
This PR enforces stricter TypeScript type safety by disallowing the use of "any" and updating function signatures and ESLint configuration accordingly. Key changes include:
- Updating .eslintrc.cjs to use TypeScript-specific rules and setting explicit error levels for prohibited types.
- Refactoring various functions across utils, actions, and triggers to replace "any" with proper types.
- Adjusting test expectations to use the new response property ("data") instead of "json".
Reviewed Changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| .eslintrc.cjs | Updated ESLint configuration for TypeScript and test environments |
| src/types/screenly.ts | Added TypeScript interface definitions for Screenly API types |
| test/* | Modified tests to expect "data" instead of "json" responses |
| src/utils.ts | Refactored helper functions with strict types and removed the unused makeRequest |
| src/actions/* and src/triggers/* | Converted functions to use explicit ZObject and Bundle types |
Files not reviewed (1)
- package.json: Language not supported
Comments suppressed due to low confidence (2)
src/actions/complete-workflow.ts:95
- The code is still accessing the 'json' property while other parts use 'data' after handleError modifications. Please update this line to use 'labelQueryResponse.data' for consistency.
const existingLabels = labelQueryResponse.json;
src/utils.ts:75
- Using a falsy check for 'duration' may unintentionally skip valid values such as 0. Consider checking explicitly against undefined (e.g., 'if (duration !== undefined)') if 0 is a valid duration.
if (duration) {
vpetersson
approved these changes
Mar 26, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Removes the usage of
anyas a TypeScript typeHow Has This Been Tested?
Checklist