Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ember-template-lint/todo-utils

Package Overview
Dependencies
Maintainers
4
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ember-template-lint/todo-utils - npm Package Compare versions

Comparing version 2.2.0 to 2.3.0

12

CHANGELOG.md

@@ -0,1 +1,13 @@

## v2.3.0 (2020-10-26)
#### :rocket: Enhancement
* [#20](https://github.com/ember-template-lint/ember-template-lint-todo-utils/pull/20) Adding API to determine if storage directory exists ([@scalvert](https://github.com/scalvert))
#### :bug: Bug Fix
* [#17](https://github.com/ember-template-lint/ember-template-lint-todo-utils/pull/17) Ensure we're operating on relative paths vs. absolute ([@scalvert](https://github.com/scalvert))
#### Committers: 1
- Steve Calvert ([@scalvert](https://github.com/scalvert))
## v2.2.0 (2020-10-15)

@@ -2,0 +14,0 @@

9

lib/builders.d.ts

@@ -6,7 +6,10 @@ import { FilePath, LintMessage, LintResult, TodoData } from './types';

*
* @param baseDir The base directory that contains the .lint-todo storage directory.
* @param lintResults A list of {LintResult} objects to convert to {TodoData} objects.
*/
export declare function buildTodoData(lintResults: LintResult[]): Map<FilePath, TodoData>;
export declare function buildTodoData(baseDir: string, lintResults: LintResult[]): Map<FilePath, TodoData>;
/**
* Adapts an {ESLint.LintResult} or {TemplateLintResult} to a {TodoData}
* Adapts an {ESLint.LintResult} or {TemplateLintResult} 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.
*

@@ -16,3 +19,3 @@ * @param lintResult The lint result object, either an {ESLint.LintResult} or a {TemplateLintResult}.

*/
export declare function _buildTodoDatum(lintResult: LintResult, lintMessage: LintMessage): TodoData;
export declare function _buildTodoDatum(baseDir: string, lintResult: LintResult, lintMessage: LintMessage): TodoData;
//# sourceMappingURL=builders.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports._buildTodoDatum = exports.buildTodoData = void 0;
const path_1 = require("path");
const io_1 = require("./io");

@@ -9,5 +10,6 @@ /**

*
* @param baseDir The base directory that contains the .lint-todo storage directory.
* @param lintResults A list of {LintResult} objects to convert to {TodoData} objects.
*/
function buildTodoData(lintResults) {
function buildTodoData(baseDir, lintResults) {
const results = lintResults.filter((result) => result.messages.length > 0);

@@ -17,3 +19,3 @@ const todoData = results.reduce((converted, lintResult) => {

if (message.severity === 2) {
const todoDatum = _buildTodoDatum(lintResult, message);
const todoDatum = _buildTodoDatum(baseDir, lintResult, message);
converted.set(io_1.todoFilePathFor(todoDatum), todoDatum);

@@ -28,3 +30,5 @@ }

/**
* Adapts an {ESLint.LintResult} or {TemplateLintResult} to a {TodoData}
* Adapts an {ESLint.LintResult} or {TemplateLintResult} 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.
*

@@ -34,6 +38,6 @@ * @param lintResult The lint result object, either an {ESLint.LintResult} or a {TemplateLintResult}.

*/
function _buildTodoDatum(lintResult, lintMessage) {
function _buildTodoDatum(baseDir, lintResult, lintMessage) {
return {
engine: getEngine(lintResult),
filePath: lintResult.filePath,
filePath: path_1.relative(baseDir, lintResult.filePath),
ruleId: getRuleId(lintMessage),

@@ -40,0 +44,0 @@ line: lintMessage.line,

export { _buildTodoDatum, buildTodoData } from './builders';
export { ensureTodoDir, getTodoStorageDirPath, writeTodos, getTodoBatches, todoFilePathFor, todoDirFor, todoFileNameFor, readTodos, readTodosForFilePath, } from './io';
export { ensureTodoDir, getTodoStorageDirPath, getTodoBatches, todoDirExists, todoDirFor, todoFileNameFor, todoFilePathFor, readTodos, readTodosForFilePath, writeTodos, } from './io';
export * from './types';
//# sourceMappingURL=index.d.ts.map

@@ -10,10 +10,11 @@ "use strict";

Object.defineProperty(exports, "getTodoStorageDirPath", { enumerable: true, get: function () { return io_1.getTodoStorageDirPath; } });
Object.defineProperty(exports, "writeTodos", { enumerable: true, get: function () { return io_1.writeTodos; } });
Object.defineProperty(exports, "getTodoBatches", { enumerable: true, get: function () { return io_1.getTodoBatches; } });
Object.defineProperty(exports, "todoFilePathFor", { enumerable: true, get: function () { return io_1.todoFilePathFor; } });
Object.defineProperty(exports, "todoDirExists", { enumerable: true, get: function () { return io_1.todoDirExists; } });
Object.defineProperty(exports, "todoDirFor", { enumerable: true, get: function () { return io_1.todoDirFor; } });
Object.defineProperty(exports, "todoFileNameFor", { enumerable: true, get: function () { return io_1.todoFileNameFor; } });
Object.defineProperty(exports, "todoFilePathFor", { enumerable: true, get: function () { return io_1.todoFilePathFor; } });
Object.defineProperty(exports, "readTodos", { enumerable: true, get: function () { return io_1.readTodos; } });
Object.defineProperty(exports, "readTodosForFilePath", { enumerable: true, get: function () { return io_1.readTodosForFilePath; } });
Object.defineProperty(exports, "writeTodos", { enumerable: true, get: function () { return io_1.writeTodos; } });
tslib_1.__exportStar(require("./types"), exports);
//# sourceMappingURL=index.js.map
import { FilePath, LintResult, TodoData } from './types';
export declare function todoDirExists(baseDir: string): Promise<boolean>;
/**

@@ -18,2 +19,3 @@ * Creates, or ensures the creation of, the .lint-todo directory.

*
* @param baseDir The base directory that contains the .lint-todo storage directory.
* @param todoData The linting data for an individual violation.

@@ -58,3 +60,3 @@ */

*/
export declare function readTodosForFilePath(todoStorageDir: string, filesDirOrPath: string): Promise<Map<FilePath, TodoData>>;
export declare function readTodosForFilePath(todoStorageDir: string, filePath: string): Promise<Map<FilePath, TodoData>>;
/**

@@ -61,0 +63,0 @@ * Gets 3 maps containing todo items to add, remove, or those that are stable (not to be modified).

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getTodoBatches = exports.readTodosForFilePath = exports.readTodos = exports.writeTodos = exports.todoFileNameFor = exports.todoDirFor = exports.todoFilePathFor = exports.getTodoStorageDirPath = exports.ensureTodoDir = void 0;
exports.getTodoBatches = exports.readTodosForFilePath = exports.readTodos = exports.writeTodos = exports.todoFileNameFor = exports.todoDirFor = exports.todoFilePathFor = exports.getTodoStorageDirPath = exports.ensureTodoDir = exports.todoDirExists = void 0;
const crypto_1 = require("crypto");
const path_1 = require("path");
const util_1 = require("util");
const fs_1 = require("fs");
const fs_extra_1 = require("fs-extra");
const builders_1 = require("./builders");
const exists = util_1.promisify(fs_1.access);
async function todoDirExists(baseDir) {
try {
await exists(getTodoStorageDirPath(baseDir));
return true;
}
catch (error) {
if (error.code === 'ENOENT') {
return false;
}
throw error;
}
}
exports.todoDirExists = todoDirExists;
/**

@@ -32,2 +48,3 @@ * Creates, or ensures the creation of, the .lint-todo directory.

*
* @param baseDir The base directory that contains the .lint-todo storage directory.
* @param todoData The linting data for an individual violation.

@@ -74,3 +91,3 @@ */

: await readTodos(todoStorageDir);
const [add, remove] = await getTodoBatches(builders_1.buildTodoData(lintResults), existing);
const [add, remove] = await getTodoBatches(builders_1.buildTodoData(baseDir, lintResults), existing);
await _generateFiles(todoStorageDir, add, remove);

@@ -104,5 +121,5 @@ return todoStorageDir;

*/
async function readTodosForFilePath(todoStorageDir, filesDirOrPath) {
async function readTodosForFilePath(todoStorageDir, filePath) {
const map = new Map();
const todoFileDir = todoDirFor(filesDirOrPath);
const todoFileDir = todoDirFor(filePath);
const todoFilePathDir = path_1.join(todoStorageDir, todoFileDir);

@@ -109,0 +126,0 @@ try {

{
"name": "@ember-template-lint/todo-utils",
"version": "2.2.0",
"version": "2.3.0",
"repository": "https://github.com/ember-template-lint/ember-template-lint-todo-utils.git",

@@ -40,2 +40,5 @@ "license": "MIT",

},
"engines": {
"node": "10.* || 12.* || >= 14"
},
"files": [

@@ -42,0 +45,0 @@ "lib/"

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc