fileoverview author Yann Braga
  import { ExportDefaultDeclaration , Node } from '@typescript-eslint/types/dist/ast-spec' ; import { getMetaObjectExpression } from '../utils' ; import { CategoryId } from '../utils/constants' ; import { createStorybookRule } from '../utils/create-storybook-rule' ; export = createStorybookRule ( { name : 'csf-component' , defaultOptions : [ ] , meta : { type : 'suggestion' , docs : { description : 'The component property should be set' , categories : [ CategoryId . CSF ] , recommended : 'warn' , } , messages : { missingComponentProperty : 'Missing component property.' , } , schema : [ ] , } , create ( context ) { return { ExportDefaultDeclaration ( node ) { const meta = getMetaObjectExpression ( node , context ) ; if ( ! meta ) { return null ; } const componentProperty = meta . properties . find ( ( property ) => property . key . name === 'component' ) ; if ( ! componentProperty ) { context . report ( { node , messageId : 'missingComponentProperty' , } ) ; } } , } ; } , } ) ;