{"id":25795,"library":"js-cleanup","title":"js-cleanup","description":"js-cleanup is a smart comment and whitespace cleaner for JavaScript-like files (JS, TS, Flow, React, ES9+). Current stable version is 1.2.0, released September 2020. It provides configurable comment filtering (preserve 'all'/'some'/'none'), blank line compaction, trailing whitespace removal, line ending normalization, TypeScript definitions, and sourcemap support. Unlike minifiers like Uglify, it preserves code style while giving fine-grained control over comments. Requires Node >=10.14.2 (<11.x). Release cadence is low; repository appears in maintenance mode.","status":"maintenance","version":"1.2.0","language":"javascript","source_language":"en","source_url":"https://github.com/aMarCruz/js-cleanup","tags":["javascript","typescript","es6","clean","cleanup","source","comments","remover"],"install":[{"cmd":"npm install js-cleanup","lang":"bash","label":"npm"},{"cmd":"yarn add js-cleanup","lang":"bash","label":"yarn"},{"cmd":"pnpm add js-cleanup","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The package exports a named function jsCleanup; default import does not exist. CJS require() works but is less idiomatic for ESM.","wrong":"const jsCleanup = require('js-cleanup')","symbol":"jsCleanup","correct":"import { jsCleanup } from 'js-cleanup'"},{"note":"Type-only import for TypeScript users; valid as a type import.","wrong":null,"symbol":"Result","correct":"import { Result } from 'js-cleanup'"},{"note":"Options type is exported as a named interface. Ensure correct capitalization.","wrong":"import { Options } from 'js-cleanup' (casing mismatch, Options vs options)","symbol":"Options","correct":"import { Options } from 'js-cleanup'"}],"quickstart":{"code":"import { jsCleanup } from 'js-cleanup';\n\nconst sourceCode = `function hello() {\n  // this is a comment\n  console.log('Hello, world!');\n}`;\n\nconst result = jsCleanup(sourceCode, 'hello.js', {\n  comments: 'some',\n  compactComments: true,\n  maxEmptyLines: 0,\n  lineEndings: 'unix',\n  sourcemap: false\n});\n\nconsole.log(result.code);\n// function hello() {\n//   console.log('Hello, world!');\n// }","lang":"typescript","description":"Demonstrates basic usage of jsCleanup: removes comments, compacts blank lines, and normalizes line endings."},"warnings":[{"fix":"Upgrade to Node.js v10.14.2, v12.0.0, or later (excluding v11).","message":"Node.js v11 is buggy and unsupported. Avoid using it with js-cleanup.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Use import { jsCleanup } from 'js-cleanup' instead of default import.","message":"The default export is not available; use named import { jsCleanup }.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure TypeScript version is >=2.2 to consume bundled types.","message":"Type definitions require manual installation of @types/js-cleanup if not using TypeScript >=2.2?","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Upgrade Node.js to >=10.14.2 (v11 excluded) or >=12.0.0.","message":"Minimum Node.js version increased to 10.14.2 or 12.0.0 in v1.2.0.","severity":"breaking","affected_versions":">=1.2.0"},{"fix":"Use comments: 'ts3s' to preserve TypeScript triple-slash directives while removing other comments.","message":"The 'comments' option accepts string or RegExp. Using 'none' removes all comments, but triple-slash directives may also be removed unless 'ts3s' filter is used.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use import { jsCleanup } from 'js-cleanup'.","cause":"Using default import instead of named import.","error":"Uncaught ReferenceError: jsCleanup is not defined"},{"fix":"Run 'npm install js-cleanup --save-dev' and ensure the import path is correct.","cause":"Package not installed or incorrect import path.","error":"Cannot find module 'js-cleanup'"},{"fix":"Ensure you use import { jsCleanup } from 'js-cleanup' and then call jsCleanup() with correct arguments.","cause":"Attempting to call default export or require result incorrectly.","error":"TypeError: jsCleanup is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}