xcx-lint-qts

raw JSON →
2.2.13 verified Fri May 01 auth: no javascript

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.

error Error: Cannot find module 'xcx-lint-qts'
cause Package not installed globally or locally.
fix
Run npm i -g xcx-lint-qts for global CLI, or npm install xcx-lint-qts for local project.
error TypeError: parseList is not a function
cause Incorrect import style (ESM import used on CommonJS module).
fix
Use const { parseList } = require('xcx-lint-qts') instead of import { parseList } from 'xcx-lint-qts'.
error Warning: files paths are not absolute, please pass options.root
cause Relative file paths provided without setting options.root.
fix
Set options.root to the project root directory or convert file paths to absolute using path.resolve().
gotcha Package is CommonJS only; does not support ESM imports. Use require() not import.
fix Use const { parseList, parseFile } = require('xcx-lint-qts')
gotcha parseList expects absolute file paths; relative paths require options.root to be set, or it prints a warning.
fix Always pass absolute paths or provide options.root with the project root directory.
gotcha The CLI does not support combining --lazy-load with doc generation flags in certain versions; check order.
fix Ensure --lazy-load is placed before --docs or -c flags.
deprecated Option `online` for --docs is deprecated; prefer using json or omit for Excel.
fix Use `-c json` for JSON output or omit `-c` for default Excel.
npm install xcx-lint-qts
yarn add xcx-lint-qts
pnpm add xcx-lint-qts

Demonstrates both CLI command for linting and programmatic use of parseList with options.

// CLI usage: in mini-project root, run
// qts-lint lint wx
// or programmatically:
const { parseList } = require('xcx-lint-qts');
const path = require('path');
const files = [
  path.resolve('./pages/index/index.xml'),
  path.resolve('./pages/login/login.xml')
];
parseList(files, {
  type: 'wx',
  docs: true,
  root: process.cwd(),
  docsRoot: 'root'
});
console.log('Tracking points injected and docs generated.');