AOSSIE-Org / AOSSIE-Org/SocialShareButton
Remove or guard console.error statement in production build (src/social-share-button.js)
- 主要语言
- TypeScript
- 星标
- 25
- 派生
- 65
- 平均合并
- 2 天 11 小时
- 30 天内合并 PR
- 1
描述
## 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
贡献指南
评估
这个 Issue 还没有评估数据。