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

eslint-plugin-tsdoc

Package Overview
Dependencies
Maintainers
3
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-tsdoc - npm Package Compare versions

Comparing version 0.2.6 to 0.2.7

lib/ConfigCache.d.ts.map

20

CHANGELOG.json

@@ -5,2 +5,22 @@ {

{
"version": "0.2.7",
"tag": "eslint-plugin-tsdoc_v0.2.7",
"date": "Fri, 04 Sep 2020 15:53:27 GMT",
"comments": {
"patch": [
{
"comment": "Update build system"
}
],
"dependency": [
{
"comment": "Updating dependency \"@microsoft/tsdoc\" from `0.12.20` to `0.12.21`"
},
{
"comment": "Updating dependency \"@microsoft/tsdoc-config\" from `0.13.5` to `0.13.6`"
}
]
}
},
{
"version": "0.2.6",

@@ -7,0 +27,0 @@ "tag": "eslint-plugin-tsdoc_v0.2.6",

9

CHANGELOG.md
# Change Log - eslint-plugin-tsdoc
This log was last generated on Sun, 19 Jul 2020 01:22:35 GMT and should not be manually modified.
This log was last generated on Fri, 04 Sep 2020 15:53:27 GMT and should not be manually modified.
## 0.2.7
Fri, 04 Sep 2020 15:53:27 GMT
### Patches
- Update build system
## 0.2.6

@@ -6,0 +13,0 @@ Sun, 19 Jul 2020 01:22:35 GMT

@@ -10,1 +10,2 @@ import { TSDocConfigFile } from '@microsoft/tsdoc-config';

}
//# sourceMappingURL=ConfigCache.d.ts.map

58

lib/ConfigCache.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tsdoc_config_1 = require("@microsoft/tsdoc-config");
var path = require("path");
var Debug_1 = require("./Debug");
const tsdoc_config_1 = require("@microsoft/tsdoc-config");
const path = require("path");
const Debug_1 = require("./Debug");
// How often to check for modified input files. If a file's modification timestamp has changed, then we will
// evict the cache entry immediately.
var CACHE_CHECK_INTERVAL_MS = 3 * 1000;
const CACHE_CHECK_INTERVAL_MS = 3 * 1000;
// Evict old entries from the cache after this much time, regardless of whether the file was detected as being
// modified or not.
var CACHE_EXPIRE_MS = 20 * 1000;
const CACHE_EXPIRE_MS = 20 * 1000;
// If this many objects accumulate in the cache, then it is cleared to avoid a memory leak.
var CACHE_MAX_SIZE = 100;
var ConfigCache = /** @class */ (function () {
function ConfigCache() {
}
const CACHE_MAX_SIZE = 100;
class ConfigCache {
/**
* Node.js equivalent of performance.now().
*/
ConfigCache._getTimeInMs = function () {
var _a = process.hrtime(), seconds = _a[0], nanoseconds = _a[1];
static _getTimeInMs() {
const [seconds, nanoseconds] = process.hrtime();
return seconds * 1000 + nanoseconds / 1000000;
};
ConfigCache.getForSourceFile = function (sourceFilePath) {
var sourceFileFolder = path.dirname(path.resolve(sourceFilePath));
}
static getForSourceFile(sourceFilePath) {
const sourceFileFolder = path.dirname(path.resolve(sourceFilePath));
// First, determine the file to be loaded. If not found, the configFilePath will be an empty string.
var configFilePath = tsdoc_config_1.TSDocConfigFile.findConfigPathForFolder(sourceFileFolder);
const configFilePath = tsdoc_config_1.TSDocConfigFile.findConfigPathForFolder(sourceFileFolder);
// If configFilePath is an empty string, then we'll use the folder of sourceFilePath as our cache key
// (instead of an empty string)
var cacheKey = configFilePath || (sourceFileFolder + '/');
Debug_1.Debug.log("Cache key: \"" + cacheKey + "\"");
var nowMs = ConfigCache._getTimeInMs();
var cachedConfig = undefined;
const cacheKey = configFilePath || (sourceFileFolder + '/');
Debug_1.Debug.log(`Cache key: "${cacheKey}"`);
const nowMs = ConfigCache._getTimeInMs();
let cachedConfig = undefined;
// Do we have a cached object?

@@ -39,4 +37,4 @@ cachedConfig = ConfigCache._cachedConfigs.get(cacheKey);

// Is the cached object still valid?
var loadAgeMs = nowMs - cachedConfig.loadTimeMs;
var lastCheckAgeMs = nowMs - cachedConfig.lastCheckTimeMs;
const loadAgeMs = nowMs - cachedConfig.loadTimeMs;
const lastCheckAgeMs = nowMs - cachedConfig.lastCheckTimeMs;
if (loadAgeMs > CACHE_EXPIRE_MS || loadAgeMs < 0) {

@@ -64,11 +62,11 @@ Debug_1.Debug.log('Evicting because item is expired');

}
var configFile = tsdoc_config_1.TSDocConfigFile.loadFile(configFilePath);
const configFile = tsdoc_config_1.TSDocConfigFile.loadFile(configFilePath);
if (configFile.fileNotFound) {
Debug_1.Debug.log("File not found: \"" + configFilePath + "\"");
Debug_1.Debug.log(`File not found: "${configFilePath}"`);
}
else {
Debug_1.Debug.log("Loaded: \"" + configFilePath + "\"");
Debug_1.Debug.log(`Loaded: "${configFilePath}"`);
}
cachedConfig = {
configFile: configFile,
configFile,
lastCheckTimeMs: nowMs,

@@ -80,7 +78,7 @@ loadTimeMs: nowMs

return cachedConfig.configFile;
};
// findConfigPathForFolder() result --> loaded tsdoc.json configuration
ConfigCache._cachedConfigs = new Map();
return ConfigCache;
}());
}
}
// findConfigPathForFolder() result --> loaded tsdoc.json configuration
ConfigCache._cachedConfigs = new Map();
exports.ConfigCache = ConfigCache;
//# sourceMappingURL=ConfigCache.js.map
export declare class Debug {
static log(message: string): void;
}
//# sourceMappingURL=Debug.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Debug = /** @class */ (function () {
function Debug() {
}
class Debug {
// To debug the plugin, temporarily uncomment the body of this function
Debug.log = function (message) {
static log(message) {
// message = require("process").pid + ": " + message;
// console.log(message);
// require('fs').writeFileSync('C:\\Git\\log.txt', message + '\r\n', { flag: 'as' });
};
return Debug;
}());
}
}
exports.Debug = Debug;
//# sourceMappingURL=Debug.js.map

