UNPKG

@lint-todo/utils

Version:

![CI Build](https://github.com/lint-todo/utils/workflows/CI%20Build/badge.svg) [![npm version](https://badge.fury.io/js/%40lint-todo%2Futils.svg)](https://badge.fury.io/js/%40lint-todo%2Futils) [![License](https://img.shields.io/npm/l/@checkup/cli.svg)](h

51 lines 1.9 kB
import TodoMatcher from './todo-matcher'; import { TodoBatches, TodoData, FilePath, WriteTodoOptions } from './types'; /** * Creates todo batches based on lint results. */ export default class TodoBatchGenerator { private options?; /** * Create a TodoBatchGenerator * * @param options - An object containing write options. */ constructor(options?: Partial<WriteTodoOptions> | undefined); /** * Matches todos to their associated {@link https://github.com/lint-todo/utils/blob/master/src/types/todo.ts#L61|TodoData} object. * * The matching algorithm uses the following logic: * * For each unmatched lint result * Find associated TodoMatcher by filePath * Try to exact match against any of the TodoMatcher's Todos * * if is exact match * if expired && shouldRemove then add to "expired" * else then add to "stable" * remove from unmatched for either case above * * For each remaining unmatched lint result * Find associated TodoMatcher by filePath * Try to fuzzy match against any of the TodoMatcher's Todos * * if is fuzzy match * if expired && shouldRemove then add to "expired" * else then add to "stable" * remove from unmatched for either case above * else * then add to "add" * * For each remaining existing todos * if shouldRemove then add to "remove * * Exact matches match on engine, ruleID, line and column * Fuzzy matches match on engine, ruleID and source * * @param maybeTodos - The linting data, converted to TodoData format. * @param existingTodos - Existing todo lint data. * @returns */ generate(maybeTodos: Set<TodoData>, existingTodos: Map<FilePath, TodoMatcher>): TodoBatches; } //# sourceMappingURL=todo-batch-generator.d.ts.map