@robert.tools/linter-jsdoc-format 0.0.0-stage โ 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +32 -2
- package/dist/index.config.d.ts +7 -0
- package/dist/index.config.js +41 -0
- package/dist/index.config.js.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.js +299 -0
- package/dist/index.js.map +1 -0
- package/package.json +62 -5
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Robert Willemelis
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,33 @@
|
|
|
1
|
-
#
|
|
1
|
+
# ๐๏ธ @robert.tools/linter-jsdoc-format
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A linter to verify a correct jsdoc format
|
|
4
|
+
|
|
5
|
+
## ๐ Usage
|
|
6
|
+
|
|
7
|
+
### ๐ข Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @robert.tools/linter-jsdoc-format
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### ๐ Sample usage
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { customJSDocFormat } from '@robert.tools/linter-jsdoc-format';
|
|
17
|
+
|
|
18
|
+
export const rules = {
|
|
19
|
+
'robertz-jsdoc-format': customJSDocFormat,
|
|
20
|
+
};
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## โ๏ธ Notes
|
|
24
|
+
|
|
25
|
+
This software is hand-crafted, test-driven and assisted by AI tools. I know each
|
|
26
|
+
line of my code. โ๏ธ
|
|
27
|
+
|
|
28
|
+
| Tool | Comment |
|
|
29
|
+
| --- | --- |
|
|
30
|
+
|  | Test-driven development with Jest |
|
|
31
|
+
|  | Part of the robert.tools ecosystem |
|
|
32
|
+
|  | Code completion |
|
|
33
|
+
|  | chatGPT research |
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const SERIES: string[];
|
|
2
|
+
export declare const EMOJIS: string[];
|
|
3
|
+
export declare const messages: {
|
|
4
|
+
readonly missingSummaryEmoji: "๐งน Summary line should include \"๐ฏ\".";
|
|
5
|
+
readonly missingDoc4ExportedFunction: "๐งน Exported function should have a JSDoc block (/** ... */) ๐ฏ";
|
|
6
|
+
readonly missDoc4ExportedConstFunction: "๐งน Exported const function should have a JSDoc block (/** ... */) ๐ฏ";
|
|
7
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.messages = exports.EMOJIS = exports.SERIES = void 0;
|
|
4
|
+
exports.SERIES = ['property', 'type', 'name', 'emoji', 'description'];
|
|
5
|
+
exports.EMOJIS = ['โก๏ธ', '๐ฏ', '๐ค'];
|
|
6
|
+
const createMSG = (
|
|
7
|
+
// items: any,
|
|
8
|
+
key, message, name, custom) => {
|
|
9
|
+
const suffixKey = name.charAt(0).toUpperCase() + name.slice(1);
|
|
10
|
+
const newMessage = `๐งน ${message.replace('{name}', name).replace('{custom}', custom || '')}`;
|
|
11
|
+
// emptyNameParam: '๐งน Each @param tag should contain a parameter name.',
|
|
12
|
+
const result = {};
|
|
13
|
+
const newKey = `${key}${suffixKey}`;
|
|
14
|
+
result[newKey] = newMessage;
|
|
15
|
+
return result;
|
|
16
|
+
// '๐งน The @returns tag should not be empty and should contain a description.',
|
|
17
|
+
};
|
|
18
|
+
const PARAM = (key, description, emoji) => {
|
|
19
|
+
return createMSG(key, description, 'param', emoji);
|
|
20
|
+
};
|
|
21
|
+
const RETURN = (key, description, emoji) => {
|
|
22
|
+
return createMSG(key, description, 'returns', emoji);
|
|
23
|
+
};
|
|
24
|
+
const tag = `@{name} tag`;
|
|
25
|
+
const line = `@{name} line`;
|
|
26
|
+
const EMPTY_DESC = 'emptyDescription';
|
|
27
|
+
exports.messages = {
|
|
28
|
+
missingSummaryEmoji: '๐งน Summary line should include "๐ฏ".',
|
|
29
|
+
missingDoc4ExportedFunction: '๐งน Exported function should have a JSDoc block (/** ... */) ๐ฏ',
|
|
30
|
+
missDoc4ExportedConstFunction: '๐งน Exported const function should have a JSDoc block (/** ... */) ๐ฏ',
|
|
31
|
+
...PARAM('emptyName', `Each ${tag} should contain a parameter {custom}.`),
|
|
32
|
+
// ... createMSG('emptyName', 'Each @{name} tag should contain a parameter {custom}.', 'returns'),
|
|
33
|
+
...PARAM('missingEmoji', `Each ${line} should include "{custom}".`, 'โก๏ธ'),
|
|
34
|
+
...RETURN('missingEmoji', `The ${line} should include "{custom}".`, '๐ค'),
|
|
35
|
+
...PARAM('missingType', `Each ${tag} should contain a {type} block.`, ''),
|
|
36
|
+
...RETURN('missingType', `Each ${tag} should contain a {type} block.`, ''),
|
|
37
|
+
...PARAM(EMPTY_DESC, `Each ${tag} should contain a non-empty description.`),
|
|
38
|
+
...RETURN(EMPTY_DESC, `The ${tag} should contain a non-empty description.`),
|
|
39
|
+
};
|
|
40
|
+
// export const MESSAGES as const;
|
|
41
|
+
//# sourceMappingURL=index.config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.config.js","sourceRoot":"","sources":["../src/index.config.ts"],"names":[],"mappings":";;;AAAa,QAAA,MAAM,GAAG,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC;AAC9D,QAAA,MAAM,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAEzC,MAAM,SAAS,GAAG;AACd,cAAc;AACd,GAAW,EACX,OAAe,EACf,IAAY,EACZ,MAAe,EACjB,EAAE;IACA,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC/D,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,MAAM,IAAI,EAAE,CAAC,EAAE,CAAC;IAC7F,yEAAyE;IACzE,MAAM,MAAM,GAA8B,EAAE,CAAC;IAC7C,MAAM,MAAM,GAAG,GAAG,GAAG,GAAG,SAAS,EAAE,CAAC;IACpC,MAAM,CAAC,MAAM,CAAC,GAAG,UAAU,CAAC;IAC5B,OAAO,MAAM,CAAC;IACd,mFAAmF;AACvF,CAAC,CAAC;AAEF,MAAM,KAAK,GAAG,CAAC,GAAW,EAAE,WAAmB,EAAE,KAAc,EAAE,EAAE;IAC/D,OAAO,SAAS,CAAC,GAAG,EAAE,WAAW,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AACvD,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,CAAC,GAAW,EAAE,WAAmB,EAAE,KAAc,EAAE,EAAE;IAChE,OAAO,SAAS,CAAC,GAAG,EAAE,WAAW,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;AACzD,CAAC,CAAC;AAEF,MAAM,GAAG,GAAG,aAAa,CAAC;AAC1B,MAAM,IAAI,GAAG,cAAc,CAAC;AAC5B,MAAM,UAAU,GAAG,kBAAkB,CAAC;AAEzB,QAAA,QAAQ,GAAG;IACpB,mBAAmB,EAAE,sCAAsC;IAC3D,2BAA2B,EACvB,gEAAgE;IACpE,6BAA6B,EACzB,sEAAsE;IAC1E,GAAG,KAAK,CAAC,WAAW,EAAE,QAAQ,GAAG,uCAAuC,CAAC;IACzE,kGAAkG;IAElG,GAAG,KAAK,CAAC,cAAc,EAAE,QAAQ,IAAI,6BAA6B,EAAE,IAAI,CAAC;IACzE,GAAG,MAAM,CAAC,cAAc,EAAE,OAAO,IAAI,6BAA6B,EAAE,IAAI,CAAC;IAEzE,GAAG,KAAK,CAAC,aAAa,EAAE,QAAQ,GAAG,iCAAiC,EAAE,EAAE,CAAC;IACzE,GAAG,MAAM,CAAC,aAAa,EAAE,QAAQ,GAAG,iCAAiC,EAAE,EAAE,CAAC;IAE1E,GAAG,KAAK,CAAC,UAAU,EAAE,QAAQ,GAAG,0CAA0C,CAAC;IAC3E,GAAG,MAAM,CAAC,UAAU,EAAE,OAAO,GAAG,0CAA0C,CAAC;CACrE,CAAC;AAEX,kCAAkC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ESLintUtils, TSESLint, TSESTree } from '@typescript-eslint/utils';
|
|
2
|
+
import type { ISSUE, PROPERTY_POS } from './index.d';
|
|
3
|
+
export type LOC = {
|
|
4
|
+
line: number;
|
|
5
|
+
column: number;
|
|
6
|
+
width?: number;
|
|
7
|
+
};
|
|
8
|
+
type SourceCode = TSESLint.SourceCode;
|
|
9
|
+
export type RuleAlias<TOptions extends readonly unknown[], TMessageIds extends string> = TSESLint.RuleModule<TMessageIds, TOptions>;
|
|
10
|
+
/**
|
|
11
|
+
* ๐ฏ check if the current code block comment is a JSDoc block comment
|
|
12
|
+
* @param {TSESTree.Comment} comment โก๏ธ comment to handle
|
|
13
|
+
* @param {SourceCode} source โก๏ธ current source code node
|
|
14
|
+
* @returns {boolean} ๐ค true if comment is a JSDoc block comment
|
|
15
|
+
*/
|
|
16
|
+
export declare const isJsdocBlockComment: (comment: TSESTree.Comment, source: SourceCode) => boolean;
|
|
17
|
+
export declare const hasLeadingJsdoc: (node: TSESTree.Node, source: SourceCode, allComments: any[]) => boolean;
|
|
18
|
+
export declare const getPosParts: (input: string, params?: string[]) => PROPERTY_POS;
|
|
19
|
+
type SeriesKey = keyof PROPERTY_POS;
|
|
20
|
+
export declare const getLoc: (series: string[], pos: PROPERTY_POS, line: number, search: string) => LOC;
|
|
21
|
+
export declare const getIssue: (pos: PROPERTY_POS, search: SeriesKey, line: number, name: string, errorType: string, issues: ISSUE[]) => void;
|
|
22
|
+
export declare const checkProperty: (name: string, rawLine: string, line: number, params?: string[]) => ISSUE[];
|
|
23
|
+
export declare const customJSDocFormat: ESLintUtils.RuleModule<"missingSummaryEmoji" | "missingDoc4ExportedFunction" | "missDoc4ExportedConstFunction", [], unknown, ESLintUtils.RuleListener> & {
|
|
24
|
+
name: string;
|
|
25
|
+
};
|
|
26
|
+
export {};
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.customJSDocFormat = exports.checkProperty = exports.getIssue = exports.getLoc = exports.getPosParts = exports.hasLeadingJsdoc = exports.isJsdocBlockComment = void 0;
|
|
4
|
+
// src/setup/linter/rules/jsdoc-emoji-format.ts
|
|
5
|
+
// comments are in english
|
|
6
|
+
const utils_1 = require("@typescript-eslint/utils");
|
|
7
|
+
const index_config_1 = require("./index.config");
|
|
8
|
+
const createRule = utils_1.ESLintUtils.RuleCreator((name) => `https://example.com/rule/${name}`);
|
|
9
|
+
const findFirstContentColumn = (rawLine) => {
|
|
10
|
+
// column of the first visible content (after optional leading spaces and '* ')
|
|
11
|
+
const m = rawLine.match(/^\s*\*?\s*/);
|
|
12
|
+
return m ? m[0].length : 0;
|
|
13
|
+
};
|
|
14
|
+
const reportAt = (messageId, start, context) => {
|
|
15
|
+
const line = start.line;
|
|
16
|
+
const column = start.column;
|
|
17
|
+
const width = start.width || 1;
|
|
18
|
+
context.report({
|
|
19
|
+
messageId,
|
|
20
|
+
loc: {
|
|
21
|
+
start: { line, column },
|
|
22
|
+
end: { line, column: column + Math.max(1, width) },
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* ๐ฏ check if the current code block comment is a JSDoc block comment
|
|
28
|
+
* @param {TSESTree.Comment} comment โก๏ธ comment to handle
|
|
29
|
+
* @param {SourceCode} source โก๏ธ current source code node
|
|
30
|
+
* @returns {boolean} ๐ค true if comment is a JSDoc block comment
|
|
31
|
+
*/
|
|
32
|
+
const isJsdocBlockComment = (comment, source) => {
|
|
33
|
+
const full = source.getText(comment);
|
|
34
|
+
return full.startsWith('/**') || full.endsWith('*/');
|
|
35
|
+
};
|
|
36
|
+
exports.isJsdocBlockComment = isJsdocBlockComment;
|
|
37
|
+
// helper: is there a leading JSDoc directly above this node?
|
|
38
|
+
const hasLeadingJsdoc = (node, source, allComments) => {
|
|
39
|
+
const lineBefore = node.loc.start.line - 1;
|
|
40
|
+
const comments = allComments.filter((c) => c.loc.end.line === lineBefore);
|
|
41
|
+
if (comments.length === 0)
|
|
42
|
+
return false;
|
|
43
|
+
const last = comments[comments.length - 1];
|
|
44
|
+
const isBlockComment = (0, exports.isJsdocBlockComment)(last, source);
|
|
45
|
+
return isBlockComment;
|
|
46
|
+
// ensure only whitespace between comment end and node start
|
|
47
|
+
// const [cEnd, nStart] = [last.range![1], node.range![0]];
|
|
48
|
+
// const between = source.getText().slice(cEnd, nStart);
|
|
49
|
+
// console.log('BETWEEN:', JSON.stringify(between));
|
|
50
|
+
// return /^[\s\r\n]*$/.test(between);
|
|
51
|
+
};
|
|
52
|
+
exports.hasLeadingJsdoc = hasLeadingJsdoc;
|
|
53
|
+
const acceptedStmtTypes = [
|
|
54
|
+
'ExportNamedDeclaration',
|
|
55
|
+
'ExportDefaultDeclaration',
|
|
56
|
+
'FunctionDeclaration',
|
|
57
|
+
];
|
|
58
|
+
const acceptedStmtTypes2 = [
|
|
59
|
+
'ExportNamedDeclaration',
|
|
60
|
+
'ExportDefaultDeclaration',
|
|
61
|
+
];
|
|
62
|
+
const isDeclaration = (stmt, type, hasStmtType) => {
|
|
63
|
+
const fnDecl = hasStmtType && stmt.declaration && stmt.declaration.type === type
|
|
64
|
+
? stmt.declaration
|
|
65
|
+
: null;
|
|
66
|
+
return fnDecl;
|
|
67
|
+
};
|
|
68
|
+
// new: report missing JSDoc on exported functions (declarations and const arrow/functions)
|
|
69
|
+
const checkExportedFunctionsForJsdoc = (program, context) => {
|
|
70
|
+
const source = context.sourceCode;
|
|
71
|
+
const comments = source.getAllComments();
|
|
72
|
+
const statements = program.body;
|
|
73
|
+
for (const stmt of statements) {
|
|
74
|
+
const hasFnType = acceptedStmtTypes.indexOf(stmt.type) !== -1;
|
|
75
|
+
if (!hasFnType)
|
|
76
|
+
continue;
|
|
77
|
+
const fnDecl = isDeclaration(stmt, 'FunctionDeclaration', hasFnType);
|
|
78
|
+
if (fnDecl) {
|
|
79
|
+
if (!(0, exports.hasLeadingJsdoc)(fnDecl, source, comments)) {
|
|
80
|
+
const line = fnDecl.loc.start.line;
|
|
81
|
+
const col = fnDecl.loc.start.column;
|
|
82
|
+
const loc = { line, column: col, width: 'function'.length };
|
|
83
|
+
reportAt('missingDoc4ExportedFunction', loc, context);
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
const params = fnDecl.params.map((p) => p.name);
|
|
87
|
+
const anchorNode = fnDecl;
|
|
88
|
+
const comment = comments.find((c) => c.loc.end.line === anchorNode.loc.start.line - 1);
|
|
89
|
+
if (comment) {
|
|
90
|
+
checkJsdocBlockContent(comment, context, params);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
const hasVarType = acceptedStmtTypes2.indexOf(stmt.type) !== -1;
|
|
95
|
+
const varDecl = isDeclaration(stmt, 'VariableDeclaration', hasVarType);
|
|
96
|
+
if (varDecl) {
|
|
97
|
+
for (const decl of varDecl.declarations) {
|
|
98
|
+
const init = decl.init;
|
|
99
|
+
const isFunctionLike = !!init &&
|
|
100
|
+
(init.type === 'ArrowFunctionExpression' ||
|
|
101
|
+
init.type === 'FunctionExpression');
|
|
102
|
+
if (isFunctionLike) {
|
|
103
|
+
const params = init
|
|
104
|
+
? init.params.map((p) => p.name)
|
|
105
|
+
: [];
|
|
106
|
+
// JSDoc typically sits above the VariableDeclaration
|
|
107
|
+
const anchorNode = varDecl;
|
|
108
|
+
if (!(0, exports.hasLeadingJsdoc)(anchorNode, source, comments)) {
|
|
109
|
+
const idNode = decl.id;
|
|
110
|
+
const line = idNode.loc.start.line;
|
|
111
|
+
const column = idNode.loc.start.column;
|
|
112
|
+
const width = idNode.name.length;
|
|
113
|
+
const loc = { line, column, width };
|
|
114
|
+
reportAt('missDoc4ExportedConstFunction', loc, context);
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
const comment = comments.find((c) => c.loc.end.line === anchorNode.loc.start.line - 1);
|
|
118
|
+
if (comment) {
|
|
119
|
+
checkJsdocBlockContent(comment, context, params);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
const getPosParts = (input, params = []) => {
|
|
128
|
+
const parts = input.split(/\s{1,}/).filter((p) => p.length > 0);
|
|
129
|
+
const result = {
|
|
130
|
+
all: [0, input.length - 1],
|
|
131
|
+
property: [-1, -1],
|
|
132
|
+
type: [-1, -1],
|
|
133
|
+
description: [-1, -1],
|
|
134
|
+
name: [-1, -1],
|
|
135
|
+
emoji: [-1, -1],
|
|
136
|
+
};
|
|
137
|
+
let hasEmoji = false;
|
|
138
|
+
let hasName = false;
|
|
139
|
+
let hasDescription = false;
|
|
140
|
+
let hasStart = false;
|
|
141
|
+
for (const p of parts) {
|
|
142
|
+
if (p === '*') {
|
|
143
|
+
hasStart = true;
|
|
144
|
+
}
|
|
145
|
+
else if (p.startsWith('@')) {
|
|
146
|
+
const propStart = input.indexOf(p);
|
|
147
|
+
result['property'] = [propStart, propStart + p.length - 1];
|
|
148
|
+
//
|
|
149
|
+
}
|
|
150
|
+
else if (p.startsWith('{') && p.endsWith('}')) {
|
|
151
|
+
const typeStart = input.indexOf(p);
|
|
152
|
+
result['type'] = [typeStart, typeStart + p.length - 1];
|
|
153
|
+
}
|
|
154
|
+
else if (index_config_1.EMOJIS.includes(p)) {
|
|
155
|
+
const emojiStart = input.indexOf(p);
|
|
156
|
+
result['emoji'] = [emojiStart, emojiStart]; //length = 2
|
|
157
|
+
hasEmoji = true;
|
|
158
|
+
if (!hasName && hasStart) {
|
|
159
|
+
hasName = true;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
if (!hasEmoji && !hasName && !hasDescription && hasStart) {
|
|
164
|
+
const nameStart = input.indexOf(p);
|
|
165
|
+
// console.log(p);
|
|
166
|
+
result['name'] = [nameStart, nameStart + p.length - 1];
|
|
167
|
+
hasName = true;
|
|
168
|
+
}
|
|
169
|
+
else if (hasName && !hasDescription) {
|
|
170
|
+
const descriptionStart = input.indexOf(p);
|
|
171
|
+
result['description'] = [descriptionStart, input.length - 1];
|
|
172
|
+
hasDescription = true;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
return { ...result };
|
|
177
|
+
};
|
|
178
|
+
exports.getPosParts = getPosParts;
|
|
179
|
+
const getLoc = (series, pos, line, search) => {
|
|
180
|
+
const filtered = series.filter((s) => pos[s][0] !== -1);
|
|
181
|
+
// console.log('filtered', filtered);
|
|
182
|
+
const indexSearch = series.indexOf(search);
|
|
183
|
+
let beforeKey = filtered[0];
|
|
184
|
+
for (let i = indexSearch - 1; i >= 0; i--) {
|
|
185
|
+
const maybe = series[i];
|
|
186
|
+
if (filtered.includes(maybe)) {
|
|
187
|
+
beforeKey = maybe;
|
|
188
|
+
break;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
let afterKey = filtered[filtered.length - 1];
|
|
192
|
+
for (let i = indexSearch + 1; i < series.length; i++) {
|
|
193
|
+
const maybe = series[i];
|
|
194
|
+
if (filtered.includes(maybe)) {
|
|
195
|
+
afterKey = maybe;
|
|
196
|
+
break;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
if (!pos[beforeKey] || !pos[afterKey]) {
|
|
200
|
+
// console.log('ERROR getLoc', {
|
|
201
|
+
// series,
|
|
202
|
+
// pos,
|
|
203
|
+
// line,
|
|
204
|
+
// search,
|
|
205
|
+
// beforeKey,
|
|
206
|
+
// afterKey,
|
|
207
|
+
// });
|
|
208
|
+
}
|
|
209
|
+
return {
|
|
210
|
+
line,
|
|
211
|
+
column: pos[beforeKey][1] + 1,
|
|
212
|
+
width: pos[afterKey][0] - pos[beforeKey][1] - 1,
|
|
213
|
+
};
|
|
214
|
+
// }
|
|
215
|
+
return { line, column: 0, width: 1 };
|
|
216
|
+
};
|
|
217
|
+
exports.getLoc = getLoc;
|
|
218
|
+
const getIssue = (pos, search, line, name, errorType, issues) => {
|
|
219
|
+
const issue = pos[search][0];
|
|
220
|
+
if (issue === -1) {
|
|
221
|
+
const newLoc = (0, exports.getLoc)(index_config_1.SERIES, pos, line, search);
|
|
222
|
+
const key = errorType + name.replace(/^([a-z])/, (str) => str.toUpperCase());
|
|
223
|
+
if (index_config_1.messages[key] !== undefined) {
|
|
224
|
+
// console.log('key', key);
|
|
225
|
+
issues.push({ key, loc: newLoc });
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
// console.log(`Unknown key: ${key}`);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
exports.getIssue = getIssue;
|
|
233
|
+
const checkProperty = (name, rawLine, line, params = []) => {
|
|
234
|
+
const issues = [];
|
|
235
|
+
const trimmedLine = rawLine.replace(/^\s*\*\s?/, '').trim();
|
|
236
|
+
const HAS_PROP_REGEX = new RegExp(`^@${name}\\b`);
|
|
237
|
+
const pos = (0, exports.getPosParts)(rawLine, params); // nicht trimmed line
|
|
238
|
+
if (!HAS_PROP_REGEX.test(trimmedLine))
|
|
239
|
+
return issues; // only check lines with @param or @returns
|
|
240
|
+
(0, exports.getIssue)(pos, 'type', line, name, 'missingType', issues);
|
|
241
|
+
(0, exports.getIssue)(pos, 'emoji', line, name, 'missingEmoji', issues);
|
|
242
|
+
(0, exports.getIssue)(pos, 'name', line, name, 'emptyName', issues);
|
|
243
|
+
(0, exports.getIssue)(pos, 'description', line, name, 'emptyDescription', issues);
|
|
244
|
+
return issues;
|
|
245
|
+
};
|
|
246
|
+
exports.checkProperty = checkProperty;
|
|
247
|
+
const checkJsdocBlockContent = (comment, context, params) => {
|
|
248
|
+
const source = context.sourceCode;
|
|
249
|
+
if (!(0, exports.isJsdocBlockComment)(comment, source))
|
|
250
|
+
return;
|
|
251
|
+
const raw = comment.value; // inner text between /** and */
|
|
252
|
+
const rawLines = raw.split('\n'); // includes leading " * " etc.
|
|
253
|
+
const baseLine = comment.loc.start.line; // 1-based
|
|
254
|
+
const trimmed = rawLines.map((l) => l.replace(/^\s*\*\s?/, '').trim());
|
|
255
|
+
// summary: first non-empty line
|
|
256
|
+
const summaryIdx = trimmed.findIndex((l) => l.length > 0);
|
|
257
|
+
if (summaryIdx >= 0) {
|
|
258
|
+
const summaryText = trimmed[summaryIdx];
|
|
259
|
+
if (!summaryText.includes('๐ฏ')) {
|
|
260
|
+
const srcLine = baseLine + summaryIdx;
|
|
261
|
+
const col = findFirstContentColumn(rawLines[summaryIdx]);
|
|
262
|
+
const loc = { line: srcLine, column: col, width: 1 };
|
|
263
|
+
reportAt('missingSummaryEmoji', loc, context);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
// per-line validations
|
|
267
|
+
rawLines.forEach((rawLine, idx) => {
|
|
268
|
+
const srcLine = baseLine + idx;
|
|
269
|
+
const issuesParam = (0, exports.checkProperty)('param', rawLine, srcLine, params);
|
|
270
|
+
const issuesReturn = (0, exports.checkProperty)('returns', rawLine, srcLine, params);
|
|
271
|
+
const issues = [...issuesParam, ...issuesReturn];
|
|
272
|
+
for (const issue of issues) {
|
|
273
|
+
// console.log(issue);
|
|
274
|
+
reportAt(issue.key, issue.loc, context);
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
};
|
|
278
|
+
exports.customJSDocFormat = createRule({
|
|
279
|
+
name: 'robertz-jsdoc-format',
|
|
280
|
+
meta: {
|
|
281
|
+
type: 'problem',
|
|
282
|
+
docs: {
|
|
283
|
+
description: 'enforce ๐ฏ in summary, โก๏ธ in @param, ๐ค in @returns and require {type} blocks for JSDoc',
|
|
284
|
+
// recommended: 'recommended'
|
|
285
|
+
},
|
|
286
|
+
messages: index_config_1.messages,
|
|
287
|
+
schema: [],
|
|
288
|
+
},
|
|
289
|
+
defaultOptions: [],
|
|
290
|
+
create: (context) => {
|
|
291
|
+
return {
|
|
292
|
+
Program: (node) => {
|
|
293
|
+
//ensure exported functions have a JSDoc block
|
|
294
|
+
checkExportedFunctionsForJsdoc(node, context);
|
|
295
|
+
},
|
|
296
|
+
};
|
|
297
|
+
},
|
|
298
|
+
});
|
|
299
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts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
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
"name": "@robert.tools/linter-jsdoc-format",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A linter to verify a correct jsdoc format",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"init": "robi init",
|
|
15
|
+
"release": "robi release",
|
|
16
|
+
"status": "robi status",
|
|
17
|
+
"version": "robi version",
|
|
18
|
+
"verbose": "robi verbose",
|
|
19
|
+
"pub": "npm whoami && npm publish --access public",
|
|
20
|
+
"build": "rm -rf dist && tsc -p tsconfig.build.json",
|
|
21
|
+
"test": "jest --coverage --runInBand --verbose --no-watchman",
|
|
22
|
+
"lint": "eslint .",
|
|
23
|
+
"check": "npm run lint && npm test && npm run build",
|
|
24
|
+
"prepublishOnly": "npm run check"
|
|
25
|
+
},
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "git+https://github.com/robert-tools/linter-jsdoc-format.git"
|
|
29
|
+
},
|
|
30
|
+
"bugs": {
|
|
31
|
+
"url": "https://github.com/robert-tools/linter-jsdoc-format/issues"
|
|
32
|
+
},
|
|
33
|
+
"homepage": "https://github.com/robert-tools/linter-jsdoc-format#readme",
|
|
34
|
+
"keywords": [
|
|
35
|
+
"typescript",
|
|
36
|
+
"node",
|
|
37
|
+
"linter-jsdoc-format",
|
|
38
|
+
"robert.tools"
|
|
39
|
+
],
|
|
40
|
+
"author": "Robert Willemelis",
|
|
41
|
+
"license": "MIT",
|
|
42
|
+
"engines": {
|
|
43
|
+
"node": ">=22"
|
|
44
|
+
},
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"access": "public",
|
|
47
|
+
"registry": "https://registry.npmjs.org/"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"@robert.tools/setup": "^1.3.0",
|
|
51
|
+
"@types/jest": "^29.5.14",
|
|
52
|
+
"@types/node": "^24.0.0",
|
|
53
|
+
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
54
|
+
"@typescript-eslint/parser": "^8.0.0",
|
|
55
|
+
"eslint": "^9.0.0",
|
|
56
|
+
"eslint-config-prettier": "^10.1.8",
|
|
57
|
+
"eslint-plugin-prettier": "^5.5.6",
|
|
58
|
+
"jest": "^29.7.0",
|
|
59
|
+
"jest-environment-jsdom": "^29.6.2",
|
|
60
|
+
"ts-jest": "^29.4.0",
|
|
61
|
+
"typescript": "^5.9.0"
|
|
62
|
+
}
|
|
63
|
+
}
|