@@ -9,1 +9,2 @@ import * as eslint from "eslint";

export = plugin;
//# sourceMappingURL=index.d.ts.map
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var tsdoc_1 = require("@microsoft/tsdoc");
var Debug_1 = require("./Debug");
var ConfigCache_1 = require("./ConfigCache");
var tsdocMessageIds = {};
var defaultTSDocConfiguration = new tsdoc_1.TSDocConfiguration();
defaultTSDocConfiguration.allTsdocMessageIds.forEach(function (messageId) {
tsdocMessageIds[messageId] = messageId + ": {{unformattedText}}";
const tsdoc_1 = require("@microsoft/tsdoc");
const Debug_1 = require("./Debug");
const ConfigCache_1 = require("./ConfigCache");
const tsdocMessageIds = {};
const defaultTSDocConfiguration = new tsdoc_1.TSDocConfiguration();
defaultTSDocConfiguration.allTsdocMessageIds.forEach((messageId) => {
tsdocMessageIds[messageId] = `${messageId}: {{unformattedText}}`;
});
var plugin = {
const plugin = {
rules: {

@@ -27,3 +16,3 @@ // NOTE: The actual ESLint rule name will be "tsdoc/syntax". It is calculated by deleting "eslint-plugin-"

meta: {
messages: __assign({ "error-loading-config-file": "Error loading TSDoc config file:\n{{details}}", "error-applying-config": "Error applying TSDoc configuration: {{details}}" }, tsdocMessageIds),
messages: Object.assign({ "error-loading-config-file": "Error loading TSDoc config file:\n{{details}}", "error-applying-config": "Error applying TSDoc configuration: {{details}}" }, tsdocMessageIds),
type: "problem",

@@ -38,8 +27,8 @@ docs: {

},
create: function (context) {
var sourceFilePath = context.getFilename();
Debug_1.Debug.log("Linting: \"" + sourceFilePath + "\"");
var tsdocConfiguration = new tsdoc_1.TSDocConfiguration();
create: (context) => {
const sourceFilePath = context.getFilename();
Debug_1.Debug.log(`Linting: "${sourceFilePath}"`);
const tsdocConfiguration = new tsdoc_1.TSDocConfiguration();
try {
var tsdocConfigFile = ConfigCache_1.ConfigCache.getForSourceFile(sourceFilePath);
const tsdocConfigFile = ConfigCache_1.ConfigCache.getForSourceFile(sourceFilePath);
if (!tsdocConfigFile.fileNotFound) {

@@ -74,11 +63,10 @@ if (tsdocConfigFile.hasErrors) {

data: {
details: "Unexpected exception: " + e.message
details: `Unexpected exception: ${e.message}`
}
});
}
var tsdocParser = new tsdoc_1.TSDocParser(tsdocConfiguration);
var sourceCode = context.getSourceCode();
var checkCommentBlocks = function (node) {
for (var _i = 0, _a = sourceCode.getAllComments(); _i < _a.length; _i++) {
var comment = _a[_i];
const tsdocParser = new tsdoc_1.TSDocParser(tsdocConfiguration);
const sourceCode = context.getSourceCode();
const checkCommentBlocks = function (node) {
for (const comment of sourceCode.getAllComments()) {
if (comment.type !== "Block") {

@@ -90,3 +78,3 @@ continue;

}
var textRange = tsdoc_1.TextRange.fromStringRange(sourceCode.text, comment.range[0], comment.range[1]);
const textRange = tsdoc_1.TextRange.fromStringRange(sourceCode.text, comment.range[0], comment.range[1]);
// Smallest comment is "/***/"

@@ -100,5 +88,4 @@ if (textRange.length < 5) {

}
var parserContext = tsdocParser.parseRange(textRange);
for (var _b = 0, _c = parserContext.log.messages; _b < _c.length; _b++) {
var message = _c[_b];
const parserContext = tsdocParser.parseRange(textRange);
for (const message of parserContext.log.messages) {
context.report({

@@ -125,1 +112,2 @@ loc: {

module.exports = plugin;
//# sourceMappingURL=index.js.map
{
"name": "eslint-plugin-tsdoc",
"version": "0.2.6",
"version": "0.2.7",
"description": "An ESLint plugin that validates TypeScript doc comments",

@@ -24,19 +24,19 @@ "keywords": [

"scripts": {
"build": "node ./build.js",
"lint": "eslint -f unix \"src/**/*.{ts,tsx}\"",
"test": "node lib/tests/index.js"
"build": "heft test --clean",
"lint": "eslint -f unix \"src/**/*.{ts,tsx}\""
},
"dependencies": {
"@microsoft/tsdoc": "0.12.20",
"@microsoft/tsdoc-config": "0.13.5"
"@microsoft/tsdoc": "0.12.21",
"@microsoft/tsdoc-config": "0.13.6"
},
"devDependencies": {
"@rushstack/eslint-config": "1.0.1",
"@microsoft/rush-stack-compiler-3.5": "~0.8.4",
"@rushstack/eslint-config": "~1.3.0",
"@rushstack/heft": "^0.10.1",
"@types/eslint": "6.1.3",
"@types/estree": "0.0.39",
"@types/heft-jest": "1.0.1",
"@types/node": "10.17.5",
"eslint": "~7.2.0",
"rimraf": "~2.6.3",
"typescript": "~3.5.3"
"eslint": "~7.2.0"
}
}
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