@ember-template-lint/todo-utils
Advanced tools
Comparing version 8.0.0 to 8.1.0
@@ -0,1 +1,10 @@ | ||
## v8.1.0 (2021-05-04) | ||
#### :rocket: Enhancement | ||
* [#185](https://github.com/ember-template-lint/ember-template-lint-todo-utils/pull/185) Adding expired batch to getTodoBatches ([@scalvert](https://github.com/scalvert)) | ||
#### Committers: 1 | ||
- Steve Calvert ([@scalvert](https://github.com/scalvert)) | ||
## v8.0.0 (2021-03-09) | ||
@@ -2,0 +11,0 @@ |
@@ -7,3 +7,3 @@ "use strict"; | ||
const io_1 = require("./io"); | ||
const get_severity_1 = require("./get-severity"); | ||
const date_utils_1 = require("./date-utils"); | ||
/** | ||
@@ -79,3 +79,3 @@ * Adapts a list of {@link https://github.com/ember-template-lint/ember-template-lint-todo-utils/blob/master/src/types/index.ts#L32|LintResult} to a map of {@link https://github.com/ember-template-lint/ember-template-lint-todo-utils/blob/master/src/types/index.ts#L35|FilePath}, {@link https://github.com/ember-template-lint/ember-template-lint-todo-utils/blob/master/src/types/index.ts#L36|TodoData}. | ||
const date = process.env.TODO_CREATED_DATE ? new Date(process.env.TODO_CREATED_DATE) : new Date(); | ||
return get_severity_1.getDatePart(date); | ||
return date_utils_1.getDatePart(date); | ||
} | ||
@@ -82,0 +82,0 @@ function addDays(createdDate, days) { |
@@ -10,9 +10,2 @@ import { Severity, TodoData } from './types'; | ||
export declare function getSeverity(todo: TodoData, today?: number): Severity; | ||
/** | ||
* Converts a date to include year, month, and day values only (time is zeroed out). | ||
* | ||
* @param date - The date to convert | ||
* @returns Date - A date with the time zeroed out eg. '2021-01-01T08:00:00.000Z' | ||
*/ | ||
export declare function getDatePart(date?: Date): Date; | ||
//# sourceMappingURL=get-severity.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getDatePart = exports.getSeverity = void 0; | ||
exports.getSeverity = void 0; | ||
const date_utils_1 = require("./date-utils"); | ||
const types_1 = require("./types"); | ||
@@ -12,7 +13,7 @@ /** | ||
*/ | ||
function getSeverity(todo, today = getDatePart().getTime()) { | ||
if (todo.errorDate && today > todo.errorDate) { | ||
function getSeverity(todo, today = date_utils_1.getDatePart().getTime()) { | ||
if (date_utils_1.isExpired(todo.errorDate, today)) { | ||
return types_1.Severity.error; | ||
} | ||
else if (todo.warnDate && today > todo.warnDate) { | ||
else if (date_utils_1.isExpired(todo.warnDate)) { | ||
return types_1.Severity.warn; | ||
@@ -23,12 +24,2 @@ } | ||
exports.getSeverity = getSeverity; | ||
/** | ||
* Converts a date to include year, month, and day values only (time is zeroed out). | ||
* | ||
* @param date - The date to convert | ||
* @returns Date - A date with the time zeroed out eg. '2021-01-01T08:00:00.000Z' | ||
*/ | ||
function getDatePart(date = new Date()) { | ||
return new Date(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0); | ||
} | ||
exports.getDatePart = getDatePart; | ||
//# sourceMappingURL=get-severity.js.map |
export { _buildTodoDatum, buildTodoData } from './builders'; | ||
export { applyTodoChanges, ensureTodoStorageDir, getTodoStorageDirPath, getTodoBatches, todoStorageDirExists, todoDirFor, todoFileNameFor, todoFilePathFor, readTodos, readTodosForFilePath, writeTodos, applyTodoChangesSync, ensureTodoStorageDirSync, getTodoBatchesSync, readTodosSync, readTodosForFilePathSync, writeTodosSync, } from './io'; | ||
export { getTodoConfig, writeTodoConfig, ensureTodoConfig } from './todo-config'; | ||
export { getSeverity, getDatePart } from './get-severity'; | ||
export { getSeverity } from './get-severity'; | ||
export { getDatePart, isExpired } from './date-utils'; | ||
export * from './types'; | ||
//# sourceMappingURL=index.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isExpired = exports.getDatePart = exports.getSeverity = exports.ensureTodoConfig = exports.writeTodoConfig = exports.getTodoConfig = exports.writeTodosSync = exports.readTodosForFilePathSync = exports.readTodosSync = exports.getTodoBatchesSync = exports.ensureTodoStorageDirSync = exports.applyTodoChangesSync = exports.writeTodos = exports.readTodosForFilePath = exports.readTodos = exports.todoFilePathFor = exports.todoFileNameFor = exports.todoDirFor = exports.todoStorageDirExists = exports.getTodoBatches = exports.getTodoStorageDirPath = exports.ensureTodoStorageDir = exports.applyTodoChanges = exports.buildTodoData = exports._buildTodoDatum = void 0; | ||
const tslib_1 = require("tslib"); | ||
@@ -31,4 +32,6 @@ var builders_1 = require("./builders"); | ||
Object.defineProperty(exports, "getSeverity", { enumerable: true, get: function () { return get_severity_1.getSeverity; } }); | ||
Object.defineProperty(exports, "getDatePart", { enumerable: true, get: function () { return get_severity_1.getDatePart; } }); | ||
var date_utils_1 = require("./date-utils"); | ||
Object.defineProperty(exports, "getDatePart", { enumerable: true, get: function () { return date_utils_1.getDatePart; } }); | ||
Object.defineProperty(exports, "isExpired", { enumerable: true, get: function () { return date_utils_1.isExpired; } }); | ||
tslib_1.__exportStar(require("./types"), exports); | ||
//# sourceMappingURL=index.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.applyTodoChanges = exports.applyTodoChangesSync = exports.getTodoBatches = exports.getTodoBatchesSync = exports.readTodosForFilePath = exports.readTodosForFilePathSync = exports.readTodos = exports.readTodosSync = exports.writeTodos = exports.writeTodosSync = exports.todoFileNameFor = exports.todoDirFor = exports.todoFilePathFor = exports.getTodoStorageDirPath = exports.ensureTodoStorageDir = exports.ensureTodoStorageDirSync = exports.todoStorageDirExists = void 0; | ||
/* eslint-disable @typescript-eslint/no-non-null-assertion */ | ||
const crypto_1 = require("crypto"); | ||
@@ -8,2 +9,3 @@ const path_1 = require("path"); | ||
const builders_1 = require("./builders"); | ||
const date_utils_1 = require("./date-utils"); | ||
/** | ||
@@ -240,2 +242,3 @@ * Determines if the .lint-todo storage directory exists. | ||
const remove = new Map(); | ||
const expired = new Map(); | ||
const stable = new Map(); | ||
@@ -247,8 +250,15 @@ for (const [fileHash, todoDatum] of lintResults) { | ||
else { | ||
stable.set(fileHash, todoDatum); | ||
const existingTodo = existing.get(fileHash); | ||
if (existingTodo && !date_utils_1.isExpired(existingTodo.errorDate)) { | ||
stable.set(fileHash, todoDatum); | ||
} | ||
} | ||
} | ||
for (const [fileHash, todoDatum] of existing) { | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
if (!lintResults.has(fileHash) && options.shouldRemove(todoDatum)) { | ||
if (lintResults.has(fileHash) && | ||
date_utils_1.isExpired(todoDatum.errorDate) && | ||
options.shouldRemove(todoDatum)) { | ||
expired.set(fileHash, todoDatum); | ||
} | ||
else if (!lintResults.has(fileHash) && options.shouldRemove(todoDatum)) { | ||
remove.set(fileHash, todoDatum); | ||
@@ -260,3 +270,3 @@ } | ||
} | ||
return [add, remove, stable]; | ||
return [add, remove, stable, expired]; | ||
} | ||
@@ -274,2 +284,3 @@ exports.getTodoBatchesSync = getTodoBatchesSync; | ||
const remove = new Map(); | ||
const expired = new Map(); | ||
const stable = new Map(); | ||
@@ -281,8 +292,15 @@ for (const [fileHash, todoDatum] of lintResults) { | ||
else { | ||
stable.set(fileHash, todoDatum); | ||
const existingTodo = existing.get(fileHash); | ||
if (existingTodo && !date_utils_1.isExpired(existingTodo.errorDate)) { | ||
stable.set(fileHash, todoDatum); | ||
} | ||
} | ||
} | ||
for (const [fileHash, todoDatum] of existing) { | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
if (!lintResults.has(fileHash) && options.shouldRemove(todoDatum)) { | ||
if (lintResults.has(fileHash) && | ||
date_utils_1.isExpired(todoDatum.errorDate) && | ||
options.shouldRemove(todoDatum)) { | ||
expired.set(fileHash, todoDatum); | ||
} | ||
else if (!lintResults.has(fileHash) && options.shouldRemove(todoDatum)) { | ||
remove.set(fileHash, todoDatum); | ||
@@ -294,3 +312,3 @@ } | ||
} | ||
return [add, remove, stable]; | ||
return [add, remove, stable, expired]; | ||
} | ||
@@ -297,0 +315,0 @@ exports.getTodoBatches = getTodoBatches; |
{ | ||
"name": "@ember-template-lint/todo-utils", | ||
"version": "8.0.0", | ||
"version": "8.1.0", | ||
"repository": "https://github.com/ember-template-lint/ember-template-lint-todo-utils.git", | ||
@@ -19,3 +19,3 @@ "license": "MIT", | ||
"dependencies": { | ||
"@types/eslint": "^7.2.7", | ||
"@types/eslint": "^7.2.10", | ||
"fs-extra": "^9.1.0", | ||
@@ -26,14 +26,14 @@ "slash": "^3.0.0", | ||
"devDependencies": { | ||
"@types/fs-extra": "^9.0.8", | ||
"@types/fs-extra": "^9.0.11", | ||
"@types/slash": "^3.0.0", | ||
"@types/tmp": "^0.2.0", | ||
"@typescript-eslint/eslint-plugin": "^4.17.0", | ||
"@typescript-eslint/parser": "^4.17.0", | ||
"date-fns": "^2.19.0", | ||
"eslint": "^7.21.0", | ||
"@typescript-eslint/eslint-plugin": "^4.22.0", | ||
"@typescript-eslint/parser": "^4.22.0", | ||
"date-fns": "^2.21.1", | ||
"eslint": "^7.25.0", | ||
"eslint-config-prettier": "^7.2.0", | ||
"eslint-plugin-jest": "^24.1.9", | ||
"eslint-plugin-jest": "^24.3.6", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-prettier": "^3.3.1", | ||
"eslint-plugin-tsdoc": "^0.2.11", | ||
"eslint-plugin-prettier": "^3.4.0", | ||
"eslint-plugin-tsdoc": "^0.2.14", | ||
"eslint-plugin-unicorn": "^22.0.0", | ||
@@ -44,3 +44,3 @@ "fixturify-project": "^2.1.1", | ||
"prettier": "^2.2.1", | ||
"release-it": "^14.4.1", | ||
"release-it": "^14.6.1", | ||
"release-it-lerna-changelog": "^3.1.0", | ||
@@ -50,3 +50,3 @@ "tmp": "^0.2.1", | ||
"type-fest": "^0.20.2", | ||
"typescript": "^4.2.3" | ||
"typescript": "^4.2.4" | ||
}, | ||
@@ -53,0 +53,0 @@ "engines": { |
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
110217
36
1078
Updated@types/eslint@^7.2.10