renatoi / ember-template-lint-todo-utils

A set of utilities that enable the management of "todo" lint violations.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

@ember-template-lint/todo-utils

CI Build License Dependabot Volta Managed TypeScript Code Style: prettier

A collection of utilities to generate and store lint item metadata.

Those utilities are:

buildTodoData(lintResults)

Adapts a list of ESLint.LintResult or TemplateLintResult to a map of FilePath, TodoData.

ensureTodoDir(baseDir)

Creates, or ensures the creation of, the .lint-todo directory.

getTodoStorageDirPath(baseDir)
todoFilePathFor(todoData)

Creates a file path from the linting data. Excludes extension.

todoDirFor(filePath)

Creates a short hash for the todo's file path.

todoFileNameFor(todoData)

Generates a unique filename for a todo lint data.

writeTodos(baseDir, lintResults, filePath?)

Writes files for todo lint violations. One file is generated for each violation, using a generated hash to identify each.

Given a list of todo lint violations, this function will also delete existing files that no longer have a todo lint violation.

readTodos(todoStorageDir, filePath?)

Reads all todo files in the .lint-todo directory.

getTodoBatches(lintResults, existing)

Gets 3 maps containing todo items to add, remove, or those that are stable (not to be modified).

buildTodoData(lintResults)

Adapts a list of ESLint.LintResult or TemplateLintResult to a map of FilePath, TodoData.

Kind: global function

Param Type Description
lintResults LintResult A list of objects to convert to {TodoData} objects.

ensureTodoDir(baseDir)

Creates, or ensures the creation of, the .lint-todo directory.

Kind: global function

Param Description
baseDir The base directory that contains the .lint-todo storage directory.

getTodoStorageDirPath(baseDir)

Kind: global function

Param Description
baseDir The base directory that contains the .lint-todo storage directory.

todoFilePathFor(todoData)

Creates a file path from the linting data. Excludes extension.

Kind: global function

Param Description
todoData The linting data for an individual violation.

Example

42b8532cff6da75c5e5895a6f33522bf37418d0c/6e3be839

todoDirFor(filePath)

Creates a short hash for the todo's file path.

Kind: global function

Param Description
filePath The filePath from linting data for an individual violation.

todoFileNameFor(todoData)

Generates a unique filename for a todo lint data.

Kind: global function

Param Description
todoData The linting data for an individual violation.

writeTodos(baseDir, lintResults, filePath?)

Writes files for todo lint violations. One file is generated for each violation, using a generated hash to identify each.

Given a list of todo lint violations, this function will also delete existing files that no longer have a todo lint violation.

Kind: global function

Param Description
baseDir The base directory that contains the .lint-todo storage directory.
lintResults The raw linting data.
filePath? The absolute file path of the file to update violations for.

readTodos(todoStorageDir, filePath?)

Reads all todo files in the .lint-todo directory.

Kind: global function

Param Description
todoStorageDir The .lint-todo storage directory.
filePath? The absolute file path of the file to return todo items for.

getTodoBatches(lintResults, existing)

Gets 3 maps containing todo items to add, remove, or those that are stable (not to be modified).

Kind: global function

Param Description
lintResults The linting data for all violations.
existing Existing todo lint data.

About

A set of utilities that enable the management of "todo" lint violations.

License:MIT License


Languages

Language:TypeScript 98.0%Language:JavaScript 2.0%