import React from 'react'; import { NAMESPACE_CONFIG, Namespace, Rule } from '../../config'; import { parseDescription, t } from '../utils'; interface RuleTableProps { namespace: Namespace; hideOff: boolean; } export const RuleTable: React.FC = ({ namespace, hideOff }) => { return (

{t('规则说明')}

{t('错误的示例')}

{t('正确的示例')}

{Object.values(NAMESPACE_CONFIG[namespace].ruleConfig).map( ({ name, value, description, reason, badExample, goodExample, fixable, extendsBaseRule, requiresTypeChecking }) => (
{name}    {fixable && '🔧'} {requiresTypeChecking && '💭'} {extendsBaseRule && '👀'} #

{reason && (

)} {Array.isArray(value) && (

{t('配置:')} {typeof value[1] === 'object' ? (
                                            {`["error", ${JSON.stringify(value[1], null, 4)}]`}
                                        
) : ( {`["error", ${JSON.stringify(value[1])}]`} )}
)}
{badExample && (
                                    
                                
)}
{goodExample && (
                                    
                                
)}
) )}
); };