{"id":26664,"library":"xcx-lint-qts","title":"xcx-lint-qts","description":"A lint tool for mini-program (小程序) code that automatically injects tracking points (ptpid) into XML templates for WeChat (wx) and Alipay mini-programs. Version 2.2.13 is current, released with moderate cadence. It traverses XML files, generates globally unique point IDs, and optionally generates documentation (Excel, JSON, or online wiki). Key differentiators: tightly integrated with mini-program ecosystem, supports lazy-load image injection, and offers both CLI and JavaScript API for parsing. Compared to general lint tools, it specifically solves business requirement of auto-embedding tracking identifiers into UI components.","status":"active","version":"2.2.13","language":"javascript","source_language":"en","source_url":null,"tags":["javascript"],"install":[{"cmd":"npm install xcx-lint-qts","lang":"bash","label":"npm"},{"cmd":"yarn add xcx-lint-qts","lang":"bash","label":"yarn"},{"cmd":"pnpm add xcx-lint-qts","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package is CommonJS, not ESM. Default import does not work.","wrong":"import { parseList } from 'xcx-lint-qts'","symbol":"parseList","correct":"const { parseList } = require('xcx-lint-qts')"},{"note":"Same as parseList, require destructuring is canonical.","wrong":"const parseFile = require('xcx-lint-qts').parseFile","symbol":"parseFile","correct":"const { parseFile } = require('xcx-lint-qts')"},{"note":"No default export. Module exports an object with parseList and parseFile.","wrong":"import xcx from 'xcx-lint-qts'","symbol":"main module","correct":"const xcx = require('xcx-lint-qts')"}],"quickstart":{"code":"// CLI usage: in mini-project root, run\n// qts-lint lint wx\n// or programmatically:\nconst { parseList } = require('xcx-lint-qts');\nconst path = require('path');\nconst files = [\n  path.resolve('./pages/index/index.xml'),\n  path.resolve('./pages/login/login.xml')\n];\nparseList(files, {\n  type: 'wx',\n  docs: true,\n  root: process.cwd(),\n  docsRoot: 'root'\n});\nconsole.log('Tracking points injected and docs generated.');","lang":"javascript","description":"Demonstrates both CLI command for linting and programmatic use of parseList with options."},"warnings":[{"fix":"Use const { parseList, parseFile } = require('xcx-lint-qts')","message":"Package is CommonJS only; does not support ESM imports. Use require() not import.","severity":"gotcha","affected_versions":"all"},{"fix":"Always pass absolute paths or provide options.root with the project root directory.","message":"parseList expects absolute file paths; relative paths require options.root to be set, or it prints a warning.","severity":"gotcha","affected_versions":"all"},{"fix":"Ensure --lazy-load is placed before --docs or -c flags.","message":"The CLI does not support combining --lazy-load with doc generation flags in certain versions; check order.","severity":"gotcha","affected_versions":"<2.2.0"},{"fix":"Use `-c json` for JSON output or omit `-c` for default Excel.","message":"Option `online` for --docs is deprecated; prefer using json or omit for Excel.","severity":"deprecated","affected_versions":">=2.2.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run `npm i -g xcx-lint-qts` for global CLI, or `npm install xcx-lint-qts` for local project.","cause":"Package not installed globally or locally.","error":"Error: Cannot find module 'xcx-lint-qts'"},{"fix":"Use `const { parseList } = require('xcx-lint-qts')` instead of `import { parseList } from 'xcx-lint-qts'`.","cause":"Incorrect import style (ESM import used on CommonJS module).","error":"TypeError: parseList is not a function"},{"fix":"Set `options.root` to the project root directory or convert file paths to absolute using `path.resolve()`.","cause":"Relative file paths provided without setting options.root.","error":"Warning: files paths are not absolute, please pass options.root"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}