@@ -36,6 +36,13 @@ const OPTIONS_SCHEMA = {
3636 additionalProperties : false ,
3737 description : 'Has the following optional keys.\n' ,
3838 properties : {
39+ checkAllFunctionExpressions : {
40+ default : false ,
41+ description : `Normally, when \`FunctionExpression\` is checked, additional checks are
42+ added to check the parent contexts where reporting is likely to be desired. If you really
43+ want to check *all* function expressions, then set this to \`true\`.` ,
44+ type : 'boolean' ,
45+ } ,
3946 checkConstructors : {
4047 default : true ,
4148 description : `A value indicating whether \`constructor\`s should be checked. Defaults to
@@ -378,6 +385,7 @@ const getOption = (context, baseObject, option, key) => {
378385 * @param {import('eslint').Rule.RuleContext } context
379386 * @param {import('../iterateJsdoc.js').Settings } settings
380387 * @returns {{
388+ * checkAllFunctionExpressions: boolean,
381389 * contexts: (string|{
382390 * context: string,
383391 * inlineCommentBlock: boolean,
@@ -396,6 +404,7 @@ const getOption = (context, baseObject, option, key) => {
396404 */
397405const getOptions = ( context , settings ) => {
398406 const {
407+ checkAllFunctionExpressions = false ,
399408 contexts = settings . contexts || [ ] ,
400409 enableFixer = true ,
401410 exemptEmptyConstructors = true ,
@@ -408,6 +417,7 @@ const getOptions = (context, settings) => {
408417 } = context . options [ 0 ] || { } ;
409418
410419 return {
420+ checkAllFunctionExpressions,
411421 contexts,
412422 enableFixer,
413423 exemptEmptyConstructors,
@@ -503,7 +513,7 @@ const isFunctionWithOverload = (node) => {
503513 return false ;
504514 }
505515
506- const functionName = node . id . name ;
516+ const functionName = node . id ? .name ;
507517
508518 const idx = parent . body . indexOf ( child ) ;
509519 const prevSibling = parent . body [ idx - 1 ] ;
@@ -536,6 +546,7 @@ export default {
536546 const opts = getOptions ( context , settings ) ;
537547
538548 const {
549+ checkAllFunctionExpressions,
539550 contexts,
540551 enableFixer,
541552 exemptEmptyConstructors,
@@ -831,7 +842,7 @@ export default {
831842 return ;
832843 }
833844
834- if (
845+ if ( checkAllFunctionExpressions ||
835846 [
836847 'AssignmentExpression' , 'ExportDefaultDeclaration' , 'VariableDeclarator' ,
837848 ] . includes ( node . parent . type ) ||
0 commit comments