
Security News
How Enterprise Security Is Adapting to AI-Accelerated Threats
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.
@ember-template-lint/todo-utils
Advanced tools
 [](https://badge.fury.io/js/%40ember-template-lint%2Ftodo-uti
A collection of utilities to generate and store lint item metadata.
Those utilities are:
Adapts a list of LintResult to a map of FilePath, TodoData.
Adapts an LintResult to a TodoData. FilePaths are absolute when received from a lint result, so they're converted to relative paths for stability in serializing the contents to disc.
Determines if the .lint-todo storage directory exists.
Creates, or ensures the creation of, the .lint-todo directory.
Creates, or ensures the creation of, the .lint-todo directory.
Creates a file path from the linting data. Excludes extension.
Creates a short hash for the todo's file path.
Generates a unique filename for a todo lint data.
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.
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.
Reads all todo files in the .lint-todo directory.
Reads all todo files in the .lint-todo directory.
Reads todo files in the .lint-todo directory for a specific filePath.
Reads todo files in the .lint-todo directory for a specific filePath.
Gets 3 maps containing todo items to add, remove, or those that are stable (not to be modified).
Gets 3 maps containing todo items to add, remove, or those that are stable (not to be modified).
Applies todo changes, either adding or removing, based on batches from getTodoBatches.
Applies todo changes, either adding or removing, based on batches from getTodoBatches.
Gets the todo configuration. Config values can be present in
The package.json
Validates whether we have a unique config in a single location.
Returns the correct severity level based on the todo data's decay dates.
Evaluates whether a date is expired (earlier than today)
Converts a date to include year, month, and day values only (time is zeroed out).
Returns the difference in days between two dates.
Formats the date in short form, eg. 2021-01-01
Adapts a list of LintResult to a map of FilePath, TodoData.
Kind: global function
Returns: - A Promise resolving to a Map of FilePath/TodoData.
| Param | Description |
|---|---|
| baseDir | The base directory that contains the .lint-todo storage directory. |
| lintResults | A list of LintResult objects to convert to TodoData objects. |
| todoConfig | An object containing the warn or error days, in integers. |
Adapts an LintResult to a TodoData. FilePaths are absolute when received from a lint result, so they're converted to relative paths for stability in serializing the contents to disc.
Kind: global function
Returns: - A TodoData object.
| Param | Description |
|---|---|
| lintResult | The lint result object. |
| lintMessage | A lint message object representing a specific violation for a file. |
| todoConfig | An object containing the warn or error days, in integers. |
Determines if the .lint-todo storage directory exists.
Kind: global function
Returns: - true if the todo storage directory exists, otherwise false.
| Param | Description |
|---|---|
| baseDir | The base directory that contains the .lint-todo storage directory. |
Creates, or ensures the creation of, the .lint-todo directory.
Kind: global function
Returns: - The todo storage directory path.
| Param | Description |
|---|---|
| baseDir | The base directory that contains the .lint-todo storage directory. |
Creates, or ensures the creation of, the .lint-todo directory.
Kind: global function
Returns: - A promise that resolves to the todo storage directory path.
| Param | Description |
|---|---|
| baseDir | The base directory that contains the .lint-todo storage directory. |
Kind: global function
Returns: - The todo storage directory path.
| 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
Returns: - The todo file path for a TodoData object.
| Param | Description |
|---|---|
| baseDir | The base directory that contains the .lint-todo storage directory. |
| todoData | The linting data for an individual violation. |
Example
42b8532cff6da75c5e5895a6f33522bf37418d0c/6e3be839
Creates a short hash for the todo's file path.
Kind: global function
Returns: - The todo directory for a specific filepath.
| Param | Description |
|---|---|
| filePath | The filePath from linting data for an individual violation. |
Generates a unique filename for a todo lint data.
Kind: global function
Returns: - The todo file name for a TodoData object.
| 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
Returns: - The counts of added and removed todos.
| Param | Description |
|---|---|
| baseDir | The base directory that contains the .lint-todo storage directory. |
| lintResults | The raw linting data. |
| options | An object containing write options. |
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
Returns: - A promise that resolves to the counts of added and removed todos.
| Param | Description |
|---|---|
| baseDir | The base directory that contains the .lint-todo storage directory. |
| lintResults | The raw linting data. |
| options | An object containing write options. |
Reads all todo files in the .lint-todo directory.
Kind: global function
Returns: - A Map of FilePath/TodoData.
| Param | Description |
|---|---|
| baseDir | The base directory that contains the .lint-todo storage directory. |
Reads all todo files in the .lint-todo directory.
Kind: global function
Returns: - A Promise that resolves to a Map of FilePath/TodoData.
| Param | Description |
|---|---|
| baseDir | The base directory that contains the .lint-todo storage directory. |
Reads todo files in the .lint-todo directory for a specific filePath.
Kind: global function
Returns: - A Map of FilePath/TodoData.
| Param | Description |
|---|---|
| todoStorageDir | The .lint-todo storage directory. |
| filePath | The relative file path of the file to return todo items for. |
Reads todo files in the .lint-todo directory for a specific filePath.
Kind: global function
Returns: - A Promise that resolves to a Map of FilePath/TodoData.
| Param | Description |
|---|---|
| todoStorageDir | The .lint-todo storage directory. |
| filePath | The relative 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
Returns: - A Map of FilePath/TodoData.
| Param | Description |
|---|---|
| lintResults | The linting data for all violations. |
| existing | Existing todo lint data. |
Gets 3 maps containing todo items to add, remove, or those that are stable (not to be modified).
Kind: global function
Returns: - A Promise that resolves to a Map of FilePath/TodoData.
| Param | Description |
|---|---|
| lintResults | The linting data for all violations. |
| existing | Existing todo lint data. |
Applies todo changes, either adding or removing, based on batches from getTodoBatches.
Kind: global function
| Param | Description |
|---|---|
| todoStorageDir | The .lint-todo storage directory. |
| add | Batch of todos to add. |
| remove | Batch of todos to remove. |
Applies todo changes, either adding or removing, based on batches from getTodoBatches.
Kind: global function
| Param | Description |
|---|---|
| todoStorageDir | The .lint-todo storage directory. |
| add | Batch of todos to add. |
| remove | Batch of todos to remove. |
Gets the todo configuration. Config values can be present in
The package.json
Kind: global function
Returns: - The todo config object.
| Param | Description |
|---|---|
| baseDir | The base directory that contains the project's package.json. |
| engine | The engine for this configuration, eg. eslint |
| customDaysToDecay | The optional custom days to decay configuration. |
Example
{
"lintTodo": {
"some-engine": {
"daysToDecay": {
"warn": 5,
"error": 10
},
"daysToDecayByRule": {
"no-bare-strings": { "warn": 10, "error": 20 }
}
}
}
}
A .lint-todorc.js file Example
module.exports = {
"some-engine": {
"daysToDecay": {
"warn": 5,
"error": 10
},
"daysToDecayByRule": {
"no-bare-strings": { "warn": 10, "error": 20 }
}
}
}
Environment variables (TODO_DAYS_TO_WARN or TODO_DAYS_TO_ERROR)
- Env vars override package.json config
Passed in directly, such as from command line options. - Passed in options override both env vars and package.json config
Validates whether we have a unique config in a single location.
Kind: global function
Returns: A ConfigValidationResult that indicates whether a config is unique
| Param | Description |
|---|---|
| baseDir | The base directory that contains the project's package.json. |
Returns the correct severity level based on the todo data's decay dates.
Kind: global function
Returns: Severity - the lint severity based on the evaluation of the decay dates.
| Param | Description |
|---|---|
| todo | The todo data. |
| today | A number representing a date (UNIX Epoch - milliseconds) |
Evaluates whether a date is expired (earlier than today)
Kind: global function
Returns: true if the date is earlier than today, otherwise false
| Param | Description |
|---|---|
| date | The date to evaluate |
| today | A number representing a date (UNIX Epoch - milliseconds) |
Converts a date to include year, month, and day values only (time is zeroed out).
Kind: global function
Returns: Date - A date with the time zeroed out eg. '2021-01-01T08:00:00.000Z'
| Param | Description |
|---|---|
| date | The date to convert |
Returns the difference in days between two dates.
Kind: global function
Returns: a number representing the days between the dates
| Param | Description |
|---|---|
| startDate | The start date |
| endDate | The end date |
Formats the date in short form, eg. 2021-01-01
Kind: global function
Returns: A string representing the formatted date
| Param | Description |
|---|---|
| date | The date to format |
FAQs
 [](https://badge.fury.io/js/%40ember-template-lint%2Ftodo-uti
We found that @ember-template-lint/todo-utils demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.