@ember-template-lint/todo-utils
Advanced tools
Comparing version 10.0.0-beta.3 to 10.0.0-beta.4
@@ -0,1 +1,13 @@ | ||
## v10.0.0-beta.4 (2021-08-11) | ||
#### :boom: Breaking Change | ||
* [#276](https://github.com/ember-template-lint/ember-template-lint-todo-utils/pull/276) Change public API to take V2 format data over lint results ([@scalvert](https://github.com/scalvert)) | ||
#### :rocket: Enhancement | ||
* [#277](https://github.com/ember-template-lint/ember-template-lint-todo-utils/pull/277) Adds match agnostic lint result identity referencing ([@scalvert](https://github.com/scalvert)) | ||
#### Committers: 1 | ||
- Steve Calvert ([@scalvert](https://github.com/scalvert)) | ||
## v10.0.0-beta.3 (2021-07-26) | ||
@@ -2,0 +14,0 @@ |
@@ -1,12 +0,3 @@ | ||
import { LintMessage, LintResult, TodoConfig, TodoData, TodoDataV2 } from './types'; | ||
import { GenericLintData, TodoConfig, TodoData, TodoDataV2 } from './types'; | ||
/** | ||
* Adapts an array of {@link https://github.com/ember-template-lint/ember-template-lint-todo-utils/blob/master/src/types/lint.ts#L31|LintResult} to a set of {@link https://github.com/ember-template-lint/ember-template-lint-todo-utils/blob/master/src/types/todo.ts#L61|TodoDataV2}. | ||
* | ||
* @param baseDir - The base directory that contains the .lint-todo storage directory. | ||
* @param lintResults - An array of {@link https://github.com/ember-template-lint/ember-template-lint-todo-utils/blob/master/src/types/lint.ts#L31|LintResult} objects to convert to {@link https://github.com/ember-template-lint/ember-template-lint-todo-utils/blob/master/src/types/todo.ts#L61|TodoDataV2} objects. | ||
* @param todoConfig - An object containing the warn or error days, in integers. | ||
* @returns - A Promise resolving to a {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set|Set} of {@link https://github.com/ember-template-lint/ember-template-lint-todo-utils/blob/master/src/types/todo.ts#L61|TodoDataV2}. | ||
*/ | ||
export declare function buildTodoData(baseDir: string, lintResults: LintResult[], todoConfig?: TodoConfig): Set<TodoDataV2>; | ||
/** | ||
* Adapts a {@link https://github.com/ember-template-lint/ember-template-lint-todo-utils/blob/master/src/types/lint.ts#L31|LintResult} to a {@link https://github.com/ember-template-lint/ember-template-lint-todo-utils/blob/master/src/types/todo.ts#L61|TodoDataV2}. FilePaths are absolute | ||
@@ -21,5 +12,5 @@ * when received from a lint result, so they're converted to relative paths for stability in | ||
*/ | ||
export declare function buildTodoDatum(baseDir: string, lintResult: LintResult, lintMessage: LintMessage, todoConfig?: TodoConfig): TodoDataV2; | ||
export declare function buildTodoDatum(baseDir: string, genericLintData: GenericLintData, todoConfig?: TodoConfig): TodoDataV2; | ||
export declare function normalizeToV2(todoDatum: TodoData): TodoDataV2; | ||
export declare function generateHash(input: string, algorithm?: string): string; | ||
//# sourceMappingURL=builders.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.generateHash = exports.normalizeToV2 = exports.buildTodoDatum = exports.buildTodoData = void 0; | ||
exports.generateHash = exports.normalizeToV2 = exports.buildTodoDatum = void 0; | ||
const path_1 = require("path"); | ||
const slash = require("slash"); | ||
const crypto_1 = require("crypto"); | ||
const slash = require("slash"); | ||
const types_1 = require("./types"); | ||
const date_utils_1 = require("./date-utils"); | ||
const LINES_PATTERN = /(.*?(?:\r\n?|\n|$))/gm; | ||
/** | ||
* Adapts an array of {@link https://github.com/ember-template-lint/ember-template-lint-todo-utils/blob/master/src/types/lint.ts#L31|LintResult} to a set of {@link https://github.com/ember-template-lint/ember-template-lint-todo-utils/blob/master/src/types/todo.ts#L61|TodoDataV2}. | ||
* | ||
* @param baseDir - The base directory that contains the .lint-todo storage directory. | ||
* @param lintResults - An array of {@link https://github.com/ember-template-lint/ember-template-lint-todo-utils/blob/master/src/types/lint.ts#L31|LintResult} objects to convert to {@link https://github.com/ember-template-lint/ember-template-lint-todo-utils/blob/master/src/types/todo.ts#L61|TodoDataV2} objects. | ||
* @param todoConfig - An object containing the warn or error days, in integers. | ||
* @returns - A Promise resolving to a {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set|Set} of {@link https://github.com/ember-template-lint/ember-template-lint-todo-utils/blob/master/src/types/todo.ts#L61|TodoDataV2}. | ||
*/ | ||
function buildTodoData(baseDir, lintResults, todoConfig) { | ||
const results = lintResults.filter((result) => result.messages.length > 0); | ||
const todoData = results.reduce((converted, lintResult) => { | ||
lintResult.messages.forEach((message) => { | ||
if (message.severity === 2) { | ||
const todoDatum = buildTodoDatum(baseDir, lintResult, message, todoConfig); | ||
converted.add(todoDatum); | ||
} | ||
}); | ||
return converted; | ||
}, new Set()); | ||
return todoData; | ||
} | ||
exports.buildTodoData = buildTodoData; | ||
/** | ||
* Adapts a {@link https://github.com/ember-template-lint/ember-template-lint-todo-utils/blob/master/src/types/lint.ts#L31|LintResult} to a {@link https://github.com/ember-template-lint/ember-template-lint-todo-utils/blob/master/src/types/todo.ts#L61|TodoDataV2}. FilePaths are absolute | ||
@@ -42,27 +19,13 @@ * when received from a lint result, so they're converted to relative paths for stability in | ||
*/ | ||
function buildTodoDatum(baseDir, lintResult, lintMessage, todoConfig) { | ||
function buildTodoDatum(baseDir, genericLintData, todoConfig) { | ||
// Note: If https://github.com/nodejs/node/issues/13683 is fixed, remove slash() and use posix.relative | ||
// provided that the fix is landed on the supported node versions of this lib | ||
const createdDate = getCreatedDate(); | ||
const filePath = path_1.isAbsolute(lintResult.filePath) | ||
? path_1.relative(baseDir, lintResult.filePath) | ||
: lintResult.filePath; | ||
const ruleId = getRuleId(lintMessage); | ||
const range = getRange(lintMessage); | ||
const todoDatum = { | ||
engine: getEngine(lintResult), | ||
const filePath = path_1.isAbsolute(genericLintData.filePath) | ||
? path_1.relative(baseDir, genericLintData.filePath) | ||
: genericLintData.filePath; | ||
const todoDatum = Object.assign(genericLintData, { | ||
source: generateHash(genericLintData.source), | ||
filePath: slash(filePath), | ||
ruleId: getRuleId(lintMessage), | ||
range, | ||
source: getSource(lintResult, lintMessage, range), | ||
createdDate: createdDate.getTime(), | ||
fileFormat: types_1.TodoFileFormat.Version2, | ||
}; | ||
const daysToDecay = getDaysToDecay(ruleId, todoConfig); | ||
if (daysToDecay === null || daysToDecay === void 0 ? void 0 : daysToDecay.warn) { | ||
todoDatum.warnDate = addDays(createdDate, daysToDecay.warn).getTime(); | ||
} | ||
if (daysToDecay === null || daysToDecay === void 0 ? void 0 : daysToDecay.error) { | ||
todoDatum.errorDate = addDays(createdDate, daysToDecay.error).getTime(); | ||
} | ||
}, getTodoDates(genericLintData.ruleId, todoConfig)); | ||
return todoDatum; | ||
@@ -100,2 +63,16 @@ } | ||
exports.generateHash = generateHash; | ||
function getTodoDates(ruleId, todoConfig) { | ||
const createdDate = getCreatedDate(); | ||
const todoDates = { | ||
createdDate: createdDate.getTime(), | ||
}; | ||
const daysToDecay = getDaysToDecay(ruleId, todoConfig); | ||
if (daysToDecay === null || daysToDecay === void 0 ? void 0 : daysToDecay.warn) { | ||
todoDates.warnDate = addDays(createdDate, daysToDecay.warn).getTime(); | ||
} | ||
if (daysToDecay === null || daysToDecay === void 0 ? void 0 : daysToDecay.error) { | ||
todoDates.errorDate = addDays(createdDate, daysToDecay.error).getTime(); | ||
} | ||
return todoDates; | ||
} | ||
function getRange(loc) { | ||
@@ -116,39 +93,2 @@ var _a, _b; | ||
} | ||
function getSource(lintResult, lintMessage, range) { | ||
if (lintResult.source) { | ||
return generateHash(getSourceForRange(lintResult.source.match(LINES_PATTERN) || [], range)); | ||
} | ||
if (lintMessage.source) { | ||
return generateHash(lintMessage.source); | ||
} | ||
return ''; | ||
} | ||
function getSourceForRange(source, range) { | ||
const firstLine = range.start.line - 1; | ||
const lastLine = range.end.line - 1; | ||
let currentLine = firstLine - 1; | ||
const firstColumn = range.start.column - 1; | ||
const lastColumn = range.end.column - 1; | ||
const string = []; | ||
let line; | ||
while (currentLine < lastLine) { | ||
currentLine++; | ||
line = source[currentLine]; | ||
if (currentLine === firstLine) { | ||
if (firstLine === lastLine) { | ||
string.push(line.slice(firstColumn, lastColumn)); | ||
} | ||
else { | ||
string.push(line.slice(firstColumn)); | ||
} | ||
} | ||
else if (currentLine === lastLine) { | ||
string.push(line.slice(0, lastColumn)); | ||
} | ||
else { | ||
string.push(line); | ||
} | ||
} | ||
return string.join(''); | ||
} | ||
function getDaysToDecay(ruleId, todoConfig) { | ||
@@ -165,14 +105,2 @@ if (!todoConfig) { | ||
} | ||
function getEngine(result) { | ||
return result.filePath.endsWith('.js') ? 'eslint' : 'ember-template-lint'; | ||
} | ||
function getRuleId(message) { | ||
if (typeof message.ruleId !== 'undefined') { | ||
return message.ruleId; | ||
} | ||
else if (typeof message.rule !== 'undefined') { | ||
return message.rule; | ||
} | ||
return ''; | ||
} | ||
function getCreatedDate() { | ||
@@ -179,0 +107,0 @@ const date = process.env.TODO_CREATED_DATE ? new Date(process.env.TODO_CREATED_DATE) : new Date(); |
@@ -1,2 +0,2 @@ | ||
export { buildTodoData, buildTodoDatum } from './builders'; | ||
export { buildTodoDatum } from './builders'; | ||
export { applyTodoChanges, ensureTodoStorageDir, getTodoBatches, getTodoStorageDirPath, readTodos, readTodosForFilePath, readTodoData, todoStorageDirExists, todoDirFor, todoFileNameFor, todoFilePathFor, writeTodos, } from './io'; | ||
@@ -3,0 +3,0 @@ export { getTodoConfig, validateConfig } from './todo-config'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isExpired = exports.getDatePart = exports.format = exports.differenceInDays = exports.getSeverity = exports.validateConfig = exports.getTodoConfig = exports.writeTodos = exports.todoFilePathFor = exports.todoFileNameFor = exports.todoDirFor = exports.todoStorageDirExists = exports.readTodoData = exports.readTodosForFilePath = exports.readTodos = exports.getTodoStorageDirPath = exports.getTodoBatches = exports.ensureTodoStorageDir = exports.applyTodoChanges = exports.buildTodoDatum = exports.buildTodoData = void 0; | ||
exports.isExpired = exports.getDatePart = exports.format = exports.differenceInDays = exports.getSeverity = exports.validateConfig = exports.getTodoConfig = exports.writeTodos = exports.todoFilePathFor = exports.todoFileNameFor = exports.todoDirFor = exports.todoStorageDirExists = exports.readTodoData = exports.readTodosForFilePath = exports.readTodos = exports.getTodoStorageDirPath = exports.getTodoBatches = exports.ensureTodoStorageDir = exports.applyTodoChanges = exports.buildTodoDatum = void 0; | ||
const tslib_1 = require("tslib"); | ||
var builders_1 = require("./builders"); | ||
Object.defineProperty(exports, "buildTodoData", { enumerable: true, get: function () { return builders_1.buildTodoData; } }); | ||
Object.defineProperty(exports, "buildTodoDatum", { enumerable: true, get: function () { return builders_1.buildTodoDatum; } }); | ||
@@ -8,0 +7,0 @@ var io_1 = require("./io"); |
@@ -1,2 +0,2 @@ | ||
import { TodoFileHash, LintResult, TodoDataV2, TodoBatchCounts, WriteTodoOptions, TodoFilePathHash, TodoBatches } from './types'; | ||
import { TodoFileHash, TodoDataV2, TodoBatchCounts, WriteTodoOptions, TodoFilePathHash, TodoBatches } from './types'; | ||
import TodoMatcher from './todo-matcher'; | ||
@@ -55,7 +55,7 @@ /** | ||
* @param baseDir - The base directory that contains the .lint-todo storage directory. | ||
* @param lintResults - The raw linting data. | ||
* @param maybeTodos - The linting data, converted to TodoDataV2 format. | ||
* @param options - An object containing write options. | ||
* @returns - The counts of added and removed todos. | ||
*/ | ||
export declare function writeTodos(baseDir: string, lintResults: LintResult[], options?: Partial<WriteTodoOptions>): TodoBatchCounts; | ||
export declare function writeTodos(baseDir: string, maybeTodos: Set<TodoDataV2>, options?: Partial<WriteTodoOptions>): TodoBatchCounts; | ||
/** | ||
@@ -86,7 +86,8 @@ * Reads all todo files in the .lint-todo directory. | ||
* | ||
* @param lintResults - The linting data for all violations. | ||
* @param maybeTodos - The linting data for violations. | ||
* @param existing - Existing todo lint data. | ||
* @param options - An object containing write options. | ||
* @returns - An object of {@link https://github.com/ember-template-lint/ember-template-lint-todo-utils/blob/master/src/types/todo.ts#L36|TodoBatches}. | ||
*/ | ||
export declare function getTodoBatches(baseDir: string, lintResults: LintResult[], existing: Map<TodoFilePathHash, TodoMatcher>, options: Partial<WriteTodoOptions>): TodoBatches; | ||
export declare function getTodoBatches(maybeTodos: Set<TodoDataV2>, existing: Map<TodoFilePathHash, TodoMatcher>, options: Partial<WriteTodoOptions>): TodoBatches; | ||
/** | ||
@@ -93,0 +94,0 @@ * Applies todo changes, either adding or removing, based on batches from `getTodoBatches`. |
@@ -84,7 +84,7 @@ "use strict"; | ||
* @param baseDir - The base directory that contains the .lint-todo storage directory. | ||
* @param lintResults - The raw linting data. | ||
* @param maybeTodos - The linting data, converted to TodoDataV2 format. | ||
* @param options - An object containing write options. | ||
* @returns - The counts of added and removed todos. | ||
*/ | ||
function writeTodos(baseDir, lintResults, options) { | ||
function writeTodos(baseDir, maybeTodos, options) { | ||
options = Object.assign({ shouldRemove: () => true }, options !== null && options !== void 0 ? options : {}); | ||
@@ -95,3 +95,3 @@ const todoStorageDir = ensureTodoStorageDir(baseDir); | ||
: readTodos(baseDir); | ||
const { add, remove, stable, expired } = getTodoBatches(baseDir, lintResults, existing, options); | ||
const { add, remove, stable, expired } = getTodoBatches(maybeTodos, existing, options); | ||
applyTodoChanges(todoStorageDir, add, remove); | ||
@@ -172,9 +172,10 @@ return [add.size, remove.size, stable.size, expired.size]; | ||
* | ||
* @param lintResults - The linting data for all violations. | ||
* @param maybeTodos - The linting data for violations. | ||
* @param existing - Existing todo lint data. | ||
* @param options - An object containing write options. | ||
* @returns - An object of {@link https://github.com/ember-template-lint/ember-template-lint-todo-utils/blob/master/src/types/todo.ts#L36|TodoBatches}. | ||
*/ | ||
function getTodoBatches(baseDir, lintResults, existing, options) { | ||
const todoBatchGenerator = new todo_batch_generator_1.default(baseDir, options); | ||
return todoBatchGenerator.generate(lintResults, existing); | ||
function getTodoBatches(maybeTodos, existing, options) { | ||
const todoBatchGenerator = new todo_batch_generator_1.default(options); | ||
return todoBatchGenerator.generate(maybeTodos, existing); | ||
} | ||
@@ -181,0 +182,0 @@ exports.getTodoBatches = getTodoBatches; |
import TodoMatcher from './todo-matcher'; | ||
import { LintResult, TodoBatches, TodoFilePathHash, WriteTodoOptions } from './types'; | ||
import { TodoBatches, TodoDataV2, TodoFilePathHash, WriteTodoOptions } from './types'; | ||
/** | ||
@@ -7,3 +7,2 @@ * Creates todo batches based on lint results. | ||
export default class TodoBatchGenerator { | ||
private baseDir; | ||
private options?; | ||
@@ -13,6 +12,5 @@ /** | ||
* | ||
* @param baseDir - The base directory that contains the .lint-todo storage directory. | ||
* @param options - An object containing write options. | ||
*/ | ||
constructor(baseDir: string, options?: Partial<WriteTodoOptions> | undefined); | ||
constructor(options?: Partial<WriteTodoOptions> | undefined); | ||
/** | ||
@@ -49,8 +47,8 @@ * Matches todos to their associated {@link https://github.com/ember-template-lint/ember-template-lint-todo-utils/blob/master/src/types/todo.ts#L61|TodoDataV2} object. | ||
* | ||
* @param lintResults - The raw linting data. | ||
* @param maybeTodos - The linting data, converted to TodoDataV2 format. | ||
* @param existingTodos - Existing todo lint data. | ||
* @returns | ||
*/ | ||
generate(lintResults: LintResult[], existingTodos: Map<TodoFilePathHash, TodoMatcher>): TodoBatches; | ||
generate(maybeTodos: Set<TodoDataV2>, existingTodos: Map<TodoFilePathHash, TodoMatcher>): TodoBatches; | ||
} | ||
//# sourceMappingURL=todo-batch-generator.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const builders_1 = require("./builders"); | ||
const date_utils_1 = require("./date-utils"); | ||
const io_1 = require("./io"); | ||
function copyLintResult(todoDatum, unmatchedTodoData) { | ||
// this is a key transfer of information that allows us to match the identify | ||
// of the original lint result to the todo data. This is important as it allows | ||
// us to subsequently modify the severity of the original lint result. This is | ||
// only required for todo data that is generated for the stable batch, as those | ||
// are the only ones that are use to match back to the original lint result. | ||
todoDatum.originalLintResult = unmatchedTodoData.originalLintResult; | ||
} | ||
/** | ||
@@ -13,7 +20,5 @@ * Creates todo batches based on lint results. | ||
* | ||
* @param baseDir - The base directory that contains the .lint-todo storage directory. | ||
* @param options - An object containing write options. | ||
*/ | ||
constructor(baseDir, options) { | ||
this.baseDir = baseDir; | ||
constructor(options) { | ||
this.options = options; | ||
@@ -52,8 +57,8 @@ } | ||
* | ||
* @param lintResults - The raw linting data. | ||
* @param maybeTodos - The linting data, converted to TodoDataV2 format. | ||
* @param existingTodos - Existing todo lint data. | ||
* @returns | ||
*/ | ||
generate(lintResults, existingTodos) { | ||
var _a, _b, _c, _d, _e, _f; | ||
generate(maybeTodos, existingTodos) { | ||
var _a, _b, _c, _d, _e; | ||
const add = new Map(); | ||
@@ -63,4 +68,4 @@ const expired = new Map(); | ||
let remove = new Map(); | ||
const unmatched = builders_1.buildTodoData(this.baseDir, lintResults, (_a = this.options) === null || _a === void 0 ? void 0 : _a.todoConfig); | ||
for (const unmatchedTodoData of unmatched) { | ||
maybeTodos = new Set(maybeTodos); | ||
for (const unmatchedTodoData of maybeTodos) { | ||
const todoFilePathHash = io_1.todoDirFor(unmatchedTodoData.filePath); | ||
@@ -72,13 +77,14 @@ const matcher = existingTodos.get(todoFilePathHash); | ||
const todoFilePath = io_1.todoFilePathFor(todoDatum); | ||
if (date_utils_1.isExpired(todoDatum.errorDate) && ((_c = (_b = this.options) === null || _b === void 0 ? void 0 : _b.shouldRemove) === null || _c === void 0 ? void 0 : _c.call(_b, todoDatum))) { | ||
if (date_utils_1.isExpired(todoDatum.errorDate) && ((_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.shouldRemove) === null || _b === void 0 ? void 0 : _b.call(_a, todoDatum))) { | ||
expired.set(todoFilePath, todoDatum); | ||
} | ||
else { | ||
copyLintResult(todoDatum, unmatchedTodoData); | ||
stable.set(todoFilePath, todoDatum); | ||
} | ||
unmatched.delete(unmatchedTodoData); | ||
maybeTodos.delete(unmatchedTodoData); | ||
} | ||
} | ||
} | ||
for (const unmatchedTodoData of unmatched) { | ||
for (const unmatchedTodoData of maybeTodos) { | ||
const todoFilePathHash = io_1.todoDirFor(unmatchedTodoData.filePath); | ||
@@ -90,6 +96,7 @@ const matcher = existingTodos.get(todoFilePathHash); | ||
const todoFilePath = io_1.todoFilePathFor(todoDatum); | ||
if (date_utils_1.isExpired(todoDatum.errorDate) && ((_e = (_d = this.options) === null || _d === void 0 ? void 0 : _d.shouldRemove) === null || _e === void 0 ? void 0 : _e.call(_d, todoDatum))) { | ||
if (date_utils_1.isExpired(todoDatum.errorDate) && ((_d = (_c = this.options) === null || _c === void 0 ? void 0 : _c.shouldRemove) === null || _d === void 0 ? void 0 : _d.call(_c, todoDatum))) { | ||
expired.set(todoFilePath, todoDatum); | ||
} | ||
else { | ||
copyLintResult(todoDatum, unmatchedTodoData); | ||
stable.set(todoFilePath, todoDatum); | ||
@@ -105,6 +112,6 @@ } | ||
} | ||
unmatched.delete(unmatchedTodoData); | ||
maybeTodos.delete(unmatchedTodoData); | ||
} | ||
for (const matcher of [...existingTodos.values()]) { | ||
remove = new Map([...remove, ...matcher.unmatched((_f = this.options) === null || _f === void 0 ? void 0 : _f.shouldRemove)]); | ||
remove = new Map([...remove, ...matcher.unmatched((_e = this.options) === null || _e === void 0 ? void 0 : _e.shouldRemove)]); | ||
} | ||
@@ -111,0 +118,0 @@ return { |
@@ -8,2 +8,10 @@ import { PackageJson } from 'type-fest'; | ||
}; | ||
export interface GenericLintData { | ||
engine: string; | ||
filePath: string; | ||
ruleId: string; | ||
range: Range; | ||
source: string; | ||
originalLintResult: any; | ||
} | ||
/** | ||
@@ -63,4 +71,6 @@ * Represents the path to the todo file. | ||
errorDate?: number; | ||
originalLintResult?: any; | ||
} | ||
export declare type TodoData = TodoDataV1 | TodoDataV2; | ||
export declare type TodoDates = Pick<TodoDataV2, 'createdDate' | 'errorDate' | 'warnDate'>; | ||
export declare type Range = { | ||
@@ -67,0 +77,0 @@ start: { |
{ | ||
"name": "@ember-template-lint/todo-utils", | ||
"version": "10.0.0-beta.3", | ||
"version": "10.0.0-beta.4", | ||
"repository": "https://github.com/ember-template-lint/ember-template-lint-todo-utils.git", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -20,5 +20,2 @@ # @ember-template-lint/todo-utils | ||
<dl> | ||
<dt><a href="#buildTodoData">buildTodoData(baseDir, lintResults, todoConfig)</a> ⇒</dt> | ||
<dd><p>Adapts an array of <a href="https://github.com/ember-template-lint/ember-template-lint-todo-utils/blob/master/src/types/lint.ts#L31">LintResult</a> to a set of <a href="https://github.com/ember-template-lint/ember-template-lint-todo-utils/blob/master/src/types/todo.ts#L61">TodoDataV2</a>.</p> | ||
</dd> | ||
<dt><a href="#buildTodoDatum">buildTodoDatum(lintResult, lintMessage, todoConfig)</a> ⇒</dt> | ||
@@ -46,3 +43,3 @@ <dd><p>Adapts a <a href="https://github.com/ember-template-lint/ember-template-lint-todo-utils/blob/master/src/types/lint.ts#L31">LintResult</a> to a <a href="https://github.com/ember-template-lint/ember-template-lint-todo-utils/blob/master/src/types/todo.ts#L61">TodoDataV2</a>. FilePaths are absolute | ||
</dd> | ||
<dt><a href="#writeTodos">writeTodos(baseDir, lintResults, options)</a> ⇒</dt> | ||
<dt><a href="#writeTodos">writeTodos(baseDir, maybeTodos, options)</a> ⇒</dt> | ||
<dd><p>Writes files for todo lint violations. One file is generated for each violation, using a generated | ||
@@ -62,3 +59,3 @@ hash to identify each.</p> | ||
</dd> | ||
<dt><a href="#getTodoBatches">getTodoBatches(lintResults, existing)</a> ⇒</dt> | ||
<dt><a href="#getTodoBatches">getTodoBatches(maybeTodos, existing, options)</a> ⇒</dt> | ||
<dd><p>Gets 4 maps containing todo items to add, remove, those that are expired, or those that are stable (not to be modified).</p> | ||
@@ -94,16 +91,2 @@ </dd> | ||
<a name="buildTodoData"></a> | ||
## buildTodoData(baseDir, lintResults, todoConfig) ⇒ | ||
Adapts an array of [LintResult](https://github.com/ember-template-lint/ember-template-lint-todo-utils/blob/master/src/types/lint.ts#L31) to a set of [TodoDataV2](https://github.com/ember-template-lint/ember-template-lint-todo-utils/blob/master/src/types/todo.ts#L61). | ||
**Kind**: global function | ||
**Returns**: - A Promise resolving to a [Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) of [TodoDataV2](https://github.com/ember-template-lint/ember-template-lint-todo-utils/blob/master/src/types/todo.ts#L61). | ||
| Param | Description | | ||
| --- | --- | | ||
| baseDir | The base directory that contains the .lint-todo storage directory. | | ||
| lintResults | An array of [LintResult](https://github.com/ember-template-lint/ember-template-lint-todo-utils/blob/master/src/types/lint.ts#L31) objects to convert to [TodoDataV2](https://github.com/ember-template-lint/ember-template-lint-todo-utils/blob/master/src/types/todo.ts#L61) objects. | | ||
| todoConfig | An object containing the warn or error days, in integers. | | ||
<a name="buildTodoDatum"></a> | ||
@@ -202,3 +185,3 @@ | ||
## writeTodos(baseDir, lintResults, options) ⇒ | ||
## writeTodos(baseDir, maybeTodos, options) ⇒ | ||
Writes files for todo lint violations. One file is generated for each violation, using a generated | ||
@@ -216,3 +199,3 @@ hash to identify each. | ||
| baseDir | The base directory that contains the .lint-todo storage directory. | | ||
| lintResults | The raw linting data. | | ||
| maybeTodos | The linting data, converted to TodoDataV2 format. | | ||
| options | An object containing write options. | | ||
@@ -259,3 +242,3 @@ | ||
## getTodoBatches(lintResults, existing) ⇒ | ||
## getTodoBatches(maybeTodos, existing, options) ⇒ | ||
Gets 4 maps containing todo items to add, remove, those that are expired, or those that are stable (not to be modified). | ||
@@ -268,4 +251,5 @@ | ||
| --- | --- | | ||
| lintResults | The linting data for all violations. | | ||
| maybeTodos | The linting data for violations. | | ||
| existing | Existing todo lint data. | | ||
| options | An object containing write options. | | ||
@@ -272,0 +256,0 @@ <a name="applyTodoChanges"></a> |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
112405
1214
393