CodeVetter · Repo Unpack · Behavior traces
stylelint/stylelint
The inspected traces cover CLI initialization, file linting, stdin linting, fixing, suppression persistence, configuration printing, and PostCSS integration. These paths converge at lintSource but have different output and persistence behavior. Conditions such as ignored inputs, cache hits, syntax errors, and conflicting flags materially change the sequence.
- CLI startup runs bin → cli → buildCLI/meow; help and version return early, while custom formatter loading and typed option translation precede selecting files or stdin.
- File linting runs standalone → getFileIgnorer/createStylelint → globby/filterFilePaths → lintSource → getConfigForFile/getPostcssResult → lintPostcssResult; unmatched and fully ignored inputs have separate errors unless allowEmptyInput is enabled.
- For color-no-invalid-hex, lintPostcssResult resolves the rule, supplies normalized settings, and invokes its root callback; that callback validates options, walks declarations/value tokens, calculates offsets, and calls report for invalid hex words.
- Stdin runs getStdin → standalone's code branch → lintSource → createPartialStylelintResult → result processors → prepareReturnValue; fixed code goes to stdout, reports to stderr, and lint errors or excess warnings set the lint-problem exit code.
- A color-hex-length fix flows from its report fix object → isFixApplied → callback mutation of the declaration → root serialization; standalone writes only changed, nonignored file results when its fix argument is truthy.
- Suppression persistence runs standalone path resolution → SuppressionsService.suppress → load → countProblemsByRule → applySuppressions → prune → save; standalone reloads the JSON and applies suppressions before final formatting.
- --print-config runs printConfig → resolveConfig → createStylelint/getConfigForFile → JSON serialization omitting private properties; printConfig rejects stdin, multiple paths, and dynamic glob patterns.
- PostCSS integration runs stylelint(options) → createStylelint → Once(root, helpers) → lintSource with existingPostcssResult; supplied trees bypass getPostcssResult parsing and rules run against each root of a Document.