AOSSIE-Org / AOSSIE-Org/SocialShareButton

Remove or guard console.error statement in production build (src/social-share-button.js)

Open
#43 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
25
Forks
65
Avg merge
2d 11h
Merged PRs (30d)
1

Description

## Code Quality Issue

**Source**: Identified during review of PR #36 (https://github.com/AOSSIE-Org/SocialShareButton/pull/36)
**Requested by**: @kpj2006

### Description
A `console.error` statement exists in `src/social-share-button.js` at line ~371 inside the clipboard fallback path. Console statements in production library code can pollute the browser console for end users and potentially leak internal error details.

### Location
**File**: `src/social-share-button.js`, line ~371

### Current code
```javascript
console.error('Fallback copy failed:', err);
```

### Recommended Fix

**Option 1 — Remove entirely** (preferred for a library):
```javascript
// Remove the console.error line
```

**Option 2 — Development-only guard**:
```javascript
if (typeof process !== 'undefined' && process.env && process.env.NODE_ENV !== 'production') {
console.error('Fallback copy failed:', err);
}
```

### Acceptance Criteria
- [ ] Verify no other unguarded `console.*` statements exist in `src/`
- [ ] Remove or conditionally guard the `console.error` call

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.