That would mean we need to jsdoc a billion functions, which is silly; this therefore also filters the functions to only those exported from the module they're contained in (very neat!) and excludes those named "main," "clean," or "onStorageChanged," as we know what those are for.
This method is fairly ridiculous—I had to use the AST explorer toollinked here and trial and error to have any idea what I was doing. Neat to be aware of, though.
export default function(context) {
return {
'some selector'(node) {
context.report({
node,
message: 'Here is a match!'
});
}
};
};
Description
Fun fact: eslint plugins use a lightly modified CSS selector syntax to target specific parts of the abstract syntax tree. That's cute!
Anyway, as an obligatory followup to our discussion in https://github.com/AprilSylph/XKit-Rewritten/pull/1514#discussion_r1649783093, this adds "function expression" and "arrow function expression" to the list of function types the
jsdoc/require-jsdoc
eslint rule applies to. By default, it only applies to function declarations, which I think is very stupid.That would mean we need to jsdoc a billion functions, which is silly; this therefore also filters the functions to only those exported from the module they're contained in (very neat!) and excludes those named "main," "clean," or "onStorageChanged," as we know what those are for.
This method is fairly ridiculous—I had to use the AST explorer tool linked here and trial and error to have any idea what I was doing. Neat to be aware of, though.
Testing steps