🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
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

to
0.1.2

17

CHANGELOG.json

@@ -5,2 +5,19 @@ {

{
"version": "0.1.2",
"tag": "eslint-plugin-tsdoc_v0.1.2",
"date": "Sat, 09 Nov 2019 05:55:42 GMT",
"comments": {
"patch": [
{
"comment": "Improve lint rule to check every doc comment in a source file"
}
],
"dependency": [
{
"comment": "Updating dependency \"@microsoft/tsdoc\" from `0.12.14` to `0.12.15`"
}
]
}
},
{
"version": "0.1.1",

@@ -7,0 +24,0 @@ "tag": "eslint-plugin-tsdoc_v0.1.1",

9

CHANGELOG.md
# Change Log - eslint-plugin-tsdoc
This log was last generated on Sat, 09 Nov 2019 04:57:59 GMT and should not be manually modified.
This log was last generated on Sat, 09 Nov 2019 05:55:42 GMT and should not be manually modified.
## 0.1.2
Sat, 09 Nov 2019 05:55:42 GMT
### Patches
- Improve lint rule to check every doc comment in a source file
## 0.1.1

@@ -6,0 +13,0 @@ Sat, 09 Nov 2019 04:57:59 GMT

33

lib/index.js
"use strict";
var tsdoc_1 = require("@microsoft/tsdoc");
var TSDocMessageId_1 = require("@microsoft/tsdoc/lib/parser/TSDocMessageId");
var messageIds = {};
TSDocMessageId_1.allTsdocMessageIds.forEach(function (messageId) {
var defaultTSDocConfiguration = new tsdoc_1.TSDocConfiguration();
defaultTSDocConfiguration.allTsdocMessageIds.forEach(function (messageId) {
messageIds[messageId] = messageId + ": {{ unformattedText }}";

@@ -46,8 +46,22 @@ });

var checkCommentBlocks = function (node) {
var commentToken = sourceCode.getJSDocComment(node);
if (commentToken) {
var textRange = tsdoc_1.TextRange.fromStringRange(sourceCode.text, commentToken.range[0], commentToken.range[1]);
var results = tsdocParser.parseRange(textRange).log;
for (var _i = 0, _a = results.messages; _i < _a.length; _i++) {
var message = _a[_i];
for (var _i = 0, _a = sourceCode.getAllComments(); _i < _a.length; _i++) {
var comment = _a[_i];
if (comment.type !== "Block") {
continue;
}
if (!comment.range) {
continue;
}
var textRange = tsdoc_1.TextRange.fromStringRange(sourceCode.text, comment.range[0], comment.range[1]);
// Smallest comment is "/***/"
if (textRange.length < 5) {
continue;
}
// Make sure it starts with "/**"
if (textRange.buffer[textRange.pos + 2] !== '*') {
continue;
}
var parserContext = tsdocParser.parseRange(textRange);
for (var _b = 0, _c = parserContext.log.messages; _b < _c.length; _b++) {
var message = _c[_b];
context.report({

@@ -67,4 +81,3 @@ loc: {

return {
ClassDeclaration: checkCommentBlocks,
FunctionDeclaration: checkCommentBlocks
Program: checkCommentBlocks
};

@@ -71,0 +84,0 @@ }

{
"name": "eslint-plugin-tsdoc",
"version": "0.1.1",
"version": "0.1.2",
"description": "An ESLint plugin that validates TypeScript doc comments",

@@ -29,3 +29,3 @@ "keywords": [

"dependencies": {
"@microsoft/tsdoc": "0.12.14"
"@microsoft/tsdoc": "0.12.15"
},

@@ -32,0 +32,0 @@ "devDependencies": {