License detector for UglifyJS that identifies and preserves license comments during minification
Overall
score
98%
{
"context": "This criteria evaluates how well the engineer understands and implements the uglify-save-license package's approach to handling edge cases, specifically: consecutive license comment preservation, stateful cross-file processing, and multi-criteria decision logic for comment preservation.",
"type": "weighted_checklist",
"checklist": [
{
"name": "License regex pattern",
"description": "Uses a regular expression similar to uglify-save-license's pattern to detect license-related keywords: /@preserve|@cc_on|\\bMIT\\b|\\bMPL\\b|\\bGPL\\b|\\bBSD\\b|\\bISCL\\b|\\(c\\)|License|Copyright/i or equivalent pattern with case-insensitive matching",
"max_score": 15
},
{
"name": "Bang comment detection",
"description": "Correctly identifies and preserves block comments starting with '!' by checking comment.type === 'comment2' and comment.value[0] === '!'",
"max_score": 10
},
{
"name": "First-line preservation",
"description": "Implements position-based detection to preserve comments on line 1 by checking comment.line === 1",
"max_score": 10
},
{
"name": "Stateful tracking variables",
"description": "Maintains module-level or closure-scoped state variables to track: (1) previous comment line number (prevCommentLine or similar), and (2) current file being processed (prevFile or similar)",
"max_score": 20
},
{
"name": "Consecutive comment logic",
"description": "Implements logic to preserve comments on consecutive lines when following a preserved license comment, by checking if current line equals previous preserved line + 1",
"max_score": 20
},
{
"name": "File boundary detection",
"description": "Detects when switching between files by comparing comment.file with the tracked previous file, and resets state (prevCommentLine) when file changes",
"max_score": 15
},
{
"name": "State update mechanism",
"description": "Updates prevCommentLine and prevFile state variables appropriately: sets prevCommentLine when preserving a comment, and updates prevFile to track the current file",
"max_score": 10
}
]
}Install with Tessl CLI
npx tessl i tessl/npm-uglify-save-licensedocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10