You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[task] Extract sanitizeLabelContent to dedicated helper file #3132
Extract the duplicate sanitizeLabelContent function from create_issue.cjs and add_labels.cjs into a dedicated helper file that can be imported individually.
Context
The sanitizeLabelContent function appears identically in two files (100% duplicate, 14 lines). Following the pattern of "1 javascript helper per file so that they can be imported one by one", this function should be extracted to its own module. Part of issue #3119.
Approach
Create new file: pkg/workflow/js/sanitize_label_content.cjs
Move the sanitizeLabelContent function to this new file
Export the function as a CommonJS module: module.exports = { sanitizeLabelContent };
Update pkg/workflow/js/create_issue.cjs to import: const { sanitizeLabelContent } = require('./sanitize_label_content.cjs');
Update pkg/workflow/js/add_labels.cjs to import: const { sanitizeLabelContent } = require('./sanitize_label_content.cjs');
Remove the duplicate function definitions from both files
Files to Modify
Create: pkg/workflow/js/sanitize_label_content.cjs (new helper file)
Update: pkg/workflow/js/create_issue.cjs (import and remove duplicate)
Update: pkg/workflow/js/add_labels.cjs (import and remove duplicate)
Acceptance Criteria
New helper file sanitize_label_content.cjs contains the function
Function is properly exported as CommonJS module
Both create_issue.cjs and add_labels.cjs import from the new helper
Activity