Closed
Description
Expected behavior
The jsdoc/no-restricted-syntax
rule works with an inline and a single line JSDoc blocks.
Actual behavior
The jsdoc/jsdoc/no-restricted-syntax
doesn't report the issue when using an inline or single line JSDoc comment block. The rule works only for a multiline JSDdoc comment:
ESLint Config
module.exports = {
rules: {
'jsdoc/no-restricted-syntax': [
'error',
{
contexts: [
{
comment: 'JsdocBlock:has(JsdocTag[tag="type"]:has([value=/FunctionComponent/]))',
context: 'any',
message: 'The `FunctionComponent` type is not allowed. Please use `FC` instead.',
},
],
},
],
}
};
ESLint sample
/** @type {React.FunctionComponent<{ children: React.ReactNode }>}*/
const MyComponent = ({ children }) => {
return children;
}
Environment
- Node version: v16.13.0
- ESLint version v8.7.0
eslint-plugin-jsdoc
version: 37.6.1