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).
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. |
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. |
Kind: global function
Param | Description |
---|---|
baseDir | The base directory that contains the .lint-todo storage directory. |
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
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. |
Generates a unique filename for a todo lint data.
Kind: global function
Param | Description |
---|---|
todoData | The linting data for an individual violation. |
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. |
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. |
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. |