1+ import jsdoc from 'eslint-plugin-jsdoc' ;
2+
3+ export default [
4+ {
5+ files : [ 'packages/super-editor/src/extensions/**/*.js' ] ,
6+ plugins : {
7+ jsdoc
8+ } ,
9+ rules : {
10+ // Require minimal JSDoc for extensions
11+ 'jsdoc/require-jsdoc' : [ 'warn' , {
12+ publicOnly : true ,
13+ require : {
14+ FunctionDeclaration : false ,
15+ MethodDefinition : false ,
16+ ClassDeclaration : false ,
17+ ArrowFunctionExpression : false ,
18+ FunctionExpression : false
19+ } ,
20+ contexts : [
21+ // Document the extension module
22+ 'ExportNamedDeclaration > VariableDeclaration > VariableDeclarator > CallExpression[callee.property.name="create"]'
23+
24+ // Note: We document commands/helpers with @param /@returns
25+ // inside addCommands/addHelpers, not with require-jsdoc
26+ ]
27+ } ] ,
28+
29+ // When JSDoc exists, validate it's correct
30+ 'jsdoc/require-param' : 'error' , // All params must be documented
31+ 'jsdoc/require-param-type' : 'error' , // @param must have {Type}
32+ 'jsdoc/check-param-names' : 'error' , // @param names must match
33+ 'jsdoc/check-types' : 'error' , // Valid type syntax (string not String)
34+
35+ // Optional - we use @returns {Function} or skip it
36+ 'jsdoc/require-returns' : 'off' ,
37+ 'jsdoc/require-returns-type' : 'off' ,
38+
39+ // Don't require descriptions if obvious
40+ 'jsdoc/require-param-description' : 'off' ,
41+ 'jsdoc/require-returns-description' : 'off' ,
42+ 'jsdoc/require-description' : 'off' ,
43+
44+ // Don't require examples - nice to have but not essential
45+ 'jsdoc/require-example' : 'off' ,
46+
47+ // Simple formatting
48+ 'jsdoc/require-hyphen-before-param-description' : 'off' , // Optional: @param {Type } name - Description
49+
50+ // Allow types from our .d.ts files and common types
51+ 'jsdoc/no-undefined-types' : [ 'warn' , {
52+ definedTypes : [
53+ // Allow any type that starts with capital letter (likely imported)
54+ '/^[A-Z]/' ,
55+
56+ // Common utility types
57+ 'Partial' , 'Required' , 'Readonly' , 'Pick' , 'Omit' ,
58+
59+ // Built-in types
60+ 'Function' , 'Object' , 'Array' , 'Promise' ,
61+
62+ // DOM
63+ 'HTMLElement' , 'Element' , 'Event'
64+ ]
65+ } ] ,
66+
67+ // Don't enforce these
68+ 'jsdoc/valid-types' : 'off' , // We use TypeScript syntax
69+ 'jsdoc/check-tag-names' : 'off' , // Allow @module , @typedef, etc.
70+ 'jsdoc/check-alignment' : 'off' , // Don't worry about alignment
71+ 'jsdoc/multiline-blocks' : 'off' // Allow single or multi-line
72+ } ,
73+ settings : {
74+ jsdoc : {
75+ mode : 'typescript' , // Understand TypeScript syntax in JSDoc
76+ preferredTypes : {
77+ object : 'Object' , // Use Object not object
78+ array : 'Array' , // Use Array not array
79+ 'Array.<>' : 'Array<>' , // Use Array<Type> not Array.<Type>
80+ }
81+ }
82+ }
83+ }
84+ ] ;
0 commit comments