@futdevpro/dynamo-eslint 1.14.6 → 1.14.7
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/build/configs/base.js +12 -1
- package/build/configs/base.js.map +1 -1
- package/build/plugin/index.d.ts +8 -0
- package/build/plugin/index.d.ts.map +1 -1
- package/build/plugin/index.js +12 -0
- package/build/plugin/index.js.map +1 -1
- package/build/plugin/rules/explicit-types.js +2 -2
- package/build/plugin/rules/explicit-types.js.map +1 -1
- package/build/plugin/rules/prefer-enum-over-string-union.d.ts +4 -0
- package/build/plugin/rules/prefer-enum-over-string-union.d.ts.map +1 -0
- package/build/plugin/rules/prefer-enum-over-string-union.js +290 -0
- package/build/plugin/rules/prefer-enum-over-string-union.js.map +1 -0
- package/build/plugin/rules/prefer-enum-over-string-union.spec.d.ts +2 -0
- package/build/plugin/rules/prefer-enum-over-string-union.spec.d.ts.map +1 -0
- package/build/plugin/rules/prefer-enum-over-string-union.spec.js +505 -0
- package/build/plugin/rules/prefer-enum-over-string-union.spec.js.map +1 -0
- package/build/plugin/rules/prefer-interface-over-duplicate-types.d.ts +4 -0
- package/build/plugin/rules/prefer-interface-over-duplicate-types.d.ts.map +1 -0
- package/build/plugin/rules/prefer-interface-over-duplicate-types.js +231 -0
- package/build/plugin/rules/prefer-interface-over-duplicate-types.js.map +1 -0
- package/build/plugin/rules/prefer-interface-over-duplicate-types.spec.d.ts +2 -0
- package/build/plugin/rules/prefer-interface-over-duplicate-types.spec.d.ts.map +1 -0
- package/build/plugin/rules/prefer-interface-over-duplicate-types.spec.js +324 -0
- package/build/plugin/rules/prefer-interface-over-duplicate-types.spec.js.map +1 -0
- package/build/plugin/rules/require-jsdoc-description.d.ts +4 -0
- package/build/plugin/rules/require-jsdoc-description.d.ts.map +1 -0
- package/build/plugin/rules/require-jsdoc-description.js +379 -0
- package/build/plugin/rules/require-jsdoc-description.js.map +1 -0
- package/build/plugin/rules/require-jsdoc-description.spec.d.ts +2 -0
- package/build/plugin/rules/require-jsdoc-description.spec.d.ts.map +1 -0
- package/build/plugin/rules/require-jsdoc-description.spec.js +452 -0
- package/build/plugin/rules/require-jsdoc-description.spec.js.map +1 -0
- package/build/plugin/rules/require-test-description-prefix.d.ts +4 -0
- package/build/plugin/rules/require-test-description-prefix.d.ts.map +1 -0
- package/build/plugin/rules/require-test-description-prefix.js +135 -0
- package/build/plugin/rules/require-test-description-prefix.js.map +1 -0
- package/build/plugin/rules/require-test-description-prefix.spec.d.ts +2 -0
- package/build/plugin/rules/require-test-description-prefix.spec.d.ts.map +1 -0
- package/build/plugin/rules/require-test-description-prefix.spec.js +371 -0
- package/build/plugin/rules/require-test-description-prefix.spec.js.map +1 -0
- package/futdevpro-dynamo-eslint-1.14.7.tgz +0 -0
- package/package.json +1 -1
- package/src/configs/base.ts +12 -1
- package/src/plugin/index.ts +12 -0
- package/src/plugin/rules/explicit-types.ts +2 -2
- package/src/plugin/rules/prefer-enum-over-string-union.spec.ts +583 -0
- package/src/plugin/rules/prefer-enum-over-string-union.ts +333 -0
- package/src/plugin/rules/prefer-interface-over-duplicate-types.spec.ts +374 -0
- package/src/plugin/rules/prefer-interface-over-duplicate-types.ts +276 -0
- package/src/plugin/rules/require-jsdoc-description.spec.ts +542 -0
- package/src/plugin/rules/require-jsdoc-description.ts +436 -0
- package/src/plugin/rules/require-test-description-prefix.spec.ts +459 -0
- package/src/plugin/rules/require-test-description-prefix.ts +153 -0
- package/futdevpro-dynamo-eslint-1.14.6.tgz +0 -0
|
@@ -0,0 +1,452 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const require_jsdoc_description_1 = tslib_1.__importDefault(require("./require-jsdoc-description"));
|
|
5
|
+
describe('| require-jsdoc-description', () => {
|
|
6
|
+
it('| should be a valid ESLint rule', () => {
|
|
7
|
+
expect(require_jsdoc_description_1.default.meta?.type).toBe('suggestion');
|
|
8
|
+
expect(require_jsdoc_description_1.default.meta?.docs?.description).toContain('Require JSDoc comment blocks');
|
|
9
|
+
expect(require_jsdoc_description_1.default.meta?.fixable).toBeUndefined();
|
|
10
|
+
});
|
|
11
|
+
it('| should have create function that returns visitor object', () => {
|
|
12
|
+
const mockContext = {
|
|
13
|
+
report: () => { },
|
|
14
|
+
options: [{ scope: 'public' }],
|
|
15
|
+
sourceCode: {
|
|
16
|
+
getCommentsBefore: () => [],
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
const result = require_jsdoc_description_1.default.create(mockContext);
|
|
20
|
+
expect(typeof result).toBe('object');
|
|
21
|
+
expect(typeof result.FunctionDeclaration).toBe('function');
|
|
22
|
+
expect(typeof result.ClassDeclaration).toBe('function');
|
|
23
|
+
expect(typeof result.TSInterfaceDeclaration).toBe('function');
|
|
24
|
+
expect(typeof result.TSEnumDeclaration).toBe('function');
|
|
25
|
+
expect(typeof result.MethodDefinition).toBe('function');
|
|
26
|
+
expect(typeof result.VariableDeclarator).toBe('function');
|
|
27
|
+
});
|
|
28
|
+
it('| should not report when function has valid JSDoc', () => {
|
|
29
|
+
const mockContext = {
|
|
30
|
+
report: (options) => {
|
|
31
|
+
fail('Should not report when function has valid JSDoc');
|
|
32
|
+
},
|
|
33
|
+
options: [{ scope: 'public' }],
|
|
34
|
+
sourceCode: {
|
|
35
|
+
getCommentsBefore: () => [{
|
|
36
|
+
type: 'Block',
|
|
37
|
+
value: '* This is a test function',
|
|
38
|
+
loc: { end: { line: 1 } },
|
|
39
|
+
}],
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
const rule = require_jsdoc_description_1.default.create(mockContext);
|
|
43
|
+
const mockNode = {
|
|
44
|
+
type: 'FunctionDeclaration',
|
|
45
|
+
id: { name: 'testFunction' },
|
|
46
|
+
loc: { start: { line: 2 } },
|
|
47
|
+
};
|
|
48
|
+
rule.FunctionDeclaration(mockNode);
|
|
49
|
+
});
|
|
50
|
+
it('| should report when function is missing JSDoc', () => {
|
|
51
|
+
let reportCalled = false;
|
|
52
|
+
const mockContext = {
|
|
53
|
+
report: (options) => {
|
|
54
|
+
reportCalled = true;
|
|
55
|
+
expect(options.messageId).toBe('missingJSDoc');
|
|
56
|
+
expect(options.data.type).toBe('Function');
|
|
57
|
+
expect(options.data.name).toBe('testFunction');
|
|
58
|
+
},
|
|
59
|
+
options: [{ scope: 'public' }],
|
|
60
|
+
sourceCode: {
|
|
61
|
+
getCommentsBefore: () => [],
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
const rule = require_jsdoc_description_1.default.create(mockContext);
|
|
65
|
+
const mockNode = {
|
|
66
|
+
type: 'FunctionDeclaration',
|
|
67
|
+
id: { name: 'testFunction' },
|
|
68
|
+
loc: { start: { line: 1 } },
|
|
69
|
+
};
|
|
70
|
+
rule.FunctionDeclaration(mockNode);
|
|
71
|
+
expect(reportCalled).toBe(true);
|
|
72
|
+
});
|
|
73
|
+
it('| should report when JSDoc is empty (no description)', () => {
|
|
74
|
+
let reportCalled = false;
|
|
75
|
+
const mockContext = {
|
|
76
|
+
report: (options) => {
|
|
77
|
+
reportCalled = true;
|
|
78
|
+
expect(options.messageId).toBe('emptyJSDoc');
|
|
79
|
+
expect(options.data.type).toBe('Function');
|
|
80
|
+
expect(options.data.name).toBe('testFunction');
|
|
81
|
+
},
|
|
82
|
+
options: [{ scope: 'public' }],
|
|
83
|
+
sourceCode: {
|
|
84
|
+
getCommentsBefore: () => [{
|
|
85
|
+
type: 'Block',
|
|
86
|
+
value: '*',
|
|
87
|
+
loc: { end: { line: 1 } },
|
|
88
|
+
}],
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
const rule = require_jsdoc_description_1.default.create(mockContext);
|
|
92
|
+
const mockNode = {
|
|
93
|
+
type: 'FunctionDeclaration',
|
|
94
|
+
id: { name: 'testFunction' },
|
|
95
|
+
loc: { start: { line: 2 } },
|
|
96
|
+
};
|
|
97
|
+
rule.FunctionDeclaration(mockNode);
|
|
98
|
+
expect(reportCalled).toBe(true);
|
|
99
|
+
});
|
|
100
|
+
it('| should report when JSDoc is not on previous line', () => {
|
|
101
|
+
let reportCalled = false;
|
|
102
|
+
const mockContext = {
|
|
103
|
+
report: (options) => {
|
|
104
|
+
reportCalled = true;
|
|
105
|
+
expect(options.messageId).toBe('invalidJSDocPosition');
|
|
106
|
+
expect(options.data.type).toBe('Function');
|
|
107
|
+
expect(options.data.name).toBe('testFunction');
|
|
108
|
+
},
|
|
109
|
+
options: [{ scope: 'public' }],
|
|
110
|
+
sourceCode: {
|
|
111
|
+
getCommentsBefore: () => [{
|
|
112
|
+
type: 'Block',
|
|
113
|
+
value: '* This is a test function',
|
|
114
|
+
loc: { end: { line: 1 } },
|
|
115
|
+
}],
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
const rule = require_jsdoc_description_1.default.create(mockContext);
|
|
119
|
+
const mockNode = {
|
|
120
|
+
type: 'FunctionDeclaration',
|
|
121
|
+
id: { name: 'testFunction' },
|
|
122
|
+
loc: { start: { line: 3 } }, // Gap between comment and function
|
|
123
|
+
};
|
|
124
|
+
rule.FunctionDeclaration(mockNode);
|
|
125
|
+
expect(reportCalled).toBe(true);
|
|
126
|
+
});
|
|
127
|
+
it('| should report when function is not exported and scope is public', () => {
|
|
128
|
+
const mockContext = {
|
|
129
|
+
report: (options) => {
|
|
130
|
+
fail('Should not report when function is not exported in public scope');
|
|
131
|
+
},
|
|
132
|
+
options: [{ scope: 'public' }],
|
|
133
|
+
sourceCode: {
|
|
134
|
+
getCommentsBefore: () => [],
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
const rule = require_jsdoc_description_1.default.create(mockContext);
|
|
138
|
+
const mockNode = {
|
|
139
|
+
type: 'FunctionDeclaration',
|
|
140
|
+
id: { name: 'privateFunction' },
|
|
141
|
+
loc: { start: { line: 1 } },
|
|
142
|
+
parent: { type: 'Program', body: [] },
|
|
143
|
+
};
|
|
144
|
+
rule.FunctionDeclaration(mockNode);
|
|
145
|
+
// In public scope, non-exported functions should not be documented
|
|
146
|
+
});
|
|
147
|
+
it('| should report when function is private and scope is all', () => {
|
|
148
|
+
let reportCalled = false;
|
|
149
|
+
const mockContext = {
|
|
150
|
+
report: (options) => {
|
|
151
|
+
reportCalled = true;
|
|
152
|
+
expect(options.messageId).toBe('missingJSDoc');
|
|
153
|
+
},
|
|
154
|
+
options: [{ scope: 'all' }],
|
|
155
|
+
sourceCode: {
|
|
156
|
+
getCommentsBefore: () => [],
|
|
157
|
+
},
|
|
158
|
+
};
|
|
159
|
+
const rule = require_jsdoc_description_1.default.create(mockContext);
|
|
160
|
+
const mockNode = {
|
|
161
|
+
type: 'FunctionDeclaration',
|
|
162
|
+
id: { name: 'privateFunction' },
|
|
163
|
+
loc: { start: { line: 1 } },
|
|
164
|
+
};
|
|
165
|
+
rule.FunctionDeclaration(mockNode);
|
|
166
|
+
expect(reportCalled).toBe(true);
|
|
167
|
+
});
|
|
168
|
+
it('| should handle class declarations', () => {
|
|
169
|
+
let reportCalled = false;
|
|
170
|
+
const mockContext = {
|
|
171
|
+
report: (options) => {
|
|
172
|
+
reportCalled = true;
|
|
173
|
+
expect(options.data.type).toBe('Class');
|
|
174
|
+
expect(options.data.name).toBe('TestClass');
|
|
175
|
+
},
|
|
176
|
+
options: [{ scope: 'public' }],
|
|
177
|
+
sourceCode: {
|
|
178
|
+
getCommentsBefore: () => [],
|
|
179
|
+
},
|
|
180
|
+
};
|
|
181
|
+
const rule = require_jsdoc_description_1.default.create(mockContext);
|
|
182
|
+
const mockNode = {
|
|
183
|
+
type: 'ClassDeclaration',
|
|
184
|
+
id: { name: 'TestClass' },
|
|
185
|
+
loc: { start: { line: 1 } },
|
|
186
|
+
};
|
|
187
|
+
rule.ClassDeclaration(mockNode);
|
|
188
|
+
expect(reportCalled).toBe(true);
|
|
189
|
+
});
|
|
190
|
+
it('| should handle interface declarations', () => {
|
|
191
|
+
let reportCalled = false;
|
|
192
|
+
const mockContext = {
|
|
193
|
+
report: (options) => {
|
|
194
|
+
reportCalled = true;
|
|
195
|
+
expect(options.data.type).toBe('Interface');
|
|
196
|
+
expect(options.data.name).toBe('TestInterface');
|
|
197
|
+
},
|
|
198
|
+
options: [{ scope: 'public' }],
|
|
199
|
+
sourceCode: {
|
|
200
|
+
getCommentsBefore: () => [],
|
|
201
|
+
},
|
|
202
|
+
};
|
|
203
|
+
const rule = require_jsdoc_description_1.default.create(mockContext);
|
|
204
|
+
const mockNode = {
|
|
205
|
+
type: 'TSInterfaceDeclaration',
|
|
206
|
+
id: { name: 'TestInterface' },
|
|
207
|
+
loc: { start: { line: 1 } },
|
|
208
|
+
};
|
|
209
|
+
rule.TSInterfaceDeclaration(mockNode);
|
|
210
|
+
expect(reportCalled).toBe(true);
|
|
211
|
+
});
|
|
212
|
+
it('| should handle enum declarations', () => {
|
|
213
|
+
let reportCalled = false;
|
|
214
|
+
const mockContext = {
|
|
215
|
+
report: (options) => {
|
|
216
|
+
reportCalled = true;
|
|
217
|
+
expect(options.data.type).toBe('Enum');
|
|
218
|
+
expect(options.data.name).toBe('TestEnum');
|
|
219
|
+
},
|
|
220
|
+
options: [{ scope: 'public' }],
|
|
221
|
+
sourceCode: {
|
|
222
|
+
getCommentsBefore: () => [],
|
|
223
|
+
},
|
|
224
|
+
};
|
|
225
|
+
const rule = require_jsdoc_description_1.default.create(mockContext);
|
|
226
|
+
const mockNode = {
|
|
227
|
+
type: 'TSEnumDeclaration',
|
|
228
|
+
id: { name: 'TestEnum' },
|
|
229
|
+
loc: { start: { line: 1 } },
|
|
230
|
+
};
|
|
231
|
+
rule.TSEnumDeclaration(mockNode);
|
|
232
|
+
expect(reportCalled).toBe(true);
|
|
233
|
+
});
|
|
234
|
+
it('| should handle method definitions', () => {
|
|
235
|
+
let reportCalled = false;
|
|
236
|
+
const mockContext = {
|
|
237
|
+
report: (options) => {
|
|
238
|
+
reportCalled = true;
|
|
239
|
+
expect(options.data.type).toBe('Method');
|
|
240
|
+
expect(options.data.name).toBe('testMethod');
|
|
241
|
+
},
|
|
242
|
+
options: [{ scope: 'public' }],
|
|
243
|
+
sourceCode: {
|
|
244
|
+
getCommentsBefore: () => [],
|
|
245
|
+
},
|
|
246
|
+
};
|
|
247
|
+
const rule = require_jsdoc_description_1.default.create(mockContext);
|
|
248
|
+
const mockNode = {
|
|
249
|
+
type: 'MethodDefinition',
|
|
250
|
+
key: { name: 'testMethod' },
|
|
251
|
+
loc: { start: { line: 1 } },
|
|
252
|
+
};
|
|
253
|
+
rule.MethodDefinition(mockNode);
|
|
254
|
+
expect(reportCalled).toBe(true);
|
|
255
|
+
});
|
|
256
|
+
it('| should handle function expressions in variable declarations', () => {
|
|
257
|
+
let reportCalled = false;
|
|
258
|
+
const mockContext = {
|
|
259
|
+
report: (options) => {
|
|
260
|
+
reportCalled = true;
|
|
261
|
+
expect(options.data.type).toBe('Function');
|
|
262
|
+
},
|
|
263
|
+
options: [{ scope: 'public' }],
|
|
264
|
+
sourceCode: {
|
|
265
|
+
getCommentsBefore: () => [],
|
|
266
|
+
},
|
|
267
|
+
};
|
|
268
|
+
const rule = require_jsdoc_description_1.default.create(mockContext);
|
|
269
|
+
const mockNode = {
|
|
270
|
+
type: 'VariableDeclarator',
|
|
271
|
+
id: { name: 'testFunction' },
|
|
272
|
+
init: { type: 'FunctionExpression' },
|
|
273
|
+
loc: { start: { line: 1 } },
|
|
274
|
+
};
|
|
275
|
+
rule.VariableDeclarator(mockNode);
|
|
276
|
+
expect(reportCalled).toBe(true);
|
|
277
|
+
});
|
|
278
|
+
it('| should handle arrow functions in variable declarations', () => {
|
|
279
|
+
let reportCalled = false;
|
|
280
|
+
const mockContext = {
|
|
281
|
+
report: (options) => {
|
|
282
|
+
reportCalled = true;
|
|
283
|
+
expect(options.data.type).toBe('Function');
|
|
284
|
+
},
|
|
285
|
+
options: [{ scope: 'public' }],
|
|
286
|
+
sourceCode: {
|
|
287
|
+
getCommentsBefore: () => [],
|
|
288
|
+
},
|
|
289
|
+
};
|
|
290
|
+
const rule = require_jsdoc_description_1.default.create(mockContext);
|
|
291
|
+
const mockNode = {
|
|
292
|
+
type: 'VariableDeclarator',
|
|
293
|
+
id: { name: 'testArrowFunction' },
|
|
294
|
+
init: { type: 'ArrowFunctionExpression' },
|
|
295
|
+
loc: { start: { line: 1 } },
|
|
296
|
+
};
|
|
297
|
+
rule.VariableDeclarator(mockNode);
|
|
298
|
+
expect(reportCalled).toBe(true);
|
|
299
|
+
});
|
|
300
|
+
it('| should not report when variable declarator is not a function', () => {
|
|
301
|
+
const mockContext = {
|
|
302
|
+
report: (options) => {
|
|
303
|
+
fail('Should not report when variable is not a function');
|
|
304
|
+
},
|
|
305
|
+
options: [{ scope: 'public' }],
|
|
306
|
+
sourceCode: {
|
|
307
|
+
getCommentsBefore: () => [],
|
|
308
|
+
},
|
|
309
|
+
};
|
|
310
|
+
const rule = require_jsdoc_description_1.default.create(mockContext);
|
|
311
|
+
const mockNode = {
|
|
312
|
+
type: 'VariableDeclarator',
|
|
313
|
+
id: { name: 'testVariable' },
|
|
314
|
+
init: { type: 'Literal', value: 'test' },
|
|
315
|
+
loc: { start: { line: 1 } },
|
|
316
|
+
};
|
|
317
|
+
rule.VariableDeclarator(mockNode);
|
|
318
|
+
});
|
|
319
|
+
it('| should handle JSDoc with @param tags', () => {
|
|
320
|
+
const mockContext = {
|
|
321
|
+
report: (options) => {
|
|
322
|
+
fail('Should not report when JSDoc has description and @param tags');
|
|
323
|
+
},
|
|
324
|
+
options: [{ scope: 'public' }],
|
|
325
|
+
sourceCode: {
|
|
326
|
+
getCommentsBefore: () => [{
|
|
327
|
+
type: 'Block',
|
|
328
|
+
value: '* This function does something\n* @param {string} name The name parameter',
|
|
329
|
+
loc: { end: { line: 1 } },
|
|
330
|
+
}],
|
|
331
|
+
},
|
|
332
|
+
};
|
|
333
|
+
const rule = require_jsdoc_description_1.default.create(mockContext);
|
|
334
|
+
const mockNode = {
|
|
335
|
+
type: 'FunctionDeclaration',
|
|
336
|
+
id: { name: 'testFunction' },
|
|
337
|
+
loc: { start: { line: 2 } },
|
|
338
|
+
};
|
|
339
|
+
rule.FunctionDeclaration(mockNode);
|
|
340
|
+
});
|
|
341
|
+
it('| should handle JSDoc with only @param tags (no description)', () => {
|
|
342
|
+
let reportCalled = false;
|
|
343
|
+
const mockContext = {
|
|
344
|
+
report: (options) => {
|
|
345
|
+
reportCalled = true;
|
|
346
|
+
expect(options.messageId).toBe('emptyJSDoc');
|
|
347
|
+
},
|
|
348
|
+
options: [{ scope: 'public' }],
|
|
349
|
+
sourceCode: {
|
|
350
|
+
getCommentsBefore: () => [{
|
|
351
|
+
type: 'Block',
|
|
352
|
+
value: '* @param {string} name The name parameter',
|
|
353
|
+
loc: { end: { line: 1 } },
|
|
354
|
+
}],
|
|
355
|
+
},
|
|
356
|
+
};
|
|
357
|
+
const rule = require_jsdoc_description_1.default.create(mockContext);
|
|
358
|
+
const mockNode = {
|
|
359
|
+
type: 'FunctionDeclaration',
|
|
360
|
+
id: { name: 'testFunction' },
|
|
361
|
+
loc: { start: { line: 2 } },
|
|
362
|
+
};
|
|
363
|
+
rule.FunctionDeclaration(mockNode);
|
|
364
|
+
expect(reportCalled).toBe(true);
|
|
365
|
+
});
|
|
366
|
+
it('| should handle default scope when no options provided', () => {
|
|
367
|
+
let reportCalled = false;
|
|
368
|
+
const mockContext = {
|
|
369
|
+
report: (options) => {
|
|
370
|
+
reportCalled = true;
|
|
371
|
+
expect(options.messageId).toBe('missingJSDoc');
|
|
372
|
+
},
|
|
373
|
+
options: [],
|
|
374
|
+
sourceCode: {
|
|
375
|
+
getCommentsBefore: () => [],
|
|
376
|
+
},
|
|
377
|
+
};
|
|
378
|
+
const rule = require_jsdoc_description_1.default.create(mockContext);
|
|
379
|
+
const mockNode = {
|
|
380
|
+
type: 'FunctionDeclaration',
|
|
381
|
+
id: { name: 'testFunction' },
|
|
382
|
+
loc: { start: { line: 1 } },
|
|
383
|
+
};
|
|
384
|
+
rule.FunctionDeclaration(mockNode);
|
|
385
|
+
expect(reportCalled).toBe(true);
|
|
386
|
+
});
|
|
387
|
+
it('| should handle error cases gracefully', () => {
|
|
388
|
+
const mockContext = {
|
|
389
|
+
report: () => { },
|
|
390
|
+
options: [{ scope: 'public' }],
|
|
391
|
+
sourceCode: {
|
|
392
|
+
getCommentsBefore: () => {
|
|
393
|
+
throw new Error('Source code error');
|
|
394
|
+
},
|
|
395
|
+
},
|
|
396
|
+
};
|
|
397
|
+
const rule = require_jsdoc_description_1.default.create(mockContext);
|
|
398
|
+
const mockNode = {
|
|
399
|
+
type: 'FunctionDeclaration',
|
|
400
|
+
id: { name: 'testFunction' },
|
|
401
|
+
loc: { start: { line: 1 } },
|
|
402
|
+
};
|
|
403
|
+
// Should not throw error
|
|
404
|
+
expect(() => {
|
|
405
|
+
rule.FunctionDeclaration(mockNode);
|
|
406
|
+
}).not.toThrow();
|
|
407
|
+
});
|
|
408
|
+
it('| should handle anonymous functions', () => {
|
|
409
|
+
let reportCalled = false;
|
|
410
|
+
const mockContext = {
|
|
411
|
+
report: (options) => {
|
|
412
|
+
reportCalled = true;
|
|
413
|
+
expect(options.data.name).toBe('anonymous');
|
|
414
|
+
},
|
|
415
|
+
options: [{ scope: 'public' }],
|
|
416
|
+
sourceCode: {
|
|
417
|
+
getCommentsBefore: () => [],
|
|
418
|
+
},
|
|
419
|
+
};
|
|
420
|
+
const rule = require_jsdoc_description_1.default.create(mockContext);
|
|
421
|
+
const mockNode = {
|
|
422
|
+
type: 'FunctionDeclaration',
|
|
423
|
+
id: null, // Anonymous function
|
|
424
|
+
loc: { start: { line: 1 } },
|
|
425
|
+
};
|
|
426
|
+
rule.FunctionDeclaration(mockNode);
|
|
427
|
+
expect(reportCalled).toBe(true);
|
|
428
|
+
});
|
|
429
|
+
it('| should handle multiline JSDoc descriptions', () => {
|
|
430
|
+
const mockContext = {
|
|
431
|
+
report: (options) => {
|
|
432
|
+
fail('Should not report when JSDoc has multiline description');
|
|
433
|
+
},
|
|
434
|
+
options: [{ scope: 'public' }],
|
|
435
|
+
sourceCode: {
|
|
436
|
+
getCommentsBefore: () => [{
|
|
437
|
+
type: 'Block',
|
|
438
|
+
value: '* This is a multiline\n* description for the function\n* that explains what it does',
|
|
439
|
+
loc: { end: { line: 1 } },
|
|
440
|
+
}],
|
|
441
|
+
},
|
|
442
|
+
};
|
|
443
|
+
const rule = require_jsdoc_description_1.default.create(mockContext);
|
|
444
|
+
const mockNode = {
|
|
445
|
+
type: 'FunctionDeclaration',
|
|
446
|
+
id: { name: 'testFunction' },
|
|
447
|
+
loc: { start: { line: 2 } },
|
|
448
|
+
};
|
|
449
|
+
rule.FunctionDeclaration(mockNode);
|
|
450
|
+
});
|
|
451
|
+
});
|
|
452
|
+
//# sourceMappingURL=require-jsdoc-description.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"require-jsdoc-description.spec.js","sourceRoot":"","sources":["../../../src/plugin/rules/require-jsdoc-description.spec.ts"],"names":[],"mappings":";;;AAAA,oGAA2D;AAE3D,QAAQ,CAAC,6BAA6B,EAAE,GAAG,EAAE;IAC3C,EAAE,CAAC,iCAAiC,EAAE,GAAG,EAAE;QACzC,MAAM,CAAC,mCAAgB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACvD,MAAM,CAAC,mCAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC,SAAS,CAAC,8BAA8B,CAAC,CAAC;QAC3F,MAAM,CAAC,mCAAgB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,aAAa,EAAE,CAAC;IACzD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,2DAA2D,EAAE,GAAG,EAAE;QACnE,MAAM,WAAW,GAAG;YAClB,MAAM,EAAE,GAAG,EAAE,GAAE,CAAC;YAChB,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;YAC9B,UAAU,EAAE;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|
1
|
+
{"version":3,"file":"require-test-description-prefix.d.ts","sourceRoot":"","sources":["../../../src/plugin/rules/require-test-description-prefix.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAO9B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,UA+IhB,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const rule = {
|
|
4
|
+
meta: {
|
|
5
|
+
type: 'suggestion',
|
|
6
|
+
docs: {
|
|
7
|
+
description: 'Require "| " prefix in test descriptions',
|
|
8
|
+
recommended: true,
|
|
9
|
+
},
|
|
10
|
+
schema: [
|
|
11
|
+
{
|
|
12
|
+
type: 'object',
|
|
13
|
+
properties: {
|
|
14
|
+
prefix: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
default: '| ',
|
|
17
|
+
},
|
|
18
|
+
testFunctions: {
|
|
19
|
+
type: 'array',
|
|
20
|
+
items: {
|
|
21
|
+
type: 'string',
|
|
22
|
+
},
|
|
23
|
+
default: ['describe', 'it', 'test', 'beforeEach', 'afterEach', 'beforeAll', 'afterAll'],
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
additionalProperties: false,
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
messages: {
|
|
30
|
+
missingPrefix: 'Test description must start with "{{prefix}}"',
|
|
31
|
+
wrongPrefix: 'Test description must start with "{{prefix}}" but found "{{found}}"',
|
|
32
|
+
},
|
|
33
|
+
fixable: 'code',
|
|
34
|
+
},
|
|
35
|
+
create(context) {
|
|
36
|
+
const options = context.options[0] || {};
|
|
37
|
+
const prefix = options.prefix || '| ';
|
|
38
|
+
const testFunctions = options.testFunctions || ['describe', 'it', 'test', 'beforeEach', 'afterEach', 'beforeAll', 'afterAll'];
|
|
39
|
+
/**
|
|
40
|
+
* Check if a CallExpression is a test function
|
|
41
|
+
*/
|
|
42
|
+
function isTestFunction(node) {
|
|
43
|
+
try {
|
|
44
|
+
return node.type === 'CallExpression' &&
|
|
45
|
+
node.callee &&
|
|
46
|
+
node.callee.name &&
|
|
47
|
+
testFunctions.includes(node.callee.name);
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
console.error('[require-test-description-prefix] Error in isTestFunction:', error);
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Check if a string has the correct prefix
|
|
56
|
+
*/
|
|
57
|
+
function hasCorrectPrefix(description) {
|
|
58
|
+
try {
|
|
59
|
+
return typeof description === 'string' && description.startsWith(prefix);
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
console.error('[require-test-description-prefix] Error in hasCorrectPrefix:', error);
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Get the actual prefix found in the string
|
|
68
|
+
*/
|
|
69
|
+
function getFoundPrefix(description) {
|
|
70
|
+
try {
|
|
71
|
+
if (typeof description !== 'string' || description.length === 0) {
|
|
72
|
+
return '';
|
|
73
|
+
}
|
|
74
|
+
// Find the first non-alphanumeric character or end of string
|
|
75
|
+
const match = description.match(/^[^a-zA-Z0-9]*/);
|
|
76
|
+
return match ? match[0] : '';
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
console.error('[require-test-description-prefix] Error in getFoundPrefix:', error);
|
|
80
|
+
return '';
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Check and report on test function calls
|
|
85
|
+
*/
|
|
86
|
+
function checkTestFunction(node) {
|
|
87
|
+
try {
|
|
88
|
+
if (!isTestFunction(node)) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
// Check if there are arguments
|
|
92
|
+
if (!node.arguments || node.arguments.length === 0) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
const firstArg = node.arguments[0];
|
|
96
|
+
// Only check string literals
|
|
97
|
+
if (firstArg.type !== 'Literal' || typeof firstArg.value !== 'string') {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
const description = firstArg.value;
|
|
101
|
+
if (!hasCorrectPrefix(description)) {
|
|
102
|
+
const foundPrefix = getFoundPrefix(description);
|
|
103
|
+
context.report({
|
|
104
|
+
node: firstArg,
|
|
105
|
+
messageId: foundPrefix ? 'wrongPrefix' : 'missingPrefix',
|
|
106
|
+
data: {
|
|
107
|
+
prefix,
|
|
108
|
+
found: foundPrefix,
|
|
109
|
+
},
|
|
110
|
+
fix(fixer) {
|
|
111
|
+
try {
|
|
112
|
+
const newText = `${prefix}${description}`;
|
|
113
|
+
return fixer.replaceText(firstArg, `'${newText}'`);
|
|
114
|
+
}
|
|
115
|
+
catch (fixError) {
|
|
116
|
+
console.error('[require-test-description-prefix] Error in fix function:', fixError);
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
catch (error) {
|
|
124
|
+
console.error('[require-test-description-prefix] Error in checkTestFunction:', error);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return {
|
|
128
|
+
CallExpression(node) {
|
|
129
|
+
checkTestFunction(node);
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
exports.default = rule;
|
|
135
|
+
//# sourceMappingURL=require-test-description-prefix.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"require-test-description-prefix.js","sourceRoot":"","sources":["../../../src/plugin/rules/require-test-description-prefix.ts"],"names":[],"mappings":";;AAOA,MAAM,IAAI,GAAoB;IAC5B,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE;YACJ,WAAW,EAAE,0CAA0C;YACvD,WAAW,EAAE,IAAI;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AK,KAAK,QAAQ,EAAE,CAAC;oBACtE,OAAO;gBACT,CAAC;gBAED,MAAM,WAAW,GAAG,QAAQ,CAAC,KAAK,CAAC;gBAEnC,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,EAAE,CAAC;oBACnC,MAAM,WAAW,GAAG,cAAc,CAAC,WAAW,CAAC,CAAC;oBAEhD,OAAO,CAAC,MAAM,CAAC;wBACb,IAAI,EAAE,QAAQ;wBACd,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,eAAe;wBACxD,IAAI,EAAE;4BACJ,MAAM;4BACN,KAAK,EAAE,WAAW;yBACnB;wBACD,GAAG,CAAC,KAAK;4BACP,IAAI,CAAC;gCACH,MAAM,OAAO,GAAG,GAAG,MAAM,GAAG,WAAW,EAAE,CAAC;gCAE1C,OAAO,KAAK,CAAC,WAAW,CAAC,QAAQ,EAAE,IAAI,OAAO,GAAG,CAAC,CAAC;4BACrD,CAAC;4BAAC,OAAO,QAAQ,EAAE,CAAC;gCAClB,OAAO,CAAC,KAAK,CAAC,0DAA0D,EAAE,QAAQ,CAAC,CAAC;gCAEpF,OAAO,IAAI,CAAC;4BACd,CAAC;wBACH,CAAC;qBACF,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,KAAK,CAAC,+DAA+D,EAAE,KAAK,CAAC,CAAC;YACxF,CAAC;QACH,CAAC;QAED,OAAO;YACL,cAAc,CAAC,IAAS;gBACtB,iBAAiB,CAAC,IAAI,CAAC,CAAC;YAC1B,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,kBAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"require-test-description-prefix.spec.d.ts","sourceRoot":"","sources":["../../../src/plugin/rules/require-test-description-prefix.spec.ts"],"names":[],"mappings":""}
|